commit/galaxy-central: jmchilton: Expose $__tool_directory__ to tools.
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/ddbe0d12bc86/ Changeset: ddbe0d12bc86 User: jmchilton Date: 2015-02-03 15:29:34+00:00 Summary: Expose $__tool_directory__ to tools. Repeatedly one wants to do things like create symbolic links and then call a helper script - the 'interpreter' tag doesn't allow shell commands before calling a helper script so they could not be used in this fashion. The previous pattern for doing this was then to use the ToolShed only 'set_environment' requirement tag. These were onerous to setup and the resulting tools were no longer portable to non-ToolShed installed contexts - I believe this variant is more robust and elegant. More information https://trello.com/c/0pgF5PBQ and here https://trello.com/c/XK5SqE1i. Affected #: 5 files diff -r eb26a96483238cd353c3fc1bdce9699382dfadb6 -r ddbe0d12bc86da406bb96213e23b8ddb273ed669 lib/galaxy/jobs/__init__.py --- a/lib/galaxy/jobs/__init__.py +++ b/lib/galaxy/jobs/__init__.py @@ -1783,7 +1783,11 @@ @abstractmethod def new_file_path( self ): - """ Location to dump new files for this job on remote server. """ + """ Absolute path to dump new files for this job on compute server. """ + + @abstractmethod + def tool_directory( self ): + """ Absolute path to tool files for this job on compute server. """ @abstractmethod def version_path( self ): @@ -1836,6 +1840,9 @@ def version_path( self ): return self.job_wrapper.get_version_string_path() + def tool_directory( self ): + return os.path.abspath(self.job_wrapper.tool.tool_dir) + class NoopQueue( object ): """ diff -r eb26a96483238cd353c3fc1bdce9699382dfadb6 -r ddbe0d12bc86da406bb96213e23b8ddb273ed669 lib/galaxy/jobs/runners/pulsar.py --- a/lib/galaxy/jobs/runners/pulsar.py +++ b/lib/galaxy/jobs/runners/pulsar.py @@ -708,3 +708,6 @@ def unstructured_path_rewriter( self ): return self.rewriter + + def tool_directory( self ): + return self._tool_dir diff -r eb26a96483238cd353c3fc1bdce9699382dfadb6 -r ddbe0d12bc86da406bb96213e23b8ddb273ed669 lib/galaxy/tools/evaluation.py --- a/lib/galaxy/tools/evaluation.py +++ b/lib/galaxy/tools/evaluation.py @@ -345,6 +345,7 @@ if table_name in self.app.tool_data_tables: return self.app.tool_data_tables[ table_name ].get_entry( query_attr, query_val, return_attr ) + param_dict['__tool_directory__'] = self.compute_environment.tool_directory() param_dict['__get_data_table_entry__'] = get_data_table_entry # We add access to app here, this allows access to app.config, etc diff -r eb26a96483238cd353c3fc1bdce9699382dfadb6 -r ddbe0d12bc86da406bb96213e23b8ddb273ed669 test/functional/tools/samples_tool_conf.xml --- a/test/functional/tools/samples_tool_conf.xml +++ b/test/functional/tools/samples_tool_conf.xml @@ -32,6 +32,7 @@ <tool file="validation_repeat.xml" /><tool file="identifier_single.xml" /><tool file="identifier_multiple.xml" /> + <tool file="tool_directory.xml" /><tool file="collection_paired_test.xml" /><tool file="collection_nested_test.xml" /><tool file="collection_mixed_param.xml" /> diff -r eb26a96483238cd353c3fc1bdce9699382dfadb6 -r ddbe0d12bc86da406bb96213e23b8ddb273ed669 test/functional/tools/tool_directory.xml --- /dev/null +++ b/test/functional/tools/tool_directory.xml @@ -0,0 +1,20 @@ +<tool id="tool_directory" name="tool_directory"> + <command> + cp $__tool_directory__/tool_directory.xml output1 + </command> + <inputs> + <param type="integer" name="ignored" label="Ignored" value="0" /> + </inputs> + <outputs> + <data name="output1" type="xml" from_work_dir="output1" /> + </outputs> + <tests> + <test> + <output name="output1"> + <assert_contents> + <has_text text="QUINE" /> + </assert_contents> + </output> + </test> + </tests> +</tool> 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)
-
commits-noreply@bitbucket.org