galaxy-commits
Threads by month
- ----- 2026 -----
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- 15302 discussions
3 new commits in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/6fdf96b4aef0/
Changeset: 6fdf96b4aef0
User: jmchilton
Date: 2013-10-11 17:40:43
Summary: Refactor building command lines out of job runner base into its own module.
Add unit tests. Test skipping metadata, using metadata, return code patch, dependency shell commands.
Affected #: 3 files
diff -r 829c047e05776fb2a6568f0d1076856fe6255fab -r 6fdf96b4aef00174938470f945d6931746e319f2 lib/galaxy/jobs/command_factory.py
--- /dev/null
+++ b/lib/galaxy/jobs/command_factory.py
@@ -0,0 +1,70 @@
+from os import getcwd
+from os.path import abspath
+
+
+def build_command( job, job_wrapper, include_metadata=False, include_work_dir_outputs=True ):
+ """
+ Compose the sequence of commands necessary to execute a job. This will
+ currently include:
+
+ - environment settings corresponding to any requirement tags
+ - preparing input files
+ - command line taken from job wrapper
+ - commands to set metadata (if include_metadata is True)
+ """
+
+ commands = job_wrapper.get_command_line()
+
+ # All job runners currently handle this case which should never occur
+ if not commands:
+ return None
+
+ # Prepend version string
+ if job_wrapper.version_string_cmd:
+ commands = "%s &> %s; " % ( job_wrapper.version_string_cmd, job_wrapper.get_version_string_path() ) + commands
+
+ # prepend getting input files (if defined)
+ if hasattr(job_wrapper, 'prepare_input_files_cmds') and job_wrapper.prepare_input_files_cmds is not None:
+ commands = "; ".join( job_wrapper.prepare_input_files_cmds + [ commands ] )
+
+ # Prepend dependency injection
+ if job_wrapper.dependency_shell_commands:
+ commands = "; ".join( job_wrapper.dependency_shell_commands + [ commands ] )
+
+ # Coping work dir outputs or setting metadata will mask return code of
+ # tool command. If these are used capture the return code and ensure
+ # the last thing that happens is an exit with return code.
+ capture_return_code_command = "; return_code=$?"
+ captured_return_code = False
+
+ # Append commands to copy job outputs based on from_work_dir attribute.
+ if include_work_dir_outputs:
+ work_dir_outputs = job.get_work_dir_outputs( job_wrapper )
+ if work_dir_outputs:
+ if not captured_return_code:
+ commands += capture_return_code_command
+ captured_return_code = True
+
+ commands += "; " + "; ".join( [ "if [ -f %s ] ; then cp %s %s ; fi" %
+ ( source_file, source_file, destination ) for ( source_file, destination ) in work_dir_outputs ] )
+
+ # Append metadata setting commands, we don't want to overwrite metadata
+ # that was copied over in init_meta(), as per established behavior
+ if include_metadata and job_wrapper.requires_setting_metadata:
+ if not captured_return_code:
+ commands += capture_return_code_command
+ captured_return_code = True
+ commands += "; cd %s; " % abspath( getcwd() )
+ commands += job_wrapper.setup_external_metadata(
+ exec_dir=abspath( getcwd() ),
+ tmp_dir=job_wrapper.working_directory,
+ dataset_files_path=job.app.model.Dataset.file_path,
+ output_fnames=job_wrapper.get_output_fnames(),
+ set_extension=False,
+ kwds={ 'overwrite' : False }
+ )
+
+ if captured_return_code:
+ commands += '; sh -c "exit $return_code"'
+
+ return commands
diff -r 829c047e05776fb2a6568f0d1076856fe6255fab -r 6fdf96b4aef00174938470f945d6931746e319f2 lib/galaxy/jobs/runners/__init__.py
--- a/lib/galaxy/jobs/runners/__init__.py
+++ b/lib/galaxy/jobs/runners/__init__.py
@@ -12,6 +12,7 @@
from Queue import Queue, Empty
import galaxy.jobs
+from galaxy.jobs.command_factory import build_command
from galaxy import model
from galaxy.util import DATABASE_MAX_STRING_SIZE, shrink_stream_by_size
@@ -142,67 +143,7 @@
raise NotImplementedError()
def build_command_line( self, job_wrapper, include_metadata=False, include_work_dir_outputs=True ):
- """
- Compose the sequence of commands necessary to execute a job. This will
- currently include:
-
- - environment settings corresponding to any requirement tags
- - preparing input files
- - command line taken from job wrapper
- - commands to set metadata (if include_metadata is True)
- """
-
- commands = job_wrapper.get_command_line()
- # All job runners currently handle this case which should never
- # occur
- if not commands:
- return None
- # Prepend version string
- if job_wrapper.version_string_cmd:
- commands = "%s &> %s; " % ( job_wrapper.version_string_cmd, job_wrapper.get_version_string_path() ) + commands
- # prepend getting input files (if defined)
- if hasattr(job_wrapper, 'prepare_input_files_cmds') and job_wrapper.prepare_input_files_cmds is not None:
- commands = "; ".join( job_wrapper.prepare_input_files_cmds + [ commands ] )
- # Prepend dependency injection
- if job_wrapper.dependency_shell_commands:
- commands = "; ".join( job_wrapper.dependency_shell_commands + [ commands ] )
-
- # Coping work dir outputs or setting metadata will mask return code of
- # tool command. If these are used capture the return code and ensure
- # the last thing that happens is an exit with return code.
- capture_return_code_command = "; return_code=$?"
- captured_return_code = False
-
- # Append commands to copy job outputs based on from_work_dir attribute.
- if include_work_dir_outputs:
- work_dir_outputs = self.get_work_dir_outputs( job_wrapper )
- if work_dir_outputs:
- if not captured_return_code:
- commands += capture_return_code_command
- captured_return_code = True
- commands += "; " + "; ".join( [ "if [ -f %s ] ; then cp %s %s ; fi" %
- ( source_file, source_file, destination ) for ( source_file, destination ) in work_dir_outputs ] )
-
- # Append metadata setting commands, we don't want to overwrite metadata
- # that was copied over in init_meta(), as per established behavior
- if include_metadata and job_wrapper.requires_setting_metadata:
- if not captured_return_code:
- commands += capture_return_code_command
- captured_return_code = True
- commands += "; cd %s; " % os.path.abspath( os.getcwd() )
- commands += job_wrapper.setup_external_metadata(
- exec_dir = os.path.abspath( os.getcwd() ),
- tmp_dir = job_wrapper.working_directory,
- dataset_files_path = self.app.model.Dataset.file_path,
- output_fnames = job_wrapper.get_output_fnames(),
- set_extension = False,
- kwds = { 'overwrite' : False } )
-
-
- if captured_return_code:
- commands += '; sh -c "exit $return_code"'
-
- return commands
+ return build_command( self, job_wrapper, include_metadata=include_metadata, include_work_dir_outputs=include_work_dir_outputs )
def get_work_dir_outputs( self, job_wrapper ):
"""
diff -r 829c047e05776fb2a6568f0d1076856fe6255fab -r 6fdf96b4aef00174938470f945d6931746e319f2 test/unit/test_command_factory.py
--- /dev/null
+++ b/test/unit/test_command_factory.py
@@ -0,0 +1,79 @@
+from os import getcwd
+from unittest import TestCase
+
+from galaxy.jobs.command_factory import build_command
+from galaxy.util.bunch import Bunch
+
+MOCK_COMMAND_LINE = "/opt/galaxy/tools/bowtie /mnt/galaxyData/files/000/input000.dat"
+
+
+class TestCommandFactory(TestCase):
+
+ def setUp(self):
+ self.job_wrapper = MockJobWrapper()
+ self.job = Bunch(app=Bunch(model=Bunch(Dataset=Bunch(file_path="file_path"))))
+ self.include_metadata = False
+ self.include_work_dir_outputs = True
+
+ def test_simplest_command(self):
+ self.include_work_dir_outputs = False
+ self.__assert_command_is( MOCK_COMMAND_LINE )
+
+ def test_shell_commands(self):
+ self.include_work_dir_outputs = False
+ dep_commands = [". /opt/galaxy/tools/bowtie/default/env.sh"]
+ self.job_wrapper.dependency_shell_commands = dep_commands
+ self.__assert_command_is( "%s; %s" % (dep_commands[0], MOCK_COMMAND_LINE) )
+
+ def test_set_metadata_skipped_if_unneeded(self):
+ self.include_metadata = True
+ self.include_work_dir_outputs = False
+ self.__assert_command_is( MOCK_COMMAND_LINE )
+
+ def test_set_metadata(self):
+ self.include_metadata = True
+ self.include_work_dir_outputs = False
+ metadata_line = "set_metadata_and_stuff.sh"
+ self.job_wrapper.metadata_line = metadata_line
+ expected_command = '%s; return_code=$?; cd %s; %s; sh -c "exit $return_code"' % (MOCK_COMMAND_LINE, getcwd(), metadata_line)
+ self.__assert_command_is( expected_command )
+
+ def __assert_command_is(self, expected_command):
+ command = self.__command()
+ self.assertEqual(command, expected_command)
+
+ def __command(self):
+ kwds = dict(
+ job=self.job,
+ job_wrapper=self.job_wrapper,
+ include_metadata=self.include_metadata,
+ include_work_dir_outputs=self.include_work_dir_outputs,
+ )
+ return build_command(**kwds)
+
+
+class MockJobWrapper(object):
+
+ def __init__(self):
+ self.version_string_cmd = None
+ self.command_line = MOCK_COMMAND_LINE
+ self.dependency_shell_commands = []
+ self.metadata_line = None
+ self.working_directory = "job1"
+
+ def get_command_line(self):
+ return self.command_line
+
+ @property
+ def requires_setting_metadata(self):
+ return self.metadata_line is not None
+
+ def setup_external_metadata(self, *args, **kwds):
+ return self.metadata_line
+
+ def get_output_fnames(self):
+ return []
+
+
+class MockJob(object):
+ app = Bunch()
https://bitbucket.org/galaxy/galaxy-central/commits/e0016057e164/
Changeset: e0016057e164
User: jmchilton
Date: 2013-10-11 17:40:43
Summary: Fix bug related to trailing semi-colon in tools.
Thanks to Bjoern, Nicola, Nate for helping track this down.
Affected #: 2 files
diff -r 6fdf96b4aef00174938470f945d6931746e319f2 -r e0016057e1648d7f4d29fbaf14252cbefff6d0bd lib/galaxy/jobs/command_factory.py
--- a/lib/galaxy/jobs/command_factory.py
+++ b/lib/galaxy/jobs/command_factory.py
@@ -19,6 +19,10 @@
if not commands:
return None
+ # Remove trailing semi-colon so we can start hacking up this command.
+ # TODO: Refactor to compose a list and join with ';', would be more clean.
+ commands = commands.rstrip(";")
+
# Prepend version string
if job_wrapper.version_string_cmd:
commands = "%s &> %s; " % ( job_wrapper.version_string_cmd, job_wrapper.get_version_string_path() ) + commands
diff -r 6fdf96b4aef00174938470f945d6931746e319f2 -r e0016057e1648d7f4d29fbaf14252cbefff6d0bd test/unit/test_command_factory.py
--- a/test/unit/test_command_factory.py
+++ b/test/unit/test_command_factory.py
@@ -31,6 +31,13 @@
self.__assert_command_is( MOCK_COMMAND_LINE )
def test_set_metadata(self):
+ self._test_set_metadata()
+
+ def test_strips_trailing_semicolons(self):
+ self.job_wrapper.command_line = "%s;" % MOCK_COMMAND_LINE
+ self._test_set_metadata()
+
+ def _test_set_metadata(self):
self.include_metadata = True
self.include_work_dir_outputs = False
metadata_line = "set_metadata_and_stuff.sh"
https://bitbucket.org/galaxy/galaxy-central/commits/e8fbf32ba1cc/
Changeset: e8fbf32ba1cc
User: jmchilton
Date: 2013-10-16 19:48:50
Summary: Merge pull request #235.
Fix for tools with trailing semi-colons.
Affected #: 3 files
diff -r e4d476ccf7832df0b1f65048d3784b010f84e59a -r e8fbf32ba1ccb4edec436e9ca76a40d6f64917be lib/galaxy/jobs/command_factory.py
--- /dev/null
+++ b/lib/galaxy/jobs/command_factory.py
@@ -0,0 +1,74 @@
+from os import getcwd
+from os.path import abspath
+
+
+def build_command( job, job_wrapper, include_metadata=False, include_work_dir_outputs=True ):
+ """
+ Compose the sequence of commands necessary to execute a job. This will
+ currently include:
+
+ - environment settings corresponding to any requirement tags
+ - preparing input files
+ - command line taken from job wrapper
+ - commands to set metadata (if include_metadata is True)
+ """
+
+ commands = job_wrapper.get_command_line()
+
+ # All job runners currently handle this case which should never occur
+ if not commands:
+ return None
+
+ # Remove trailing semi-colon so we can start hacking up this command.
+ # TODO: Refactor to compose a list and join with ';', would be more clean.
+ commands = commands.rstrip(";")
+
+ # Prepend version string
+ if job_wrapper.version_string_cmd:
+ commands = "%s &> %s; " % ( job_wrapper.version_string_cmd, job_wrapper.get_version_string_path() ) + commands
+
+ # prepend getting input files (if defined)
+ if hasattr(job_wrapper, 'prepare_input_files_cmds') and job_wrapper.prepare_input_files_cmds is not None:
+ commands = "; ".join( job_wrapper.prepare_input_files_cmds + [ commands ] )
+
+ # Prepend dependency injection
+ if job_wrapper.dependency_shell_commands:
+ commands = "; ".join( job_wrapper.dependency_shell_commands + [ commands ] )
+
+ # Coping work dir outputs or setting metadata will mask return code of
+ # tool command. If these are used capture the return code and ensure
+ # the last thing that happens is an exit with return code.
+ capture_return_code_command = "; return_code=$?"
+ captured_return_code = False
+
+ # Append commands to copy job outputs based on from_work_dir attribute.
+ if include_work_dir_outputs:
+ work_dir_outputs = job.get_work_dir_outputs( job_wrapper )
+ if work_dir_outputs:
+ if not captured_return_code:
+ commands += capture_return_code_command
+ captured_return_code = True
+
+ commands += "; " + "; ".join( [ "if [ -f %s ] ; then cp %s %s ; fi" %
+ ( source_file, source_file, destination ) for ( source_file, destination ) in work_dir_outputs ] )
+
+ # Append metadata setting commands, we don't want to overwrite metadata
+ # that was copied over in init_meta(), as per established behavior
+ if include_metadata and job_wrapper.requires_setting_metadata:
+ if not captured_return_code:
+ commands += capture_return_code_command
+ captured_return_code = True
+ commands += "; cd %s; " % abspath( getcwd() )
+ commands += job_wrapper.setup_external_metadata(
+ exec_dir=abspath( getcwd() ),
+ tmp_dir=job_wrapper.working_directory,
+ dataset_files_path=job.app.model.Dataset.file_path,
+ output_fnames=job_wrapper.get_output_fnames(),
+ set_extension=False,
+ kwds={ 'overwrite' : False }
+ )
+
+ if captured_return_code:
+ commands += '; sh -c "exit $return_code"'
+
+ return commands
diff -r e4d476ccf7832df0b1f65048d3784b010f84e59a -r e8fbf32ba1ccb4edec436e9ca76a40d6f64917be lib/galaxy/jobs/runners/__init__.py
--- a/lib/galaxy/jobs/runners/__init__.py
+++ b/lib/galaxy/jobs/runners/__init__.py
@@ -12,6 +12,7 @@
from Queue import Queue, Empty
import galaxy.jobs
+from galaxy.jobs.command_factory import build_command
from galaxy import model
from galaxy.util import DATABASE_MAX_STRING_SIZE, shrink_stream_by_size
@@ -142,67 +143,7 @@
raise NotImplementedError()
def build_command_line( self, job_wrapper, include_metadata=False, include_work_dir_outputs=True ):
- """
- Compose the sequence of commands necessary to execute a job. This will
- currently include:
-
- - environment settings corresponding to any requirement tags
- - preparing input files
- - command line taken from job wrapper
- - commands to set metadata (if include_metadata is True)
- """
-
- commands = job_wrapper.get_command_line()
- # All job runners currently handle this case which should never
- # occur
- if not commands:
- return None
- # Prepend version string
- if job_wrapper.version_string_cmd:
- commands = "%s &> %s; " % ( job_wrapper.version_string_cmd, job_wrapper.get_version_string_path() ) + commands
- # prepend getting input files (if defined)
- if hasattr(job_wrapper, 'prepare_input_files_cmds') and job_wrapper.prepare_input_files_cmds is not None:
- commands = "; ".join( job_wrapper.prepare_input_files_cmds + [ commands ] )
- # Prepend dependency injection
- if job_wrapper.dependency_shell_commands:
- commands = "; ".join( job_wrapper.dependency_shell_commands + [ commands ] )
-
- # Coping work dir outputs or setting metadata will mask return code of
- # tool command. If these are used capture the return code and ensure
- # the last thing that happens is an exit with return code.
- capture_return_code_command = "; return_code=$?"
- captured_return_code = False
-
- # Append commands to copy job outputs based on from_work_dir attribute.
- if include_work_dir_outputs:
- work_dir_outputs = self.get_work_dir_outputs( job_wrapper )
- if work_dir_outputs:
- if not captured_return_code:
- commands += capture_return_code_command
- captured_return_code = True
- commands += "; " + "; ".join( [ "if [ -f %s ] ; then cp %s %s ; fi" %
- ( source_file, source_file, destination ) for ( source_file, destination ) in work_dir_outputs ] )
-
- # Append metadata setting commands, we don't want to overwrite metadata
- # that was copied over in init_meta(), as per established behavior
- if include_metadata and job_wrapper.requires_setting_metadata:
- if not captured_return_code:
- commands += capture_return_code_command
- captured_return_code = True
- commands += "; cd %s; " % os.path.abspath( os.getcwd() )
- commands += job_wrapper.setup_external_metadata(
- exec_dir = os.path.abspath( os.getcwd() ),
- tmp_dir = job_wrapper.working_directory,
- dataset_files_path = self.app.model.Dataset.file_path,
- output_fnames = job_wrapper.get_output_fnames(),
- set_extension = False,
- kwds = { 'overwrite' : False } )
-
-
- if captured_return_code:
- commands += '; sh -c "exit $return_code"'
-
- return commands
+ return build_command( self, job_wrapper, include_metadata=include_metadata, include_work_dir_outputs=include_work_dir_outputs )
def get_work_dir_outputs( self, job_wrapper ):
"""
diff -r e4d476ccf7832df0b1f65048d3784b010f84e59a -r e8fbf32ba1ccb4edec436e9ca76a40d6f64917be test/unit/test_command_factory.py
--- /dev/null
+++ b/test/unit/test_command_factory.py
@@ -0,0 +1,86 @@
+from os import getcwd
+from unittest import TestCase
+
+from galaxy.jobs.command_factory import build_command
+from galaxy.util.bunch import Bunch
+
+MOCK_COMMAND_LINE = "/opt/galaxy/tools/bowtie /mnt/galaxyData/files/000/input000.dat"
+
+
+class TestCommandFactory(TestCase):
+
+ def setUp(self):
+ self.job_wrapper = MockJobWrapper()
+ self.job = Bunch(app=Bunch(model=Bunch(Dataset=Bunch(file_path="file_path"))))
+ self.include_metadata = False
+ self.include_work_dir_outputs = True
+
+ def test_simplest_command(self):
+ self.include_work_dir_outputs = False
+ self.__assert_command_is( MOCK_COMMAND_LINE )
+
+ def test_shell_commands(self):
+ self.include_work_dir_outputs = False
+ dep_commands = [". /opt/galaxy/tools/bowtie/default/env.sh"]
+ self.job_wrapper.dependency_shell_commands = dep_commands
+ self.__assert_command_is( "%s; %s" % (dep_commands[0], MOCK_COMMAND_LINE) )
+
+ def test_set_metadata_skipped_if_unneeded(self):
+ self.include_metadata = True
+ self.include_work_dir_outputs = False
+ self.__assert_command_is( MOCK_COMMAND_LINE )
+
+ def test_set_metadata(self):
+ self._test_set_metadata()
+
+ def test_strips_trailing_semicolons(self):
+ self.job_wrapper.command_line = "%s;" % MOCK_COMMAND_LINE
+ self._test_set_metadata()
+
+ def _test_set_metadata(self):
+ self.include_metadata = True
+ self.include_work_dir_outputs = False
+ metadata_line = "set_metadata_and_stuff.sh"
+ self.job_wrapper.metadata_line = metadata_line
+ expected_command = '%s; return_code=$?; cd %s; %s; sh -c "exit $return_code"' % (MOCK_COMMAND_LINE, getcwd(), metadata_line)
+ self.__assert_command_is( expected_command )
+
+ def __assert_command_is(self, expected_command):
+ command = self.__command()
+ self.assertEqual(command, expected_command)
+
+ def __command(self):
+ kwds = dict(
+ job=self.job,
+ job_wrapper=self.job_wrapper,
+ include_metadata=self.include_metadata,
+ include_work_dir_outputs=self.include_work_dir_outputs,
+ )
+ return build_command(**kwds)
+
+
+class MockJobWrapper(object):
+
+ def __init__(self):
+ self.version_string_cmd = None
+ self.command_line = MOCK_COMMAND_LINE
+ self.dependency_shell_commands = []
+ self.metadata_line = None
+ self.working_directory = "job1"
+
+ def get_command_line(self):
+ return self.command_line
+
+ @property
+ def requires_setting_metadata(self):
+ return self.metadata_line is not None
+
+ def setup_external_metadata(self, *args, **kwds):
+ return self.metadata_line
+
+ def get_output_fnames(self):
+ return []
+
+
+class MockJob(object):
+ app = Bunch()
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: jmchilton: Restore improvements to job output checking code.
by commits-noreply@bitbucket.org 16 Oct '13
by commits-noreply@bitbucket.org 16 Oct '13
16 Oct '13
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/e4d476ccf783/
Changeset: e4d476ccf783
User: jmchilton
Date: 2013-10-16 19:46:59
Summary: Restore improvements to job output checking code.
Affected #: 5 files
diff -r d966d09f77d9a3fed4401eb1e5e64d17a57d684e -r e4d476ccf7832df0b1f65048d3784b010f84e59a lib/galaxy/jobs/__init__.py
--- a/lib/galaxy/jobs/__init__.py
+++ b/lib/galaxy/jobs/__init__.py
@@ -25,6 +25,7 @@
from galaxy.util.bunch import Bunch
from galaxy.util.expressions import ExpressionContext
from galaxy.util.json import from_json_string
+from .output_checker import check_output
log = logging.getLogger( __name__ )
@@ -1079,158 +1080,7 @@
self.cleanup()
def check_tool_output( self, stdout, stderr, tool_exit_code, job ):
- """
- Check the output of a tool - given the stdout, stderr, and the tool's
- exit code, return True if the tool exited succesfully and False
- otherwise. No exceptions should be thrown. If this code encounters
- an exception, it returns True so that the workflow can continue;
- otherwise, a bug in this code could halt workflow progress.
- Note that, if the tool did not define any exit code handling or
- any stdio/stderr handling, then it reverts back to previous behavior:
- if stderr contains anything, then False is returned.
- Note that the job id is just for messages.
- """
- # By default, the tool succeeded. This covers the case where the code
- # has a bug but the tool was ok, and it lets a workflow continue.
- success = True
-
- try:
- # Check exit codes and match regular expressions against stdout and
- # stderr if this tool was configured to do so.
- # If there is a regular expression for scanning stdout/stderr,
- # then we assume that the tool writer overwrote the default
- # behavior of just setting an error if there is *anything* on
- # stderr.
- if ( len( self.tool.stdio_regexes ) > 0 or
- len( self.tool.stdio_exit_codes ) > 0 ):
- # Check the exit code ranges in the order in which
- # they were specified. Each exit_code is a StdioExitCode
- # that includes an applicable range. If the exit code was in
- # that range, then apply the error level and add a message.
- # If we've reached a fatal error rule, then stop.
- max_error_level = galaxy.tools.StdioErrorLevel.NO_ERROR
- if tool_exit_code != None:
- for stdio_exit_code in self.tool.stdio_exit_codes:
- if ( tool_exit_code >= stdio_exit_code.range_start and
- tool_exit_code <= stdio_exit_code.range_end ):
- # Tack on a generic description of the code
- # plus a specific code description. For example,
- # this might prepend "Job 42: Warning (Out of Memory)\n".
- code_desc = stdio_exit_code.desc
- if ( None == code_desc ):
- code_desc = ""
- tool_msg = ( "%s: Exit code %d (%s)" % (
- galaxy.tools.StdioErrorLevel.desc( stdio_exit_code.error_level ),
- tool_exit_code,
- code_desc ) )
- log.info( "Job %s: %s" % (job.get_id_tag(), tool_msg) )
- stderr = tool_msg + "\n" + stderr
- max_error_level = max( max_error_level,
- stdio_exit_code.error_level )
- if ( max_error_level >=
- galaxy.tools.StdioErrorLevel.FATAL ):
- break
-
- if max_error_level < galaxy.tools.StdioErrorLevel.FATAL:
- # We'll examine every regex. Each regex specifies whether
- # it is to be run on stdout, stderr, or both. (It is
- # possible for neither stdout nor stderr to be scanned,
- # but those regexes won't be used.) We record the highest
- # error level, which are currently "warning" and "fatal".
- # If fatal, then we set the job's state to ERROR.
- # If warning, then we still set the job's state to OK
- # but include a message. We'll do this if we haven't seen
- # a fatal error yet
- for regex in self.tool.stdio_regexes:
- # If ( this regex should be matched against stdout )
- # - Run the regex's match pattern against stdout
- # - If it matched, then determine the error level.
- # o If it was fatal, then we're done - break.
- # Repeat the stdout stuff for stderr.
- # TODO: Collapse this into a single function.
- if ( regex.stdout_match ):
- regex_match = re.search( regex.match, stdout,
- re.IGNORECASE )
- if ( regex_match ):
- rexmsg = self.regex_err_msg( regex_match, regex)
- log.info( "Job %s: %s"
- % ( job.get_id_tag(), rexmsg ) )
- stdout = rexmsg + "\n" + stdout
- max_error_level = max( max_error_level,
- regex.error_level )
- if ( max_error_level >=
- galaxy.tools.StdioErrorLevel.FATAL ):
- break
-
- if ( regex.stderr_match ):
- regex_match = re.search( regex.match, stderr,
- re.IGNORECASE )
- if ( regex_match ):
- rexmsg = self.regex_err_msg( regex_match, regex)
- log.info( "Job %s: %s"
- % ( job.get_id_tag(), rexmsg ) )
- stderr = rexmsg + "\n" + stderr
- max_error_level = max( max_error_level,
- regex.error_level )
- if ( max_error_level >=
- galaxy.tools.StdioErrorLevel.FATAL ):
- break
-
- # If we encountered a fatal error, then we'll need to set the
- # job state accordingly. Otherwise the job is ok:
- if max_error_level >= galaxy.tools.StdioErrorLevel.FATAL:
- success = False
- else:
- success = True
-
- # When there are no regular expressions and no exit codes to check,
- # default to the previous behavior: when there's anything on stderr
- # the job has an error, and the job is ok otherwise.
- else:
- # TODO: Add in the tool and job id:
- # log.debug( "Tool did not define exit code or stdio handling; "
- # + "checking stderr for success" )
- if stderr:
- success = False
- else:
- success = True
-
- # On any exception, return True.
- except:
- tb = traceback.format_exc()
- log.warning( "Tool check encountered unexpected exception; "
- + "assuming tool was successful: " + tb )
- success = True
-
- # Store the modified stdout and stderr in the job:
- if None != job:
- job.stdout = stdout
- job.stderr = stderr
-
- return success
-
- def regex_err_msg( self, match, regex ):
- """
- Return a message about the match on tool output using the given
- ToolStdioRegex regex object. The regex_match is a MatchObject
- that will contain the string matched on.
- """
- # Get the description for the error level:
- err_msg = galaxy.tools.StdioErrorLevel.desc( regex.error_level ) + ": "
- # If there's a description for the regular expression, then use it.
- # Otherwise, we'll take the first 256 characters of the match.
- if None != regex.desc:
- err_msg += regex.desc
- else:
- mstart = match.start()
- mend = match.end()
- err_msg += "Matched on "
- # TODO: Move the constant 256 somewhere else besides here.
- if mend - mstart > 256:
- err_msg += match.string[ mstart : mstart+256 ] + "..."
- else:
- err_msg += match.string[ mstart: mend ]
- return err_msg
+ return check_output( self.tool, stdout, stderr, tool_exit_code, job )
def cleanup( self ):
# remove temporary files
diff -r d966d09f77d9a3fed4401eb1e5e64d17a57d684e -r e4d476ccf7832df0b1f65048d3784b010f84e59a lib/galaxy/jobs/error_level.py
--- /dev/null
+++ b/lib/galaxy/jobs/error_level.py
@@ -0,0 +1,25 @@
+
+
+# These determine stdio-based error levels from matching on regular expressions
+# and exit codes. They are meant to be used comparatively, such as showing
+# that warning < fatal. This is really meant to just be an enum.
+class StdioErrorLevel( object ):
+ NO_ERROR = 0
+ LOG = 1
+ WARNING = 2
+ FATAL = 3
+ MAX = 3
+ descs = {
+ NO_ERROR: 'No error',
+ LOG: 'Log',
+ WARNING: 'Warning',
+ FATAL: 'Fatal error',
+ }
+
+ @staticmethod
+ def desc( error_level ):
+ err_msg = "Unknown error"
+ if ( error_level > 0 and
+ error_level <= StdioErrorLevel.MAX ):
+ err_msg = StdioErrorLevel.descs[ error_level ]
+ return err_msg
diff -r d966d09f77d9a3fed4401eb1e5e64d17a57d684e -r e4d476ccf7832df0b1f65048d3784b010f84e59a lib/galaxy/jobs/output_checker.py
--- /dev/null
+++ b/lib/galaxy/jobs/output_checker.py
@@ -0,0 +1,164 @@
+import re
+from .error_level import StdioErrorLevel
+import traceback
+
+from logging import getLogger
+log = getLogger( __name__ )
+
+
+def check_output( tool, stdout, stderr, tool_exit_code, job ):
+ """
+ Check the output of a tool - given the stdout, stderr, and the tool's
+ exit code, return True if the tool exited succesfully and False
+ otherwise. No exceptions should be thrown. If this code encounters
+ an exception, it returns True so that the workflow can continue;
+ otherwise, a bug in this code could halt workflow progress.
+
+ Note that, if the tool did not define any exit code handling or
+ any stdio/stderr handling, then it reverts back to previous behavior:
+ if stderr contains anything, then False is returned.
+
+ Note that the job id is just for messages.
+ """
+ # By default, the tool succeeded. This covers the case where the code
+ # has a bug but the tool was ok, and it lets a workflow continue.
+ success = True
+
+ try:
+ # Check exit codes and match regular expressions against stdout and
+ # stderr if this tool was configured to do so.
+ # If there is a regular expression for scanning stdout/stderr,
+ # then we assume that the tool writer overwrote the default
+ # behavior of just setting an error if there is *anything* on
+ # stderr.
+ if ( len( tool.stdio_regexes ) > 0 or
+ len( tool.stdio_exit_codes ) > 0 ):
+ # Check the exit code ranges in the order in which
+ # they were specified. Each exit_code is a StdioExitCode
+ # that includes an applicable range. If the exit code was in
+ # that range, then apply the error level and add a message.
+ # If we've reached a fatal error rule, then stop.
+ max_error_level = StdioErrorLevel.NO_ERROR
+ if tool_exit_code != None:
+ for stdio_exit_code in tool.stdio_exit_codes:
+ if ( tool_exit_code >= stdio_exit_code.range_start and
+ tool_exit_code <= stdio_exit_code.range_end ):
+ # Tack on a generic description of the code
+ # plus a specific code description. For example,
+ # this might prepend "Job 42: Warning (Out of Memory)\n".
+ code_desc = stdio_exit_code.desc
+ if ( None == code_desc ):
+ code_desc = ""
+ tool_msg = ( "%s: Exit code %d (%s)" % (
+ StdioErrorLevel.desc( stdio_exit_code.error_level ),
+ tool_exit_code,
+ code_desc ) )
+ log.info( "Job %s: %s" % (job.get_id_tag(), tool_msg) )
+ stderr = tool_msg + "\n" + stderr
+ max_error_level = max( max_error_level,
+ stdio_exit_code.error_level )
+ if ( max_error_level >=
+ StdioErrorLevel.FATAL ):
+ break
+
+ if max_error_level < StdioErrorLevel.FATAL:
+ # We'll examine every regex. Each regex specifies whether
+ # it is to be run on stdout, stderr, or both. (It is
+ # possible for neither stdout nor stderr to be scanned,
+ # but those regexes won't be used.) We record the highest
+ # error level, which are currently "warning" and "fatal".
+ # If fatal, then we set the job's state to ERROR.
+ # If warning, then we still set the job's state to OK
+ # but include a message. We'll do this if we haven't seen
+ # a fatal error yet
+ for regex in tool.stdio_regexes:
+ # If ( this regex should be matched against stdout )
+ # - Run the regex's match pattern against stdout
+ # - If it matched, then determine the error level.
+ # o If it was fatal, then we're done - break.
+ # Repeat the stdout stuff for stderr.
+ # TODO: Collapse this into a single function.
+ if ( regex.stdout_match ):
+ regex_match = re.search( regex.match, stdout,
+ re.IGNORECASE )
+ if ( regex_match ):
+ rexmsg = __regex_err_msg( regex_match, regex)
+ log.info( "Job %s: %s"
+ % ( job.get_id_tag(), rexmsg ) )
+ stdout = rexmsg + "\n" + stdout
+ max_error_level = max( max_error_level,
+ regex.error_level )
+ if ( max_error_level >=
+ StdioErrorLevel.FATAL ):
+ break
+
+ if ( regex.stderr_match ):
+ regex_match = re.search( regex.match, stderr,
+ re.IGNORECASE )
+ if ( regex_match ):
+ rexmsg = __regex_err_msg( regex_match, regex)
+ log.info( "Job %s: %s"
+ % ( job.get_id_tag(), rexmsg ) )
+ stderr = rexmsg + "\n" + stderr
+ max_error_level = max( max_error_level,
+ regex.error_level )
+ if ( max_error_level >=
+ StdioErrorLevel.FATAL ):
+ break
+
+ # If we encountered a fatal error, then we'll need to set the
+ # job state accordingly. Otherwise the job is ok:
+ if max_error_level >= StdioErrorLevel.FATAL:
+ success = False
+ else:
+ success = True
+
+ # When there are no regular expressions and no exit codes to check,
+ # default to the previous behavior: when there's anything on stderr
+ # the job has an error, and the job is ok otherwise.
+ else:
+ # TODO: Add in the tool and job id:
+ # log.debug( "Tool did not define exit code or stdio handling; "
+ # + "checking stderr for success" )
+ if stderr:
+ success = False
+ else:
+ success = True
+
+ # On any exception, return True.
+ except:
+ tb = traceback.format_exc()
+ log.warning( "Tool check encountered unexpected exception; "
+ + "assuming tool was successful: " + tb )
+ success = True
+
+ # Store the modified stdout and stderr in the job:
+ if None != job:
+ job.stdout = stdout
+ job.stderr = stderr
+
+ return success
+
+
+def __regex_err_msg( match, regex ):
+ """
+ Return a message about the match on tool output using the given
+ ToolStdioRegex regex object. The regex_match is a MatchObject
+ that will contain the string matched on.
+ """
+ # Get the description for the error level:
+ err_msg = StdioErrorLevel.desc( regex.error_level ) + ": "
+ # If there's a description for the regular expression, then use it.
+ # Otherwise, we'll take the first 256 characters of the match.
+ if None != regex.desc:
+ err_msg += regex.desc
+ else:
+ mstart = match.start()
+ mend = match.end()
+ err_msg += "Matched on "
+ # TODO: Move the constant 256 somewhere else besides here.
+ if mend - mstart > 256:
+ err_msg += match.string[ mstart : mstart + 256 ] + "..."
+ else:
+ err_msg += match.string[ mstart: mend ]
+ return err_msg
diff -r d966d09f77d9a3fed4401eb1e5e64d17a57d684e -r e4d476ccf7832df0b1f65048d3784b010f84e59a lib/galaxy/tools/__init__.py
--- a/lib/galaxy/tools/__init__.py
+++ b/lib/galaxy/tools/__init__.py
@@ -34,6 +34,7 @@
from sqlalchemy import and_
from galaxy import jobs, model
+from galaxy.jobs.error_level import StdioErrorLevel
from galaxy.datatypes.metadata import JobExternalOutputMetadataWrapper
from galaxy.jobs import ParallelismInfo
from galaxy.tools.actions import DefaultToolAction
@@ -64,33 +65,11 @@
from tool_shed.util import shed_util_common
from .loader import load_tool, template_macro_params
+
log = logging.getLogger( __name__ )
WORKFLOW_PARAMETER_REGULAR_EXPRESSION = re.compile( '''\$\{.+?\}''' )
-# These determine stdio-based error levels from matching on regular expressions
-# and exit codes. They are meant to be used comparatively, such as showing
-# that warning < fatal. This is really meant to just be an enum.
-class StdioErrorLevel( object ):
- NO_ERROR = 0
- LOG = 1
- WARNING = 2
- FATAL = 3
- MAX = 3
- descs = {
- NO_ERROR : 'No error',
- LOG: 'Log',
- WARNING : 'Warning',
- FATAL : 'Fatal error'
- }
- @staticmethod
- def desc( error_level ):
- err_msg = "Unknown error"
- if ( error_level > 0 and
- error_level <= StdioErrorLevel.MAX ):
- err_msg = StdioErrorLevel.descs[ error_level ]
- return err_msg
-
class ToolNotFoundException( Exception ):
pass
diff -r d966d09f77d9a3fed4401eb1e5e64d17a57d684e -r e4d476ccf7832df0b1f65048d3784b010f84e59a test/unit/test_job_output_checker.py
--- /dev/null
+++ b/test/unit/test_job_output_checker.py
@@ -0,0 +1,62 @@
+from unittest import TestCase
+from galaxy.util.bunch import Bunch
+from galaxy.jobs.output_checker import check_output
+from galaxy.jobs.error_level import StdioErrorLevel
+
+
+class OutputCheckerTestCase( TestCase ):
+
+ def setUp( self ):
+ self.tool = Bunch(
+ stdio_regexes=[],
+ stdio_exit_codes=[],
+ )
+ self.job = Bunch(
+ stdout=None,
+ stderr=None,
+ get_id_tag=lambda: "test_id",
+ )
+ self.stdout = ''
+ self.stderr = ''
+ self.tool_exit_code = None
+
+ def test_default_no_stderr_success( self ):
+ self.__assertSuccessful()
+
+ def test_default_stderr_failure( self ):
+ self.stderr = 'foo'
+ self.__assertNotSuccessful()
+
+ def test_exit_code_error( self ):
+ mock_exit_code = Bunch( range_start=1, range_end=1, error_level=StdioErrorLevel.FATAL, desc=None )
+ self.tool.stdio_exit_codes.append( mock_exit_code )
+ self.tool_exit_code = 1
+ self.__assertNotSuccessful()
+
+ def test_exit_code_success( self ):
+ mock_exit_code = Bunch( range_start=1, range_end=1, error_level=StdioErrorLevel.FATAL, desc=None )
+ self.tool.stdio_exit_codes.append( mock_exit_code )
+ self.tool_exit_code = 0
+ self.__assertSuccessful()
+
+ def test_problematic_strings( self ):
+ problematic_str = '\x80abc'
+ regex_rule = Bunch( match=r'.abc', stdout_match=False, stderr_match=True, error_level=StdioErrorLevel.FATAL, desc=None )
+ self.tool.stdio_regexes = [ regex_rule ]
+ self.stderr = problematic_str
+ self.__assertNotSuccessful()
+
+ problematic_str = '\x80abc'
+ regex_rule = Bunch( match=r'.abcd', stdout_match=False, stderr_match=True, error_level=StdioErrorLevel.FATAL, desc=None )
+ self.tool.stdio_regexes = [ regex_rule ]
+ self.stderr = problematic_str
+ self.__assertSuccessful()
+
+ def __assertSuccessful( self ):
+ self.assertTrue( self.__check_output() )
+
+ def __assertNotSuccessful( self ):
+ self.assertFalse( self.__check_output() )
+
+ def __check_output( self ):
+ return check_output( self.tool, self.stdout, self.stderr, self.tool_exit_code, self.job )
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: jgoecks: Remove tipsy because it has been replaced by bootstrap tooltips.
by commits-noreply@bitbucket.org 16 Oct '13
by commits-noreply@bitbucket.org 16 Oct '13
16 Oct '13
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/d966d09f77d9/
Changeset: d966d09f77d9
User: jgoecks
Date: 2013-10-16 19:03:47
Summary: Remove tipsy because it has been replaced by bootstrap tooltips.
Affected #: 4 files
diff -r 2d78abc47928918a14f56711657696724cd9af72 -r d966d09f77d9a3fed4401eb1e5e64d17a57d684e static/scripts/galaxy.base.js
--- a/static/scripts/galaxy.base.js
+++ b/static/scripts/galaxy.base.js
@@ -666,11 +666,6 @@
});
// Tooltips
- // if ( $.fn.tipsy ) {
- // // FIXME: tipsy gravity cannot be updated, so need classes that specify N/S gravity and
- // // initialize each separately.
- // $(".tooltip").tipsy( { gravity: 's' } );
- // }
if ( $.fn.tooltip ) {
// Put tooltips below items in panel header so that they do not overlap masthead.
$(".unified-panel-header [title]").tooltip( { placement: 'bottom' } );
diff -r 2d78abc47928918a14f56711657696724cd9af72 -r d966d09f77d9a3fed4401eb1e5e64d17a57d684e static/scripts/libs/jquery/jquery.tipsy.js
--- a/static/scripts/libs/jquery/jquery.tipsy.js
+++ /dev/null
@@ -1,172 +0,0 @@
-/* NOTE: MODIFIED FROM ORIGINAL! */
-
-(function($) {
- function fixTitle($ele) {
- if ($ele.attr('title') || typeof($ele.attr('original-title')) != 'string') {
- $ele.attr('original-title', $ele.attr('title') || '').removeAttr('title');
- }
- }
-
- $.fn.tipsy = function(options) {
-
- options = $.extend({}, $.fn.tipsy.defaults, options);
-
- return this.each(function() {
-
- fixTitle($(this));
- var opts = $.fn.tipsy.elementOptions(this, options);
- var timeout = null;
-
- $(this).hover(function() {
- var self = this;
- timeout = setTimeout(function() {
- $.data(self, 'cancel.tipsy', true);
-
- var tip = $.data(self, 'active.tipsy');
- if (!tip) {
- tip = $('<div class="tipsy"><div class="tipsy-inner"/></div>');
- tip.css({position: 'absolute', zIndex: 100000});
- $.data(self, 'active.tipsy', tip);
- }
-
- fixTitle($(self));
-
- var title;
- if (typeof opts.title == 'string') {
- title = $(self).attr(opts.title == 'title' ? 'original-title' : opts.title);
- } else if (typeof opts.title == 'function') {
- title = opts.title.call(self);
- }
-
- tip.find('.tipsy-inner')[opts.html ? 'html' : 'text'](title || opts.fallback);
-
-
- var pos = $.extend({}, $(self).offset(), {width: self.offsetWidth, height: self.offsetHeight});
- tip.get(0).className = 'tipsy'; // reset classname in case of dynamic gravity
- tip.remove().css({top: 0, left: 0, visibility: 'hidden', display: 'block'}).appendTo(document.body);
-
- tip.css( { width: tip.width() + 1, height: tip.height() } );
-
- var actualWidth = tip[0].offsetWidth, actualHeight = tip[0].offsetHeight;
- var gravity = (typeof opts.gravity == 'function') ? opts.gravity.call(self) : opts.gravity;
-
- var top, left;
- switch (gravity.charAt(0)) {
- case 'n':
- top = pos.top + pos.height;
- left = pos.left + pos.width / 2 - actualWidth / 2;
- tip.addClass('tipsy-north');
- break;
- case 's':
- top = pos.top - actualHeight;
- left = pos.left + pos.width / 2 - actualWidth / 2;
- tip.addClass('tipsy-south');
- break;
- case 'e':
- top = pos.top + pos.height / 2 - actualHeight / 2;
- left = pos.left - actualWidth;
- tip.addClass('tipsy-east');
- break;
- case 'w':
- top = pos.top + pos.height / 2 - actualHeight / 2;
- left = pos.left + pos.width;
- tip.addClass('tipsy-west');
- break;
- }
- // Shift if off screen
- var w = $(window);
-
- // If off the top of the screen, flip
- if ( top < w.scrollTop() && gravity.charAt( 0 ) == 's' ) {
- top = pos.top + pos.height;
- gravity = 'north';
- tip.removeClass('tipsy-south').addClass('tipsy-north');
- }
-
- // If off bottom, just shift for now
- top = Math.min( top, w.scrollTop() + w.height() - tip.outerHeight() );
-
-
- // Shift left or right
- var left_shift = 0;
- if ( left < w.scrollLeft() ) {
- left_shift = left - w.scrollLeft();
- }
- var t = w.scrollLeft() + w.width() - tip.outerWidth();
- if ( left > t ) {
- left_shift = left - t;
- }
-
- left -= left_shift;
-
- tip.css( { left: left, top: top } );
-
- // Shift background to center over element (not implemented for east/west)
- switch (gravity.charAt(0)) {
- case 'n':
- tip.css( 'background-position', - ( 250 - tip.outerWidth() / 2 ) + left_shift + "px top" );
- break;
- case 's':
- tip.css( 'background-position', - ( 250 - tip.outerWidth() / 2 ) + left_shift + "px bottom" );
- break;
- case 'e':
- break;
- case 'w':
- break;
- }
-
- if (opts.fade) {
- tip.stop().css({opacity: 0, display: 'block', visibility: 'visible'}).animate({opacity: opts.opacity});
- } else {
- tip.css({visibility: 'visible', opacity: opts.opacity});
- }
- }, opts.delayIn);
-
- }, function() {
- $.data(this, 'cancel.tipsy', false);
- var self = this;
- clearTimeout(timeout);
- setTimeout(function() {
- if ($.data(this, 'cancel.tipsy')) { return; }
- var tip = $.data(self, 'active.tipsy');
- if (opts.fade) {
- tip.stop().fadeOut(function() { $(this).remove(); });
- } else if (tip) {
- tip.remove();
- }
- }, opts.delayOut);
-
- });
-
- });
-
- };
-
- // Overwrite this method to provide options on a per-element basis.
- // For example, you could store the gravity in a 'tipsy-gravity' attribute:
- // return $.extend({}, options, {gravity: $(ele).attr('tipsy-gravity') || 'n' });
- // (remember - do not modify 'options' in place!)
- $.fn.tipsy.elementOptions = function(ele, options) {
- return $.metadata ? $.extend({}, options, $(ele).metadata()) : options;
- };
-
- $.fn.tipsy.defaults = {
- delayIn: 0,
- delayOut: 100,
- fade: false,
- fallback: '',
- gravity: 'n',
- html: false,
- opacity: 0.8,
- title: 'title'
- };
-
- $.fn.tipsy.autoNS = function() {
- return $(this).offset().top > ($(document).scrollTop() + $(window).height() / 2) ? 's' : 'n';
- };
-
- $.fn.tipsy.autoWE = function() {
- return $(this).offset().left > ($(document).scrollLeft() + $(window).width() / 2) ? 'e' : 'w';
- };
-
-})(jQuery);
diff -r 2d78abc47928918a14f56711657696724cd9af72 -r d966d09f77d9a3fed4401eb1e5e64d17a57d684e static/scripts/packed/libs/jquery/jquery.tipsy.js
--- a/static/scripts/packed/libs/jquery/jquery.tipsy.js
+++ /dev/null
@@ -1,1 +0,0 @@
-(function(b){function a(c){if(c.attr("title")||typeof(c.attr("original-title"))!="string"){c.attr("original-title",c.attr("title")||"").removeAttr("title")}}b.fn.tipsy=function(c){c=b.extend({},b.fn.tipsy.defaults,c);return this.each(function(){a(b(this));var d=b.fn.tipsy.elementOptions(this,c);var e=null;b(this).hover(function(){var f=this;e=setTimeout(function(){b.data(f,"cancel.tipsy",true);var o=b.data(f,"active.tipsy");if(!o){o=b('<div class="tipsy"><div class="tipsy-inner"/></div>');o.css({position:"absolute",zIndex:100000});b.data(f,"active.tipsy",o)}a(b(f));var m;if(typeof d.title=="string"){m=b(f).attr(d.title=="title"?"original-title":d.title)}else{if(typeof d.title=="function"){m=d.title.call(f)}}o.find(".tipsy-inner")[d.html?"html":"text"](m||d.fallback);var k=b.extend({},b(f).offset(),{width:f.offsetWidth,height:f.offsetHeight});o.get(0).className="tipsy";o.remove().css({top:0,left:0,visibility:"hidden",display:"block"}).appendTo(document.body);o.css({width:o.width()+1,height:o.height()});var h=o[0].offsetWidth,j=o[0].offsetHeight;var q=(typeof d.gravity=="function")?d.gravity.call(f):d.gravity;var l,i;switch(q.charAt(0)){case"n":l=k.top+k.height;i=k.left+k.width/2-h/2;o.addClass("tipsy-north");break;case"s":l=k.top-j;i=k.left+k.width/2-h/2;o.addClass("tipsy-south");break;case"e":l=k.top+k.height/2-j/2;i=k.left-h;o.addClass("tipsy-east");break;case"w":l=k.top+k.height/2-j/2;i=k.left+k.width;o.addClass("tipsy-west");break}var n=b(window);if(l<n.scrollTop()&&q.charAt(0)=="s"){l=k.top+k.height;q="north";o.removeClass("tipsy-south").addClass("tipsy-north")}l=Math.min(l,n.scrollTop()+n.height()-o.outerHeight());var g=0;if(i<n.scrollLeft()){g=i-n.scrollLeft()}var p=n.scrollLeft()+n.width()-o.outerWidth();if(i>p){g=i-p}i-=g;o.css({left:i,top:l});switch(q.charAt(0)){case"n":o.css("background-position",-(250-o.outerWidth()/2)+g+"px top");break;case"s":o.css("background-position",-(250-o.outerWidth()/2)+g+"px bottom");break;case"e":break;case"w":break}if(d.fade){o.stop().css({opacity:0,display:"block",visibility:"visible"}).animate({opacity:d.opacity})}else{o.css({visibility:"visible",opacity:d.opacity})}},d.delayIn)},function(){b.data(this,"cancel.tipsy",false);var f=this;clearTimeout(e);setTimeout(function(){if(b.data(this,"cancel.tipsy")){return}var g=b.data(f,"active.tipsy");if(d.fade){g.stop().fadeOut(function(){b(this).remove()})}else{if(g){g.remove()}}},d.delayOut)})})};b.fn.tipsy.elementOptions=function(d,c){return b.metadata?b.extend({},c,b(d).metadata()):c};b.fn.tipsy.defaults={delayIn:0,delayOut:100,fade:false,fallback:"",gravity:"n",html:false,opacity:0.8,title:"title"};b.fn.tipsy.autoNS=function(){return b(this).offset().top>(b(document).scrollTop()+b(window).height()/2)?"s":"n"};b.fn.tipsy.autoWE=function(){return b(this).offset().left>(b(document).scrollLeft()+b(window).width()/2)?"e":"w"}})(jQuery);
\ No newline at end of file
diff -r 2d78abc47928918a14f56711657696724cd9af72 -r d966d09f77d9a3fed4401eb1e5e64d17a57d684e static/scripts/viz/trackster/tracks.js
--- a/static/scripts/viz/trackster/tracks.js
+++ b/static/scripts/viz/trackster/tracks.js
@@ -292,7 +292,7 @@
title: "Remove",
css_class: "remove-icon",
on_click_fn: function(drawable) {
- // Tipsy for remove icon must be deleted when drawable is deleted.
+ // Tooltip for remove icon must be deleted when drawable is deleted.
$(".tooltip").remove();
drawable.remove();
}
@@ -642,7 +642,7 @@
title: "Filters",
css_class: "filters-icon",
on_click_fn: function(group) {
- // TODO: update tipsy text.
+ // TODO: update Tooltip text.
if (group.filters_manager.visible()) {
// Hiding filters.
group.filters_manager.clear_filters();
@@ -2409,7 +2409,7 @@
title: "Filters",
css_class: "filters-icon",
on_click_fn: function(drawable) {
- // TODO: update tipsy text.
+ // TODO: update Tooltip text.
if (drawable.filters_manager.visible()) {
drawable.filters_manager.clear_filters();
}
@@ -2425,7 +2425,7 @@
title: "Tool",
css_class: "hammer",
on_click_fn: function(track) {
- // TODO: update tipsy text.
+ // TODO: update Tooltip text.
track.tool.toggle();
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: martenson: honeypot trap for bot registering accounts
by commits-noreply@bitbucket.org 16 Oct '13
by commits-noreply@bitbucket.org 16 Oct '13
16 Oct '13
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/2d78abc47928/
Changeset: 2d78abc47928
User: martenson
Date: 2013-10-16 17:40:02
Summary: honeypot trap for bot registering accounts
Affected #: 2 files
diff -r d3d4210d0abee42c4c7cb8d66b8a325f340899c1 -r 2d78abc47928918a14f56711657696724cd9af72 lib/galaxy/webapps/galaxy/controllers/user.py
--- a/lib/galaxy/webapps/galaxy/controllers/user.py
+++ b/lib/galaxy/webapps/galaxy/controllers/user.py
@@ -594,6 +594,12 @@
@web.expose
def create( self, trans, cntrller='user', redirect_url='', refresh_frames=[], **kwd ):
params = util.Params( kwd )
+
+ # If the honeypot field is not empty we are dealing with a bot.
+ honeypot_field = params.get( 'bear_field', '' )
+ if honeypot_field != '':
+ return trans.show_error_message( "You are considered a bot. If you are not one please try registering again and follow the form's legend. <a target=\"_top\" href=\"%s\">Go to the home page</a>." ) % url_for( '/' )
+
message = util.restore_text( params.get( 'message', '' ) )
status = params.get( 'status', 'done' )
use_panels = util.string_as_bool( kwd.get( 'use_panels', True ) )
diff -r d3d4210d0abee42c4c7cb8d66b8a325f340899c1 -r 2d78abc47928918a14f56711657696724cd9af72 templates/user/register.mako
--- a/templates/user/register.mako
+++ b/templates/user/register.mako
@@ -162,7 +162,7 @@
%endif
<div id="for_bears">
If you see this, please leave following field blank.
- <input type="text" name="please leave this field blank" size="1" value=""/>
+ <input type="text" name="bear_field" size="1" value=""/></div><div class="form-row"><input type="submit" id="send" name="create_user_button" value="Submit"/>
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: guerler: Modify bowtie error handler
by commits-noreply@bitbucket.org 16 Oct '13
by commits-noreply@bitbucket.org 16 Oct '13
16 Oct '13
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/d3d4210d0abe/
Changeset: d3d4210d0abe
User: guerler
Date: 2013-10-16 17:03:51
Summary: Modify bowtie error handler
Affected #: 3 files
diff -r 940a310179c4ad9cfe7dabae2ac71402608a636a -r d3d4210d0abee42c4c7cb8d66b8a325f340899c1 static/style/blue/base.css
--- a/static/style/blue/base.css
+++ b/static/style/blue/base.css
@@ -1129,7 +1129,7 @@
.upload-box .table th{text-align:center;white-space:nowrap}
.upload-box .table td{margin:0px;paddign:0px}
.upload-box .title{width:130px;word-wrap:break-word;font-size:11px}
-.upload-box .text{position:absolute;display:none}.upload-box .text .text-content{font-size:11px;width:100%;height:50px;resize:none;background:inherit}
+.upload-box .text{position:absolute;display:none}.upload-box .text .text-content{font-size:11px;width:100%;height:50px;resize:none;background:inherit;color:#000}
.upload-box .text .text-info{font-size:11px;color:#999}
.upload-box .extension{width:100px;font-size:11px}
.upload-box .genome{width:150px;font-size:11px}
diff -r 940a310179c4ad9cfe7dabae2ac71402608a636a -r d3d4210d0abee42c4c7cb8d66b8a325f340899c1 static/style/src/less/upload.less
--- a/static/style/src/less/upload.less
+++ b/static/style/src/less/upload.less
@@ -45,10 +45,11 @@
.text-content {
font-size : @font-size-small;
- width : 100%;
- height : 50px;
- resize : none;
- background : inherit;
+ width: 100%;
+ height: 50px;
+ resize: none;
+ background: inherit;
+ color: @black;
}
.text-info {
diff -r 940a310179c4ad9cfe7dabae2ac71402608a636a -r d3d4210d0abee42c4c7cb8d66b8a325f340899c1 tools/sr_mapping/bowtie2_wrapper.xml
--- a/tools/sr_mapping/bowtie2_wrapper.xml
+++ b/tools/sr_mapping/bowtie2_wrapper.xml
@@ -109,7 +109,7 @@
<!-- basic error handling --><stdio>
- <regex match="Exception" source="stderr" level="fatal" description="Tool exception"/>
+ <exit_code range="1:" level="fatal" description="Tool exception" /></stdio><inputs>
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: guerler: Fix textarea background color in new upload front end
by commits-noreply@bitbucket.org 16 Oct '13
by commits-noreply@bitbucket.org 16 Oct '13
16 Oct '13
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/940a310179c4/
Changeset: 940a310179c4
User: guerler
Date: 2013-10-16 11:16:55
Summary: Fix textarea background color in new upload front end
Affected #: 2 files
diff -r f7760ffba1883eb14617890066778f38021f2d50 -r 940a310179c4ad9cfe7dabae2ac71402608a636a static/style/blue/base.css
--- a/static/style/blue/base.css
+++ b/static/style/blue/base.css
@@ -1129,7 +1129,7 @@
.upload-box .table th{text-align:center;white-space:nowrap}
.upload-box .table td{margin:0px;paddign:0px}
.upload-box .title{width:130px;word-wrap:break-word;font-size:11px}
-.upload-box .text{position:absolute;display:none}.upload-box .text .text-content{font-size:11px;width:100%;height:50px;resize:none}
+.upload-box .text{position:absolute;display:none}.upload-box .text .text-content{font-size:11px;width:100%;height:50px;resize:none;background:inherit}
.upload-box .text .text-info{font-size:11px;color:#999}
.upload-box .extension{width:100px;font-size:11px}
.upload-box .genome{width:150px;font-size:11px}
diff -r f7760ffba1883eb14617890066778f38021f2d50 -r 940a310179c4ad9cfe7dabae2ac71402608a636a static/style/src/less/upload.less
--- a/static/style/src/less/upload.less
+++ b/static/style/src/less/upload.less
@@ -48,6 +48,7 @@
width : 100%;
height : 50px;
resize : none;
+ background : inherit;
}
.text-info {
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
16 Oct '13
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/f7760ffba188/
Changeset: f7760ffba188
User: guerler
Date: 2013-10-16 10:53:59
Summary: Fix for Firefox
Affected #: 1 file
diff -r 41d3434f8506bb13380bd072e64194519e32a36e -r f7760ffba1883eb14617890066778f38021f2d50 static/scripts/galaxy.upload.js
--- a/static/scripts/galaxy.upload.js
+++ b/static/scripts/galaxy.upload.js
@@ -164,15 +164,17 @@
// get text component
var text = it.find('#text');
+ // get padding
+ var padding = 8;
+
// get dimensions
- var padding = parseInt($(text.parent()).css('padding'));
var width = it.width() - 2 * padding;
- var height = it.height();
-
+ var height = it.height() - padding;
+
// set dimensions
- text.width(width);
+ text.css('width', width + 'px');
text.css('top', height + 'px');
- it.height(height + text.height() + padding);
+ it.height(height + text.height() + 2 * padding);
// show text field
text.show();
@@ -471,7 +473,7 @@
'Close' : function() {self.modal.hide()},
},
height : '400',
- width : '850'
+ width : '900'
});
// set element
@@ -611,11 +613,13 @@
{
// construct template
var tmpl = '<tr id="' + id.substr(1) + '" class="upload-item">' +
- '<td style="position: relative;">' +
- '<div id="title" class="title"></div>' +
- '<div id="text" class="text">' +
- '<div class="text-info">You may specify a list of URLs (one per line) or paste the contents of a file.</div>' +
- '<textarea id="text-content" class="text-content form-control"></textarea>' +
+ '<td>' +
+ '<div style="position: relative;">' +
+ '<div id="title" class="title"></div>' +
+ '<div id="text" class="text">' +
+ '<div class="text-info">You may specify a list of URLs (one per line) or paste the contents of a file.</div>' +
+ '<textarea id="text-content" class="text-content form-control"></textarea>' +
+ '</div>' +
'</div>' +
'</td>' +
'<td><div id="size" class="size"></div></td>';
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: guerler: Show file size for manually created files
by commits-noreply@bitbucket.org 16 Oct '13
by commits-noreply@bitbucket.org 16 Oct '13
16 Oct '13
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/41d3434f8506/
Changeset: 41d3434f8506
User: guerler
Date: 2013-10-16 10:05:53
Summary: Show file size for manually created files
Affected #: 1 file
diff -r f170cf78702b3913a5e09ada1c75db2800ebc982 -r 41d3434f8506bb13380bd072e64194519e32a36e static/scripts/galaxy.upload.js
--- a/static/scripts/galaxy.upload.js
+++ b/static/scripts/galaxy.upload.js
@@ -144,6 +144,10 @@
// add functionality to remove button
var self = this;
it.find('#symbol').on('click', function() { self.event_remove (index) });
+ it.find('#text-content').on('keyup', function() {
+ var count = it.find('#text-content').val().length;
+ it.find('#size').html(self.size_to_string (count));
+ });
// initialize progress
this.event_progress(index, file, 0);
@@ -437,8 +441,8 @@
}
},
- // add (pseudo) file
- event_add : function ()
+ // create (pseudo) file
+ event_create : function ()
{
this.uploadbox.add([{ name : 'New File', size : -1 }]);
},
@@ -460,7 +464,7 @@
body : this.template('upload-box', 'upload-info'),
buttons : {
'Select' : function() {self.uploadbox.select()},
- 'Create' : function() {self.event_add()},
+ 'Create' : function() {self.event_create()},
'Upload' : function() {self.event_start()},
'Pause' : function() {self.event_stop()},
'Reset' : function() {self.event_reset()},
@@ -511,7 +515,8 @@
if (size >= 100000000) { size = size / 100000000; unit = 'GB'; } else
if (size >= 100000) { size = size / 100000; unit = 'MB'; } else
if (size >= 100) { size = size / 100; unit = 'KB'; } else
- if (size > 0) { size = size * 10; unit = 'b'; } else return '?';
+ if (size > 0) { size = size * 10; unit = 'b'; } else
+ return '<strong>-</strong>';
// return formatted string
return '<strong>' + (Math.round(size) / 10) + '</strong> ' + unit;
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: guerler: Add url, text input field to upload form
by commits-noreply@bitbucket.org 16 Oct '13
by commits-noreply@bitbucket.org 16 Oct '13
16 Oct '13
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/f170cf78702b/
Changeset: f170cf78702b
User: guerler
Date: 2013-10-16 09:36:17
Summary: Add url, text input field to upload form
Affected #: 4 files
diff -r ecd1fe4c471d2cf9ede923c43f27d4e380f961d1 -r f170cf78702b3913a5e09ada1c75db2800ebc982 static/scripts/galaxy.upload.js
--- a/static/scripts/galaxy.upload.js
+++ b/static/scripts/galaxy.upload.js
@@ -71,7 +71,7 @@
on_click : function(e) { self.event_show(e) },
on_unload : function() {
if (self.counter.running > 0)
- return "Currently uploads are running.";
+ return "Several uploads are still processing.";
},
with_number : true
});
@@ -129,9 +129,6 @@
// add upload item
$(this.el).find('tbody:last').append(this.template_row(id));
- // scroll to bottom
- //$(this.el).scrollTop($(this.el).prop('scrollHeight'));
-
// access upload item
var it = this.get_upload_item(index);
@@ -156,6 +153,26 @@
// update screen
this.update_screen();
+
+ // activate text field if file content is zero
+ if (file.size == -1)
+ {
+ // get text component
+ var text = it.find('#text');
+
+ // get dimensions
+ var padding = parseInt($(text.parent()).css('padding'));
+ var width = it.width() - 2 * padding;
+ var height = it.height();
+
+ // set dimensions
+ text.width(width);
+ text.css('top', height + 'px');
+ it.height(height + text.height() + padding);
+
+ // show text field
+ text.show();
+ }
},
// start
@@ -175,8 +192,13 @@
var current_history = Galaxy.currHistoryPanel.model.get('id');
var file_type = it.find('#extension').val();
var genome = it.find('#genome').val();
+ var url_paste = it.find('#text-content').val();
var space_to_tabs = it.find('#space_to_tabs').is(':checked');
+ // validate
+ if (!url_paste && !(file.size > 0))
+ return null;
+
// configure uploadbox
this.uploadbox.configure({url : galaxy_config.root + "api/tools/", paramname : "files_0|file_data"});
@@ -186,6 +208,7 @@
tool_input['file_type'] = file_type;
tool_input['files_0|NAME'] = file.name;
tool_input['files_0|type'] = 'upload_dataset';
+ tool_input['files_0|url_paste'] = url_paste;
tool_input['space_to_tabs'] = space_to_tabs;
// setup data
@@ -193,7 +216,7 @@
data['history_id'] = current_history;
data['tool_id'] = 'upload1';
data['inputs'] = JSON.stringify(tool_input);
-
+
// return additional data to be send with file
return data;
},
@@ -288,7 +311,7 @@
},
// start upload process
- event_upload : function()
+ event_start : function()
{
// check
if (this.counter.announce == 0 || this.counter.running > 0)
@@ -307,6 +330,7 @@
symbol.addClass(self.state.queued);
// disable options
+ $(this).find('#text-content').attr('disabled', true);
$(this).find('#genome').attr('disabled', true);
$(this).find('#extension').attr('disabled', true);
$(this).find('#space_to_tabs').attr('disabled', true);
@@ -318,21 +342,21 @@
this.update_screen();
// initiate upload procedure in plugin
- this.uploadbox.upload();
+ this.uploadbox.start();
},
// pause upload process
- event_pause : function()
+ event_stop : function()
{
// check
if (this.counter.running == 0)
return;
// request pause
- this.uploadbox.pause();
+ this.uploadbox.stop();
// set html content
- $('#upload-info').html('Queueing will pause after completing the current file...');
+ $('#upload-info').html('Queue will pause after completing the current file...');
},
// queue is done
@@ -355,6 +379,7 @@
symbol.addClass(self.state.init);
// disable options
+ $(this).find('#text-content').attr('disabled', false);
$(this).find('#genome').attr('disabled', false);
$(this).find('#extension').attr('disabled', false);
$(this).find('#space_to_tabs').attr('disabled', false);
@@ -412,6 +437,12 @@
}
},
+ // add (pseudo) file
+ event_add : function ()
+ {
+ this.uploadbox.add([{ name : 'New File', size : -1 }]);
+ },
+
// show/hide upload frame
event_show : function (e)
{
@@ -428,13 +459,14 @@
title : 'Upload files from your local drive',
body : this.template('upload-box', 'upload-info'),
buttons : {
- 'Select' : function() {self.uploadbox.select()},
- 'Upload' : function() {self.event_upload()},
- 'Pause' : function() {self.event_pause()},
- 'Reset' : function() {self.event_reset()},
- 'Close' : function() {self.modal.hide()}
+ 'Select' : function() {self.uploadbox.select()},
+ 'Create' : function() {self.event_add()},
+ 'Upload' : function() {self.event_start()},
+ 'Pause' : function() {self.event_stop()},
+ 'Reset' : function() {self.event_reset()},
+ 'Close' : function() {self.modal.hide()},
},
- height : '350',
+ height : '400',
width : '850'
});
@@ -475,13 +507,14 @@
{
// identify unit
var unit = "";
- if (size >= 100000000000) { size = size / 100000000000; unit = "TB"; } else
- if (size >= 100000000) { size = size / 100000000; unit = "GB"; } else
- if (size >= 100000) { size = size / 100000; unit = "MB"; } else
- if (size >= 100) { size = size / 100; unit = "KB"; } else
- { size = size * 10; unit = "b"; }
+ if (size >= 100000000000) { size = size / 100000000000; unit = 'TB'; } else
+ if (size >= 100000000) { size = size / 100000000; unit = 'GB'; } else
+ if (size >= 100000) { size = size / 100000; unit = 'MB'; } else
+ if (size >= 100) { size = size / 100; unit = 'KB'; } else
+ if (size > 0) { size = size * 10; unit = 'b'; } else return '?';
+
// return formatted string
- return "<strong>" + (Math.round(size) / 10) + "</strong> " + unit;
+ return '<strong>' + (Math.round(size) / 10) + '</strong> ' + unit;
},
// set screen
@@ -494,7 +527,7 @@
// check default message
if(this.counter.announce == 0)
{
- if (this.uploadbox.compatible)
+ if (this.uploadbox.compatible())
message = 'Drag&drop files into this box or click \'Select\' to select files!';
else
message = 'Unfortunately, your browser does not support multiple file uploads or drag&drop.<br>Please upgrade to i.e. Firefox 4+, Chrome 7+, IE 10+, Opera 12+ or Safari 6+.'
@@ -532,10 +565,14 @@
// select upload button
if (this.counter.running == 0)
+ {
this.modal.enableButton('Select');
- else
+ this.modal.enableButton('Create');
+ } else {
this.modal.disableButton('Select');
-
+ this.modal.disableButton('Create');
+ }
+
// table visibility
if (this.counter.announce + this.counter.success + this.counter.error > 0)
$(this.el).find('table').show();
@@ -569,7 +606,13 @@
{
// construct template
var tmpl = '<tr id="' + id.substr(1) + '" class="upload-item">' +
- '<td><div id="title" class="title"></div></td>' +
+ '<td style="position: relative;">' +
+ '<div id="title" class="title"></div>' +
+ '<div id="text" class="text">' +
+ '<div class="text-info">You may specify a list of URLs (one per line) or paste the contents of a file.</div>' +
+ '<textarea id="text-content" class="text-content form-control"></textarea>' +
+ '</div>' +
+ '</td>' +
'<td><div id="size" class="size"></div></td>';
// add file type selectore
diff -r ecd1fe4c471d2cf9ede923c43f27d4e380f961d1 -r f170cf78702b3913a5e09ada1c75db2800ebc982 static/scripts/utils/galaxy.uploadbox.js
--- a/static/scripts/utils/galaxy.uploadbox.js
+++ b/static/scripts/utils/galaxy.uploadbox.js
@@ -25,7 +25,8 @@
error_default : "Please make sure the file is available.",
error_server : "Upload request failed.",
error_toomany : "You can only queue <20 files per upload session.",
- error_login : "Uploads require you to log in."
+ error_login : "Uploads require you to log in.",
+ error_missing : "No upload content available."
}
// options
@@ -42,7 +43,7 @@
// indicates if queue is currently running
var queue_running = false;
- var queue_pause = false;
+ var queue_stop = false;
// element
var el = null;
@@ -159,21 +160,15 @@
// process an upload, recursive
function process()
{
- // log
- //console.log("Processing queue..." + queue_length + " (" + queue_running + " / " + queue_pause + ")");
-
// validate
- if (queue_length == 0 || queue_pause)
+ if (queue_length == 0 || queue_stop)
{
- queue_pause = false;
+ queue_stop = false;
queue_running = false;
opts.complete();
return;
} else
queue_running = true;
-
- // log
- //console.log("Looking for file...");
// get an identifier from the queue
var index = -1;
@@ -188,9 +183,6 @@
// remove from queue
remove(index)
-
- // log
- //console.log("Initializing ('" + file.name + "').");
// identify maximum file size
var filesize = file.size;
@@ -199,8 +191,14 @@
// check file size
if (filesize < maxfilesize)
{
- // send data
- send(index, file, opts.initialize(index, file))
+ // get parameters
+ var data = opts.initialize(index, file);
+
+ // validate
+ if (data)
+ send(index, file, data);
+ else
+ error(index, file, opts.error_missing);
} else {
// skip file
error(index, file, opts.error_filesize);
@@ -214,7 +212,10 @@
var formData = new FormData();
for (var key in data)
formData.append(key, data[key]);
- formData.append(opts.paramname, file, file.name);
+
+ // check file size
+ if (file.size > 0)
+ formData.append(opts.paramname, file, file.name);
// prepare request
xhr = new XMLHttpRequest();
@@ -226,9 +227,6 @@
// captures state changes
xhr.onreadystatechange = function()
{
- // status change
- //console.log("Status changed: " + xhr.readyState + ".");
-
// check for request completed, server connection closed
if (xhr.readyState != xhr.DONE)
return;
@@ -271,9 +269,6 @@
// send request
xhr.send(formData);
-
- // sending file
- //console.log("Sending file ('" + file.name + "').");
}
// success
@@ -314,7 +309,7 @@
}
// initiate upload process
- function upload()
+ function start()
{
if (!queue_running)
{
@@ -323,11 +318,11 @@
}
}
- // pause upload process
- function pause()
+ // stop upload process
+ function stop()
{
- // request pause
- queue_pause = true;
+ // request stop
+ queue_stop = true;
}
// set options
@@ -349,9 +344,10 @@
// export functions
return {
'select' : select,
+ 'add' : add,
'remove' : remove,
- 'upload' : upload,
- 'pause' : pause,
+ 'start' : start,
+ 'stop' : stop,
'reset' : reset,
'configure' : configure,
'compatible' : compatible
diff -r ecd1fe4c471d2cf9ede923c43f27d4e380f961d1 -r f170cf78702b3913a5e09ada1c75db2800ebc982 static/style/blue/base.css
--- a/static/style/blue/base.css
+++ b/static/style/blue/base.css
@@ -1129,6 +1129,8 @@
.upload-box .table th{text-align:center;white-space:nowrap}
.upload-box .table td{margin:0px;paddign:0px}
.upload-box .title{width:130px;word-wrap:break-word;font-size:11px}
+.upload-box .text{position:absolute;display:none}.upload-box .text .text-content{font-size:11px;width:100%;height:50px;resize:none}
+.upload-box .text .text-info{font-size:11px;color:#999}
.upload-box .extension{width:100px;font-size:11px}
.upload-box .genome{width:150px;font-size:11px}
.upload-box .size{width:60px;white-space:nowrap}
diff -r ecd1fe4c471d2cf9ede923c43f27d4e380f961d1 -r f170cf78702b3913a5e09ada1c75db2800ebc982 static/style/src/less/upload.less
--- a/static/style/src/less/upload.less
+++ b/static/style/src/less/upload.less
@@ -39,6 +39,23 @@
font-size : @font-size-small;
}
+ .text {
+ position: absolute;
+ display: none;
+
+ .text-content {
+ font-size : @font-size-small;
+ width : 100%;
+ height : 50px;
+ resize : none;
+ }
+
+ .text-info {
+ font-size : @font-size-small;
+ color : @gray-light;
+ }
+ }
+
.extension {
width: 100px;
font-size : @font-size-small;
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: guerler: Sort genomes in genome selector
by commits-noreply@bitbucket.org 16 Oct '13
by commits-noreply@bitbucket.org 16 Oct '13
16 Oct '13
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/ecd1fe4c471d/
Changeset: ecd1fe4c471d
User: guerler
Date: 2013-10-16 05:40:46
Summary: Sort genomes in genome selector
Affected #: 1 file
diff -r 443c97b1017eae9374ab91c0d87a19252db8a0e0 -r ecd1fe4c471d2cf9ede923c43f27d4e380f961d1 static/scripts/galaxy.upload.js
--- a/static/scripts/galaxy.upload.js
+++ b/static/scripts/galaxy.upload.js
@@ -3,7 +3,7 @@
*/
// dependencies
-define(["galaxy.modal", "galaxy.master", "utils/galaxy.utils", "utils/galaxy.uploadbox", "libs/backbone/backbone-relational"], function(mod_modal, mod_master, mod_util) {
+define(["galaxy.modal", "galaxy.master", "utils/galaxy.utils", "utils/galaxy.uploadbox", "libs/backbone/backbone-relational"], function(mod_modal, mod_master, mod_utils) {
// galaxy upload
var GalaxyUpload = Backbone.View.extend(
@@ -18,14 +18,10 @@
uploadbox: null,
// extension types
- select_extension : {
- 'auto' : 'Auto-detect'
- },
+ select_extension :[['Auto-detect', 'auto']],
// genomes
- select_genome : {
- '?' : 'Unspecified'
- },
+ select_genome : [['Unspecified (?)', '?']],
// states
state : {
@@ -85,17 +81,32 @@
// load extension
var self = this;
- mod_util.jsonFromUrl(galaxy_config.root + "api/datatypes",
+ mod_utils.jsonFromUrl(galaxy_config.root + "api/datatypes",
function(datatypes) {
for (key in datatypes)
- self.select_extension[datatypes[key]] = datatypes[key];
+ self.select_extension.push([datatypes[key], datatypes[key]]);
});
// load genomes
- mod_util.jsonFromUrl(galaxy_config.root + "api/genomes",
+ mod_utils.jsonFromUrl(galaxy_config.root + "api/genomes",
function(genomes) {
+ // backup default
+ var def = self.select_genome[0];
+
+ // fill array
+ self.select_genome = [];
for (key in genomes)
- self.select_genome[genomes[key][1]] = genomes[key][0];
+ if (genomes[key].length > 1)
+ if (genomes[key][1] !== def[1])
+ self.select_genome.push(genomes[key]);
+
+ // sort
+ self.select_genome.sort(function(a, b) {
+ return a[0] > b[0] ? 1 : a[0] < b[0] ? -1 : 0;
+ });
+
+ // insert default back to array
+ self.select_genome.unshift(def);
});
},
@@ -565,7 +576,7 @@
tmpl += '<td>' +
'<select id="extension" class="extension">';
for (key in this.select_extension)
- tmpl += '<option value="' + key + '">' + this.select_extension[key] + '</option>';
+ tmpl += '<option value="' + this.select_extension[key][1] + '">' + this.select_extension[key][0] + '</option>';
tmpl += '</select>' +
'</td>';
@@ -573,7 +584,7 @@
tmpl += '<td>' +
'<select id="genome" class="genome">';
for (key in this.select_genome)
- tmpl += '<option value="' + key + '">' + this.select_genome[key] + '</option>';
+ tmpl += '<option value="' + this.select_genome[key][1] + '">' + this.select_genome[key][0] + '</option>';
tmpl += '</select>' +
'</td>';
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0