commit/galaxy-central: kanwei: Add tool version-string support to tool wrappers. Use the <version_string> tag to denote the command to run for the tool version, such as: tophat --version (see tophat wrapper change for example)
1 new changeset in galaxy-central: http://bitbucket.org/galaxy/galaxy-central/changeset/84b20f29dfdf/ changeset: 84b20f29dfdf user: kanwei date: 2011-07-07 04:37:51 summary: Add tool version-string support to tool wrappers. Use the <version_string> tag to denote the command to run for the tool version, such as: tophat --version (see tophat wrapper change for example) The tool version string will currently be appended to the Info string in the history dataset and you will be able to see it in the history pane, although this might be added to the database as well in the future. affected #: 4 files (1.1 KB) --- a/lib/galaxy/jobs/__init__.py Thu Jul 07 10:04:20 2011 +1000 +++ b/lib/galaxy/jobs/__init__.py Wed Jul 06 22:37:51 2011 -0400 @@ -271,7 +271,7 @@ class JobWrapper( object ): """ - Wraps a 'model.Job' with convience methods for running processes and + Wraps a 'model.Job' with convenience methods for running processes and state management. """ def __init__( self, job, queue ): @@ -284,6 +284,9 @@ self.sa_session = self.app.model.context self.extra_filenames = [] self.command_line = None + # Tool versioning variables + self.version_string_cmd = None + self.version_string = "" self.galaxy_lib_dir = None # With job outputs in the working directory, we need the working # directory to be set before prepare is run, or else premature deletion @@ -311,6 +314,9 @@ param_dict = self.tool.params_from_strings( param_dict, self.app ) return param_dict + def get_version_string_path( self ): + return os.path.abspath(os.path.join(self.app.config.new_file_path, "GALAXY_VERSION_STRING_%s" % self.job_id)) + def prepare( self ): """ Prepare the job to run by creating the working directory and the @@ -389,6 +395,7 @@ extra_filenames.append( param_filename ) self.param_dict = param_dict self.extra_filenames = extra_filenames + self.version_string_cmd = self.tool.version_string_cmd return extra_filenames def fail( self, message, exception=False ): @@ -491,6 +498,12 @@ job.state = job.states.ERROR else: job.state = job.states.OK + if self.version_string_cmd: + version_filename = self.get_version_string_path() + if os.path.exists(version_filename): + self.version_string = "Tool version: %s" % open(version_filename).read() + os.unlink(version_filename) + if self.app.config.outputs_to_working_directory: for dataset_path in self.get_output_fnames(): try: @@ -541,7 +554,7 @@ dataset.blurb = 'done' dataset.peek = 'no peek' - dataset.info = context['stdout'] + context['stderr'] + dataset.info = context['stdout'] + context['stderr'] + self.version_string dataset.set_size() if context['stderr']: dataset.blurb = "error" --- a/lib/galaxy/jobs/runners/__init__.py Thu Jul 07 10:04:20 2011 +1000 +++ b/lib/galaxy/jobs/runners/__init__.py Wed Jul 06 22:37:51 2011 -0400 @@ -1,10 +1,9 @@ import os, os.path class BaseJobRunner( object ): - def build_command_line( self, job_wrapper, include_metadata=False ): """ - Compose the sequence of commands neccesary to execute a job. This will + Compose the sequence of commands necessary to execute a job. This will currently include: - environment settings corresponding to any requirement tags - command line taken from job wrapper @@ -15,9 +14,13 @@ # 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 dependency injection if job_wrapper.dependency_shell_commands: commands = "; ".join( job_wrapper.dependency_shell_commands + [ commands ] ) + # 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 self.app.config.set_metadata_externally: --- a/lib/galaxy/tools/__init__.py Thu Jul 07 10:04:20 2011 +1000 +++ b/lib/galaxy/tools/__init__.py Wed Jul 06 22:37:51 2011 -0400 @@ -5,7 +5,7 @@ pkg_resources.require( "simplejson" ) -import logging, os, string, sys, tempfile, glob, shutil, types, urllib +import logging, os, string, sys, tempfile, glob, shutil, types, urllib, subprocess import simplejson import binascii from UserDict import DictMixin @@ -395,6 +395,10 @@ self.redirect_url_params = '' # Short description of the tool self.description = util.xml_text(root, "description") + # Versioning for tools + self.version_string_cmd = None + if root.find("version_string") is not None: + self.version_string_cmd = root.find("version_string").text # Parallelism for tasks, read from tool config. parallelism = root.find("parallelism") if parallelism is not None and parallelism.get("method"): --- a/tools/ngs_rna/tophat_wrapper.xml Thu Jul 07 10:04:20 2011 +1000 +++ b/tools/ngs_rna/tophat_wrapper.xml Wed Jul 06 22:37:51 2011 -0400 @@ -1,5 +1,6 @@ <tool id="tophat" name="Tophat for Illumina" version="1.5.0"><description>Find splice junctions using RNA-seq data</description> + <version_string>tophat --version</version_string><requirements><requirement type="package">tophat</requirement></requirements> 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.
participants (1)
-
Bitbucket