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]
