Yoshinobu Kano wrote:
> Hi,
Hello,
Sorry for the delay in replying.
> I am trying to develop my own plugin, referring existing plugin codes as
> examples.
> May I have information how-to-use the APIs to acheive issues described
> below?
>
> Targeting at Taverna version 2.1beta or later, I would like to create:
>
> 1. A plugin without input, allows output streaming, has output ports of
> depth 1, each port outputs the same length of list.
>
> What happens when an activity of the later workflow recieves two (or
> more) of such "synchronized" depth-1-outputs,
> is it possible to recieve the same index of each output?
To do so, the later activity will have to use dot product list handling
so that the element N of list 1 is matched with element N of list 2 etc.
> In the BiomartActivity,
> ...
> if (attribute.getAttributes() != null) {
> outputPort =
> edits.createActivityOutputPort(name, 2, STREAM_RESULTS?1:2);
> } else {
> outputPort =
> edits.createActivityOutputPort(name, 1, STREAM_RESULTS?0:1);
> }
> ...
> seems like creating output ports for streaming, but not sure what the
> arguments exactly mean.
The first argument is the port name.
The second argument is the port depth. So "2" means that the complete
output from the port is a list of lists of values; "1" means it is a
list of values.
The third argument is called the granular depth. It specifies the
chunks in which the output from a port is sent out.
Most activities will wait until all the data for an output port has been
produced and then send out that data. However, Taverna allows you to
send out chunks of the output data as they are produced.
outputPort = edits.createActivityOutputPort(name, 2, STREAM_RESULTS?1:2);
says that the complete output is a list of list of values. If streaming
is _not_ enabled, then the chunk is of depth 2 i.e. a list of list of
values i.e. the complete output. If streaming _is_ enabled, then the
chunks are of depth 1 i.e. a list of values, one for each element of the
complete output.
> What should I do to create output ports -- do I need to do something
> both for streaming and non-streaming depending on some context?
If you want to always allow streaming, then just specify a granular
depth that is less than the total depth of the output. For example, you
could have an overall depth of 2 and a granular depth of 0, which means
that each individual value could be output as the activity calculates it.
> I have tried a simple test code imitating the BiomartActivity code as
> below but it loops forever, and every recieveResult call seems like
> generating these errors:
>
> ERROR 2009-10-06 12:40:51,387
> (net.sf.taverna.t2.workflowmodel.processor.dispatch.AbstractErrorHandlerLayer:166)
>
> - Could not forget [...@48d334]
>
> ERROR 2009-10-06 12:40:51,396
> (net.sf.taverna.t2.workflowmodel.processor.dispatch.AbstractErrorHandlerLayer:166)
>
> - Could not forget [...@48d334]
I am not sure.
[snip]
> Would you please give me some clue how to use methods In "public
> interface AsynchronousActivityCallback",
> public abstract void requestRun(Runnable runnable)
> public abstract void receiveResult(Map map, int ai[]);
> public abstract void receiveCompletion(int ai[]);
Those methods are created by the Invoke layer and passed to the
activities that it invokes.
In the executeAsynch method of your activity, you create a Runnable
(normally a Thread) that will actually run the service for the activity
e.g. executes the beanshell script or queries the BioMart database. You
then do
theCallback.requestRun(theRunnable)
which asks Taverna to run the activity.
Within the Runnable's run method, when the activity generates a result,
you can have a Map from the activity port name to the generated data.
You can do theCallback.receiveResult as the individual outputs are
generated. This is done by only mentioning the ports for the new output
data in the Map.
If you are streaming data from the activity then you do
theCallback.receiveResult as the chunks of data are generated for the
output ports. The Map is from the port names to the chunks of data.
Taverna needs to know where the chunk fits into the overall output data.
That is what the second parameter to receiveResult is for. So, if you
created an output port of depth 2 and granular depth 0, then you need to
specify the two indexes to position the single value within the list of
lists of values. e.g.
theCallback.receiveResult(theMapOfPortNameToChunk, new int[2] {7, 3});
For non-streaming data, you will have
theCallback.receiveResult(theMapOfPortNameToCompleteOutput, new int[0]);
You can ignore theCallback.receiveCompletion. It is probably best to do
theCallback.receiveResult(theMapOfPortNameToCompleteOutput, new int[0]);
> 2. A plugin very similar to the BeanshellActivity,
> but need to know the end-of-the-iteration of inputs (or workflow).
> How can I notice such a condition -- which methods to use?
I am not sure what you mean. Perhaps you want to stream inputs?
> 3. After developing these plugins, I would like to make my repository
> public.
> When I added my repository location manually to the Taverna's
> plugins.xml it worked fine,
> but it does not appear in the Taverna GUI's "Find New Plugins" menu.
Did you add the plugin site under the Find new plugins?
> What sort of file should I add to my repository for Taverna to detect my
> plugin, including update detections?
You need do not need to add anything to your repository. You need a
place on a website that contains your plugins.xml and the description
for each plugin. When a user adds that new plugin site into Taverna,
then users can see your plugin.
By default, Taverna knows about the plugin site at mygrid.org.uk. There
have been suggestions about having registries of plugin sites, or
linking to them from a myExperiment pack. If you want your plugin to be
visible without users doing anything special, then it is easiest to ask
someone (e.g. me) to add your plugin to the mygrid plugin list.
> Thank you very much in advance,
>
> -Yoshinobu
Alan
------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
taverna-hackers mailing list
[email protected]
Web site: http://www.taverna.org.uk
Mailing lists: http://www.taverna.org.uk/taverna-mailing-lists/
Developers Guide: http://www.mygrid.org.uk/tools/developer-information