Yes, as $TAVERNA_RUN_ID Here's the output from running env on my server:
INTERACTION_WEBDAV=/rest/runs/1addd0f3-8ad9-4d82-8ffa-350b809374fd/wd/interactions INTERACTION_PORT=32768 HOSTNAME=e4e7a0a0908c HOME=/root RAVEN_APPHOME=/tmp/1addd0f3-8ad9-4d82-8ffa-350b809374fd WAR_MD5=20d27405b27a3418b783777171734514 CATALINA_HOME=/usr/local/tomcat TOMCAT_MAJOR=7 JAVA_VERSION=7u79 JAVA_DEBIAN_VERSION=7u79-2.5.5-1~deb8u1 PATH=/usr/lib/jvm/java-7-openjdk-amd64/jre/bin:/usr/local/tomcat/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin TOMCAT_TGZ_URL=https://www.apache.org/dist/tomcat/tomcat-7/v7.0.63/bin/apache-tomcat-7.0.63.tar.gz TAVERNA_VERSION=2.5.4 LANG=C.UTF-8 TOMCAT_VERSION=7.0.63 INTERACTION_FEED=/rest/runs/1addd0f3-8ad9-4d82-8ffa-350b809374fd/interaction TAVERNA_RUN_ID=1addd0f3-8ad9-4d82-8ffa-350b809374fd PWD=/tmp/usecase4814808815707856724dir INTERACTION_HOST=http://localhost As mentioned earlier, from within the workflow you can use the taverna.runid system property, fetched with Get_environment and XPath /property-list/property[@name="taverna.runid"]/@value On 20 April 2016 at 13:49, Simone Bnà <[email protected]> wrote: > Dear Stian, > > sorry to bother you again, > > is it possible to do the same thing as Alan proposed for the Beanshell > (extract the uuid from env) in a externaltool? > > Best regards, > > Simone. > > > ----- Messaggio originale ----- > Da: "Simone Bnà" <[email protected]> > A: "Stian Soiland-Reyes" <[email protected]> > Cc: [email protected] > Inviato: Lunedì, 18 aprile 2016 10:39:56 > Oggetto: Re: add a plugin to a taverna server > > Dear Stian, > >> while I guess you want to >> match the UUIDs used in the REST interface of the Taverna Server. > > Yes. > > Best regards, > > Simone. > > > ----- Messaggio originale ----- > Da: "Stian Soiland-Reyes" <[email protected]> > A: "Simone Bnà" <[email protected]> > Cc: [email protected] > Inviato: Sabato, 16 aprile 2016 14:21:01 > Oggetto: Re: add a plugin to a taverna server > > Ah.. but then I'm not sure if my UUIDs will help you, as those > identify the command line engine's run ID - while I guess you want to > match the UUIDs used in the REST interface of the Taverna Server. > > I am not sure if the Taverna Server can be told to inject the external > run UUID into the workflow.. Donal? > > On 15 April 2016 at 13:29, Simone Bnà <[email protected]> wrote: >> Dear Stian, >> >> thanks a lot for your reply. >> >>> Q: Why? Are you recording provenance? >> >> The idea is to send notifications to a server of what happens during the >> execution of a bash script called inside an External Tool (or Beanshell). >> >> So what I need is in some way to get the uuid of the workflow run created by >> taverna server at runtime. >> >> I tried to get it from the PWD command but for each activity I got the >> /tmp/usecase**** folder and not /tmp/<uuid> >> and I did not find any relations between the two. >> >> I am not constrained to find it from Beanshell, if there was another smarter >> and simpler way it should be better :) >> >> Best regards, >> >> Simone. >> >> >> ----- Messaggio originale ----- >> Da: "Stian Soiland-Reyes" <[email protected]> >> A: [email protected], "Simone Bnà" <[email protected]> >> Inviato: Venerdì, 8 aprile 2016 18:32:59 >> Oggetto: Re: add a plugin to a taverna server >> >> Hi, I assume you have signed up to dev@taverna where I have CC-ed your >> reply and any following discussion. >> >> http://taverna.incubator.apache.org/contact#devtaverna >> >> >>> 1) How can I get the uuid of a workflow run in a Beanshell script? >> >> I assume you mean in Taverna 2.5. >> >> It is not currently directly exposed. Perhaps think it should be - >> through some injected "_metadata" oibject perhaps? >> >> Q: Why? Are you recording provenance? >> >> >> >> You would have to cheat quite a bit.. >> >> Someone tried something similar before: >> https://sourceforge.net/p/taverna/mailman/message/25689147/ >> >> But complicating this is that you want to find it from Beanshell, not >> your own Activity. The Beanshell script is evaluated here: >> >> https://github.com/apache/incubator-taverna-common-activities/blob/master/taverna-beanshell-activity/src/main/java/org/apache/taverna/activities/beanshell/BeanshellActivity.java#L174 >> (in 2.5: >> https://github.com/apache/incubator-taverna-common-activities/blob/old/beanshell-activity-1.5.1/src/main/java/net/sf/taverna/t2/activities/beanshell/BeanshellActivity.java#L181 >> ) >> >> where it does not expose the workflowRunID that was calculated just before. >> >> >> However luckily the Thread contains the workflow run number as part of >> it's string - so we can be a bit evil.. >> >> Basically we can lookup that in here: >> >> http://www.taverna.org.uk/api-2.2/net/sf/taverna/t2/facade/WorkflowInstanceFacade.html#workflowRunFacades >> >> >> Try this: >> >> import net.sf.taverna.t2.facade.WorkflowInstanceFacade; >> >> threadName = Thread.currentThread().getName(); >> processId = threadName.split(" ")[1]; >> String topFacadeId = processId.substring(0, processId.indexOf(":")); >> topFacade = WorkflowInstanceFacade.workflowRunFacades.get(topFacadeId).get(); >> >> >> runId = topFacade.getWorkflowRunId(); >> runUri = "http://ns.taverna.org.uk/2011/run/" + runId + "/"; >> >> topDataflow = topFacade.getDataflow(); >> dataflowId = topDataflow.getIdentifier(); >> >> wfBundleUri = "http://ns.taverna.org.uk/2010/workflowBundle/" + >> dataflowId + "/"; >> dataflowName = topDataflow.getLocalName(); >> // TODO Escaping name >> wfUri = wfBundleUri + "workflow/" + dataflowName + "/"; >> >> That should return you all the identifiers you need -- e.g. >> >> http://ns.taverna.org.uk/2011/run/0d3e1533-f032-46a7-a9b8-d6e4e2f24ec6/ >> http://ns.taverna.org.uk/2010/workflowBundle/9b1b7683-bd7c-4af3-947b-fa4790d693b7/ >> http://ns.taverna.org.uk/2010/workflowBundle/9b1b7683-bd7c-4af3-947b-fa4790d693b7/workflow/Workflow2/ >> >> Those should match with provenance. >> >> (it might be more complicated if you do nested workflows.) >> >> >>> 2) How can I add new libraries to be used from a Beanshell script in taverna >>> server? >>> Am I supposed to copy the *.jar libraries in >>> .../apache-tomcat-x.x.x/webapps/taverna-server/WEB-INF/lib? >> >> No, those would not be used, as the workflow is executed in a new >> executeworkflow.sh process outside Tomcat. >> >> Rather you would need to upload the JARs per workflow run to the lib/ >> sub folder of the workingDirectory through the Taverna Server API, or >> add them to the equivalent of >> /usr/local/tomcat/webapps/ROOT/WEB-INF/classes/util/taverna-commandline-enterprise-2.5.0/lib >> >> which is the unpacked commandline distribution within the Taverna Server >> >> >> -- >> Stian Soiland-Reyes >> Apache Taverna (incubating), Apache Commons RDF (incubating) >> http://orcid.org/0000-0001-9842-9718 >> >> -- >> Simone Bnà, PhD >> C++ Software Developer, CINECA >> Via Magnanelli 6/3, 40033 Casalecchio di Reno, Italy >> office: +39-0516171938 >> email: [email protected]/[email protected] > > > > -- > Stian Soiland-Reyes > Apache Taverna (incubating), Apache Commons RDF (incubating) > http://orcid.org/0000-0001-9842-9718 > > -- > Simone Bnà, PhD > C++ Software Developer, CINECA > Via Magnanelli 6/3, 40033 Casalecchio di Reno, Italy > office: +39-0516171938 > email: [email protected]/[email protected] > > -- > Simone Bnà, PhD > C++ Software Developer, CINECA > Via Magnanelli 6/3, 40033 Casalecchio di Reno, Italy > office: +39-0516171938 > email: [email protected]/[email protected] -- Stian Soiland-Reyes Apache Taverna (incubating), Apache Commons RDF (incubating) http://orcid.org/0000-0001-9842-9718
