interpreter option for version_command tag

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

interpreter option for version_command tag

Will Holtz
The documentation for the version_command tag doesn't mention it can take an interpreter option:
https://wiki.galaxyproject.org/Admin/Tools/ToolConfigSyntax#A.3Cversion_command.3E_tag_set

I looked at the code in lib/galaxy/tools/__init__.py to see how this was implemented. I was surprised to see that if the interpreter option is passed to version_command, then the interpreter value from the command tag is used in generating the version number response. The version_command interpreter value is never used. For example, I tried the following:

<version_command interpreter="foobar">myPythonTool -v</version_command>

<command interpreter="python">myPythonTool someCheetahCode</command>

And Galaxy successfully got the version number. Is this the expected behavior?

-Will


___________________________________________________________
Please keep all replies on the list by using "reply all"
in your mail client.  To manage your subscriptions to this
and other Galaxy lists, please use the interface at:
  http://lists.bx.psu.edu/

To search Galaxy mailing lists use the unified search at:
  http://galaxyproject.org/search/mailinglists/
Reply | Threaded
Open this post in threaded view
|

Re: interpreter option for version_command tag

Peter Cock
Hi Will,

It looks like a bug to me.

This was originally added back in 2012,
https://bitbucket.org/galaxy/galaxy-central/commits/02fe49c3d251

I submitted a fix for whitespace in 2013,
https://bitbucket.org/galaxy/galaxy-central/commits/da5a5077ef1ebffa9e0ad9039ca4463298815de1

Looking at the current code, yes, there does appear to be a logical flaw here:

        # Versioning for tools
        self.version_string_cmd = None
        version_cmd = root.find("version_command")
        if version_cmd is not None:
            self.version_string_cmd = version_cmd.text.strip()
            version_cmd_interpreter = version_cmd.get( "interpreter", None )
            if version_cmd_interpreter:
                executable = self.version_string_cmd.split()[0]
                abs_executable =
os.path.abspath(os.path.join(self.tool_dir, executable))
                command_line =
self.version_string_cmd.replace(executable, abs_executable, 1)
                self.version_string_cmd = self.interpreter + " " + command_line

i.e. self.interpreter is used, rather than version_cmd_interpreter

Possible fix:

$ hg diff lib/galaxy/tools/__init__.py
diff -r 75be6c49a65d lib/galaxy/tools/__init__.py
--- a/lib/galaxy/tools/__init__.py    Wed May 14 22:49:44 2014 -0400
+++ b/lib/galaxy/tools/__init__.py    Thu Jun 19 17:19:18 2014 +0100
@@ -1234,7 +1234,7 @@
                 executable = self.version_string_cmd.split()[0]
                 abs_executable =
os.path.abspath(os.path.join(self.tool_dir, executable))
                 command_line =
self.version_string_cmd.replace(executable, abs_executable, 1)
-                self.version_string_cmd = self.interpreter + " " + command_line
+                self.version_string_cmd = version_cmd_interpreter + "
" + command_line
         # Parallelism for tasks, read from tool config.
         parallelism = root.find("parallelism")
         if parallelism is not None and parallelism.get("method"):


Regards,

Peter




On Thu, Jun 19, 2014 at 4:21 PM, Will Holtz <[hidden email]> wrote:

> The documentation for the version_command tag doesn't mention it can take an
> interpreter option:
> https://wiki.galaxyproject.org/Admin/Tools/ToolConfigSyntax#A.3Cversion_command.3E_tag_set
>
> I looked at the code in lib/galaxy/tools/__init__.py to see how this was
> implemented. I was surprised to see that if the interpreter option is passed
> to version_command, then the interpreter value from the command tag is used
> in generating the version number response. The version_command interpreter
> value is never used. For example, I tried the following:
>
> <version_command interpreter="foobar">myPythonTool -v</version_command>
>
> <command interpreter="python">myPythonTool someCheetahCode</command>
>
> And Galaxy successfully got the version number. Is this the expected
> behavior?
>
> -Will
>
>
> ___________________________________________________________
> Please keep all replies on the list by using "reply all"
> in your mail client.  To manage your subscriptions to this
> and other Galaxy lists, please use the interface at:
>   http://lists.bx.psu.edu/
>
> To search Galaxy mailing lists use the unified search at:
>   http://galaxyproject.org/search/mailinglists/
___________________________________________________________
Please keep all replies on the list by using "reply all"
in your mail client.  To manage your subscriptions to this
and other Galaxy lists, please use the interface at:
  http://lists.bx.psu.edu/

To search Galaxy mailing lists use the unified search at:
  http://galaxyproject.org/search/mailinglists/
Reply | Threaded
Open this post in threaded view
|

Re: interpreter option for version_command tag

John Chilton-4
Pushed this patch to -central. Thanks guys!

https://bitbucket.org/galaxy/galaxy-central/commits/e832e466471403d54d788193c938f3c4d139142c

-John

On Thu, Jun 19, 2014 at 11:19 AM, Peter Cock <[hidden email]> wrote:

> Hi Will,
>
> It looks like a bug to me.
>
> This was originally added back in 2012,
> https://bitbucket.org/galaxy/galaxy-central/commits/02fe49c3d251
>
> I submitted a fix for whitespace in 2013,
> https://bitbucket.org/galaxy/galaxy-central/commits/da5a5077ef1ebffa9e0ad9039ca4463298815de1
>
> Looking at the current code, yes, there does appear to be a logical flaw here:
>
>         # Versioning for tools
>         self.version_string_cmd = None
>         version_cmd = root.find("version_command")
>         if version_cmd is not None:
>             self.version_string_cmd = version_cmd.text.strip()
>             version_cmd_interpreter = version_cmd.get( "interpreter", None )
>             if version_cmd_interpreter:
>                 executable = self.version_string_cmd.split()[0]
>                 abs_executable =
> os.path.abspath(os.path.join(self.tool_dir, executable))
>                 command_line =
> self.version_string_cmd.replace(executable, abs_executable, 1)
>                 self.version_string_cmd = self.interpreter + " " + command_line
>
> i.e. self.interpreter is used, rather than version_cmd_interpreter
>
> Possible fix:
>
> $ hg diff lib/galaxy/tools/__init__.py
> diff -r 75be6c49a65d lib/galaxy/tools/__init__.py
> --- a/lib/galaxy/tools/__init__.py    Wed May 14 22:49:44 2014 -0400
> +++ b/lib/galaxy/tools/__init__.py    Thu Jun 19 17:19:18 2014 +0100
> @@ -1234,7 +1234,7 @@
>                  executable = self.version_string_cmd.split()[0]
>                  abs_executable =
> os.path.abspath(os.path.join(self.tool_dir, executable))
>                  command_line =
> self.version_string_cmd.replace(executable, abs_executable, 1)
> -                self.version_string_cmd = self.interpreter + " " + command_line
> +                self.version_string_cmd = version_cmd_interpreter + "
> " + command_line
>          # Parallelism for tasks, read from tool config.
>          parallelism = root.find("parallelism")
>          if parallelism is not None and parallelism.get("method"):
>
>
> Regards,
>
> Peter
>
>
>
>
> On Thu, Jun 19, 2014 at 4:21 PM, Will Holtz <[hidden email]> wrote:
>> The documentation for the version_command tag doesn't mention it can take an
>> interpreter option:
>> https://wiki.galaxyproject.org/Admin/Tools/ToolConfigSyntax#A.3Cversion_command.3E_tag_set
>>
>> I looked at the code in lib/galaxy/tools/__init__.py to see how this was
>> implemented. I was surprised to see that if the interpreter option is passed
>> to version_command, then the interpreter value from the command tag is used
>> in generating the version number response. The version_command interpreter
>> value is never used. For example, I tried the following:
>>
>> <version_command interpreter="foobar">myPythonTool -v</version_command>
>>
>> <command interpreter="python">myPythonTool someCheetahCode</command>
>>
>> And Galaxy successfully got the version number. Is this the expected
>> behavior?
>>
>> -Will
>>
>>
>> ___________________________________________________________
>> Please keep all replies on the list by using "reply all"
>> in your mail client.  To manage your subscriptions to this
>> and other Galaxy lists, please use the interface at:
>>   http://lists.bx.psu.edu/
>>
>> To search Galaxy mailing lists use the unified search at:
>>   http://galaxyproject.org/search/mailinglists/
> ___________________________________________________________
> Please keep all replies on the list by using "reply all"
> in your mail client.  To manage your subscriptions to this
> and other Galaxy lists, please use the interface at:
>   http://lists.bx.psu.edu/
>
> To search Galaxy mailing lists use the unified search at:
>   http://galaxyproject.org/search/mailinglists/
___________________________________________________________
Please keep all replies on the list by using "reply all"
in your mail client.  To manage your subscriptions to this
and other Galaxy lists, please use the interface at:
  http://lists.bx.psu.edu/

To search Galaxy mailing lists use the unified search at:
  http://galaxyproject.org/search/mailinglists/