Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: Merge Links #4

Open
sbna opened this issue Jun 16, 2016 · 2 comments
Open

Question: Merge Links #4

sbna opened this issue Jun 16, 2016 · 2 comments

Comments

@sbna
Copy link

sbna commented Jun 16, 2016

Hi,

I am wondering if it is possible in your library to merge two outputs coming from two different tasks in a single output port (aka Merge datalinks in taverna)?

Thanks.

Simone

@jongiddy
Copy link
Owner

Merging outputs does not work currently. I had planned to support it by allowing multiple inputs to the same named port to automatically create a merge task, but I had no need for it myself, so it was low priority.

One way to merge now is to create a BeanShell with two (or more) inputs that concatenates them together into a single output port. This also gives you more control over how the ports are merged.

@sbna
Copy link
Author

sbna commented Jun 20, 2016

I have solved by changing the t2flow/exportSinkXML function:

def exportSinkXML(self, xml):
    with xml.namespace("http://taverna.sf.net/2008/xml/t2flow") as tav:
        is_linked = False
        link_type = "dataflow"
        for dataLink in self.flow.dataLinks:
            if(dataLink.sink.name == self.name):
                if(is_linked==True):
                    link_type = "merge"
                    break
                is_linked = True
        with tav.sink(type=link_type):
            tav.port >> self.name

and concatenates two task outputs into a single workflow output port:

data_left_stderr = tasks[myinstance.content].output['STDERR']
data_right_stderr = flow.output['Log']
data_left_stderr | data_right_stderr
data_left_stdout = tasks[myinstance.content].output['STDOUT']
data_right_stdout = flow.output['Log']
data_left_stdout | data_right_stdout

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants