[vistrails-users] Setting VisTrail input parameters using the API - VisTrails 2.2 [SEC=UNCLASSIFIED]

Tim Bedin T.Bedin at bom.gov.au
Wed May 27 00:19:10 EDT 2015


I am currently working on a web service that executes VisTrails on a headless server. I have had some problems using the Xvfb wrapper script to run the VisTrails application, so I have been attempting to use the API to execute .vt files that have been previously prepared using the GUI application.

My script looks like this:

#!/usr/bin/env python

import argparse

import vistrails.core.api as vt_api

def main(args):
    """ Set the VisTrails pipeline running. """

    vt_file = vt_api.load_vistrail(args.workflow)


if __name__ == "__main__":
    """ Run a VisTrails workflow using the API. """

    parser = argparse.ArgumentParser("Run a prepared VisTrails workflow file using the API")
    parser.add_argument("workflow", help="The VT file to run")

    args = parser.parse_args()

This works as expected, loads the .vt file and executes the pipeline successfully.

However I would like to modify my script so that values for the input ports can be set from the command line.

I have had a look at the API code on github (https://github.com/VisTrails/VisTrails/blob/v2.2.0/vistrails/core/api.py) and found what I thought would work in the docstring of the execute method of the Pipeline class. However, when I pass in the required parameter as a keyword argument to the execute method the workflow fails.

For example, I want to set the input value of "experiment" to "rcp85", I call:


This throws the following error:

Traceback (most recent call last):
  File "./vt_execute.py", line 32, in <module>
  File "./vt_execute.py", line 16, in main
  File "/src/vistrails/core/api.py", line 243, in execute
    return self.current_pipeline.execute(*args, **kwargs)
  File "/src/vistrails/core/api.py", line 425, in execute
    module = pipeline.modules[module_id]
KeyError: 9L

My concern is that I might have a conceptual misunderstanding here. My VisTrail has an InputPort module for each of the parameters I wish to set from the command-line. I have set the 'name' parameter through the GUI (in this case, to be 'experiment').

I can certainly add a github issue for this if necessary, but I suspect the problem is on my end not a bug!

Thanks for your help,

Tim Bedin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.vistrails.org/pipermail/vistrails-users/attachments/20150527/cffabbf8/attachment.html>

More information about the vistrails-users mailing list