Tool.xml : correct way to define an environment_variable ?

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

Tool.xml : correct way to define an environment_variable ?

Pierre Lindenbaum
(cross-posted at https://biostar.usegalaxy.org/p/20220/ )


I'm trying to create some `tools.xml` that use java.

Those tools need to download some library (*.jar) files from
http://central.maven.org/ and I want to create a variable
$MYTOOLCLASSPATH containing the jars. I've tried the following xml :

         <?xml version="1.0" encoding="UTF-8"?>
         <tool_dependency>
           <package name="mytool" version="0.0.1">
             <install version="1.0">
               <actions>
                 <action type="shell_command">wget -P
"$REPOSITORY_INSTALL_DIR" "http://central.maven.org/lib1.jar"
"http://central.maven.org/lib2.jar"</action>
                 <action type="set_environment">
                     <environment_variable name="MYTOOLCLASSPATH"
action="set_to">$REPOSITORY_INSTALL_DIR/lib1.jar:$REPOSITORY_INSTALL_DIR/lib2.jar</environment_variable>

                 </action>
               </actions>
             </install>
           </package>
         </tool_dependency>

the base java command is defined as a token in macro.xml:

               (...)
               <token name="@MYJAVA@">
         java   -cp "\${MYTOOLCLASSPATH}"
               </token>
               (...)

and called in my tool.xml:

             <command>@MYJAVA@ tool.Tool ${input} &gt; ${out} </command>

but It seems that $MYTOOLCLASSPATH  is empty.

I've also tried to create a set_environment under <tool_dependency>:

     <set_environment version="1.0">
        <environment_variable name="MYTOOLCLASSPATH"
action="set_to">$REPOSITORY_INSTALL_DIR/lib1.jar:$REPOSITORY_INSTALL_DIR/lib2.jar</environment_variable>
     </set_environment>


same problem: the $MYTOOLCLASSPATH remains empty

Where Am i wrong ? What's the correct way to define MYTOOLCLASSPATH ?



Thanks,

Pierre


___________________________________________________________
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:
  https://lists.galaxyproject.org/

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

Re: Tool.xml : correct way to define an environment_variable ?

Peter Cock
Hi Pierre,

The first example looks OK, very similar to this one of mine for example,
so I am not sure what is breaking:

https://github.com/peterjc/pico_galaxy/blob/133aea82c02adf5509134c415565ada99c519312/tools/effectiveT3/tool_dependencies.xml

I would try adding more shell actions to debug this with echo statements?

However, rather than using wget you could use the download_file
action which can verify the checksum, and will also work on a Mac
where wget is usually missing.

Peter

On Thu, Oct 20, 2016 at 8:03 AM, Pierre Lindenbaum
<[hidden email]> wrote:

> (cross-posted at https://biostar.usegalaxy.org/p/20220/ )
>
>
> I'm trying to create some `tools.xml` that use java.
>
> Those tools need to download some library (*.jar) files from
> http://central.maven.org/ and I want to create a variable $MYTOOLCLASSPATH
> containing the jars. I've tried the following xml :
>
>         <?xml version="1.0" encoding="UTF-8"?>
>         <tool_dependency>
>           <package name="mytool" version="0.0.1">
>             <install version="1.0">
>               <actions>
>                 <action type="shell_command">wget -P
> "$REPOSITORY_INSTALL_DIR" "http://central.maven.org/lib1.jar"
> "http://central.maven.org/lib2.jar"</action>
>                 <action type="set_environment">
>                     <environment_variable name="MYTOOLCLASSPATH"
> action="set_to">$REPOSITORY_INSTALL_DIR/lib1.jar:$REPOSITORY_INSTALL_DIR/lib2.jar</environment_variable>
>                 </action>
>               </actions>
>             </install>
>           </package>
>         </tool_dependency>
>
> the base java command is defined as a token in macro.xml:
>
>               (...)
>               <token name="@MYJAVA@">
>         java   -cp "\${MYTOOLCLASSPATH}"
>               </token>
>               (...)
>
> and called in my tool.xml:
>
>             <command>@MYJAVA@ tool.Tool ${input} &gt; ${out} </command>
>
> but It seems that $MYTOOLCLASSPATH  is empty.
>
> I've also tried to create a set_environment under <tool_dependency>:
>
>     <set_environment version="1.0">
>        <environment_variable name="MYTOOLCLASSPATH"
> action="set_to">$REPOSITORY_INSTALL_DIR/lib1.jar:$REPOSITORY_INSTALL_DIR/lib2.jar</environment_variable>
>     </set_environment>
>
>
> same problem: the $MYTOOLCLASSPATH remains empty
>
> Where Am i wrong ? What's the correct way to define MYTOOLCLASSPATH ?
>
>
>
> Thanks,
>
> Pierre
>
>
> ___________________________________________________________
> 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:
>  https://lists.galaxyproject.org/
>
> 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:
  https://lists.galaxyproject.org/

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

Re: Tool.xml : correct way to define an environment_variable ?

Pierre Lindenbaum
On 10/20/2016 11:06 AM, Peter Cock wrote:
> Hi Pierre,
>
> The first example looks OK, very similar to this one of mine for example,
> so I am not sure what is breaking:
>
> https://github.com/peterjc/pico_galaxy/blob/133aea82c02adf5509134c415565ada99c519312/tools/effectiveT3/tool_dependencies.xml
>
> I would try adding more shell actions to debug this with echo statements?
Hi Peter,
Thanks , your xml is inspiring, I'll have a look at this.
Best,

Pierre
___________________________________________________________
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:
  https://lists.galaxyproject.org/

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

Re: Tool.xml : correct way to define an environment_variable ?

Pierre Lindenbaum
In reply to this post by Peter Cock
Thanks Peter,
it works, now
I've moved my xml to the way you've suggested **and** I had to change
the name of my environment_variable. I don't know why but I suspect
there is a 'ghost/persistent' (?) version of my variable that still
exists(!?)  somewhere from a previous attempt.

Thank you again.

P.
___________________________________________________________
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:
  https://lists.galaxyproject.org/

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