You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@taverna.apache.org by Stian Soiland-Reyes <st...@apache.org> on 2016/06/09 07:13:28 UTC

Re: baclava port value overriding

Hi!

I think what you are describing is a new feature - currently the
Taverna server and the command line will use the baclava / -inputdoc
option "as gospel" and ignore any individual parameters set.

Should we raise that as a new Jira issue?


So you would have to either set each of the remaining inputs
individually (but then no longer being able to do list of lists, etc),
or hand-cook a modified baclava document to include the downloaded
data - note that Baclava uses base64-encoding so this could get a bit
big depending on the file.

Adding support for this in our code would perhaps be a better
solution.. Relevant Taverna 3 code:

See https://github.com/apache/incubator-taverna-commandline/blob/master/taverna-commandline-common/src/main/java/org/apache/taverna/commandline/data/InputsHandler.java
Note that this code in Taverna 3 expects a Data Bundle ZIP with
-inputbundle, rather than a baclava document with -inputdoc.



Support for Baclava (reintroducing -inputdoc) could be added there,
and could use
https://github.com/apache/incubator-taverna-language/blob/master/taverna-baclava-language/src/main/java/org/apache/taverna/baclava/BaclavaReader.java

I propose support for input overrides should be in the order:

-inputbundle
-inputdoc
-inputfile
-inputvalue

?




Being able to reference an input by URL from within the input document
would probably help your use-case; which the Data Bundle support in
Taverna 3 can already handle if you register it with
https://taverna.incubator.apache.org/javadoc/taverna-language/org/apache/taverna/databundle/DataBundles.html#setReference-java.nio.file.Path-java.net.URI-

e.g. something like:

try (Bundle b = DataBundles.createBundle()) {
  Path inputs = DataBundles.getInputs(b);
  Path portA = DataBundles.getPort(inputs, "thatone");
  DataBundles.setReference(portA, URI.create("http://example.com/file.txt"));
  DataBundles.closeAndSaveBundle(b, Paths.get("/home/alice/input.bundle.zip"));
}




On 8 June 2016 at 14:52, Simone Bnà <s....@cineca.it> wrote:
> Dear Taverna team,
>
> I developed a middleware for taverna that receives a baclava file as input.
>
> The middleware parses the baclava and if a port value is a URL it downloads the file corresponding to that URL
> and upload it to taverna using a POST request to "rest/runs/<uuid>/wd/IN".
>
> Then, I upload the baclava as is and make a PUT to "rest/runs/<uuid>/input/baclava".
>
> In the next step I override the port value specified in the baclava as a URL with the file description
> making a PUT request to "rest/runs/<uuid>/input/input/<filename>"  (payload == """<t2sr:runInput xmlns:t2sr="http://ns.taverna.org.uk/2010/xml/server/rest/"> <t2sr:file>%s</t2sr:file> </t2sr:runInput>""" % filename )
>
> What I noticed is that the overriding of the port does not work. The values specified in the baclava are always evaluated during the run.
>
> If I do not make the PUT request to "rest/runs/<uuid>/input/baclava" the update of the port is performed
> but the other values specified in the baclava are not evaluated at all.
>
>
> My question is:
>
> how can I override some port values reported in the baclava file using a REST API and
> telling taverna to take the port values in the baclava file if they are not overridden?
>
>
> Best regards,
>
> Simone.
>
> --
> Simone Bnà, PhD
> C++ Software Developer, CINECA
> Via Magnanelli 6/3, 40033 Casalecchio di Reno, Italy
> office:   +39-0516171938
> email: s.bna@scsitaly.com/s.bn@cineca.it



-- 
Stian Soiland-Reyes
Apache Taverna (incubating)
http://orcid.org/0000-0001-9842-9718

Re: baclava port value overriding

Posted by Simone Bnà <s....@cineca.it>.
Dear Stian,

reply is in line:

> Should we raise that as a new Jira issue?

yes, thanks.


> I propose support for input overrides should be in the order:
> -inputbundle
> -inputdoc
> -inputfile
> -inputvalue
> ?

Sounds good.

Best regards,

Simone.


----- Messaggio originale -----
Da: "Stian Soiland-Reyes" <st...@apache.org>
A: "Simone Bnà" <s....@cineca.it>
Cc: "Apache Dev" <de...@taverna.incubator.apache.org>, "VPHHF" <vp...@googlegroups.com>
Inviato: Giovedì, 9 giugno 2016 9:13:28
Oggetto: Re: baclava port value overriding

Hi!

I think what you are describing is a new feature - currently the
Taverna server and the command line will use the baclava / -inputdoc
option "as gospel" and ignore any individual parameters set.

Should we raise that as a new Jira issue?


So you would have to either set each of the remaining inputs
individually (but then no longer being able to do list of lists, etc),
or hand-cook a modified baclava document to include the downloaded
data - note that Baclava uses base64-encoding so this could get a bit
big depending on the file.

Adding support for this in our code would perhaps be a better
solution.. Relevant Taverna 3 code:

See https://github.com/apache/incubator-taverna-commandline/blob/master/taverna-commandline-common/src/main/java/org/apache/taverna/commandline/data/InputsHandler.java
Note that this code in Taverna 3 expects a Data Bundle ZIP with
-inputbundle, rather than a baclava document with -inputdoc.



Support for Baclava (reintroducing -inputdoc) could be added there,
and could use
https://github.com/apache/incubator-taverna-language/blob/master/taverna-baclava-language/src/main/java/org/apache/taverna/baclava/BaclavaReader.java

I propose support for input overrides should be in the order:

-inputbundle
-inputdoc
-inputfile
-inputvalue

?




Being able to reference an input by URL from within the input document
would probably help your use-case; which the Data Bundle support in
Taverna 3 can already handle if you register it with
https://taverna.incubator.apache.org/javadoc/taverna-language/org/apache/taverna/databundle/DataBundles.html#setReference-java.nio.file.Path-java.net.URI-

e.g. something like:

try (Bundle b = DataBundles.createBundle()) {
  Path inputs = DataBundles.getInputs(b);
  Path portA = DataBundles.getPort(inputs, "thatone");
  DataBundles.setReference(portA, URI.create("http://example.com/file.txt"));
  DataBundles.closeAndSaveBundle(b, Paths.get("/home/alice/input.bundle.zip"));
}




On 8 June 2016 at 14:52, Simone Bnà <s....@cineca.it> wrote:
> Dear Taverna team,
>
> I developed a middleware for taverna that receives a baclava file as input.
>
> The middleware parses the baclava and if a port value is a URL it downloads the file corresponding to that URL
> and upload it to taverna using a POST request to "rest/runs/<uuid>/wd/IN".
>
> Then, I upload the baclava as is and make a PUT to "rest/runs/<uuid>/input/baclava".
>
> In the next step I override the port value specified in the baclava as a URL with the file description
> making a PUT request to "rest/runs/<uuid>/input/input/<filename>"  (payload == """<t2sr:runInput xmlns:t2sr="http://ns.taverna.org.uk/2010/xml/server/rest/"> <t2sr:file>%s</t2sr:file> </t2sr:runInput>""" % filename )
>
> What I noticed is that the overriding of the port does not work. The values specified in the baclava are always evaluated during the run.
>
> If I do not make the PUT request to "rest/runs/<uuid>/input/baclava" the update of the port is performed
> but the other values specified in the baclava are not evaluated at all.
>
>
> My question is:
>
> how can I override some port values reported in the baclava file using a REST API and
> telling taverna to take the port values in the baclava file if they are not overridden?
>
>
> Best regards,
>
> Simone.
>
> --
> Simone Bnà, PhD
> C++ Software Developer, CINECA
> Via Magnanelli 6/3, 40033 Casalecchio di Reno, Italy
> office:   +39-0516171938
> email: s.bna@scsitaly.com/s.bn@cineca.it



-- 
Stian Soiland-Reyes
Apache Taverna (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: s.bna@scsitaly.com/s.bn@cineca.it