[kepler-users] Setting parameters for command line execution

GARY WERNSING gary.wernsing at me.com
Thu Dec 5 08:53:28 PST 2013


Hi Christopher,

Thank you for the push in the right direction. It turned out to be a quoting issue. The necessary way to quote (for my tcsh) was ""/Users/wernsing/rest.py"". The escaping of the back slashes was not necessary. I also tried double quotes inside of single quotes but that gave me the same issue I originally wrote about.

I am back to "loving" Kepler.

--Gary

On Dec 05, 2013, at 10:38 AM, Christopher Brooks <cxh at eecs.berkeley.edu> wrote:

Hi Gary,
Do you have a small test case?

A few thoughts:
1) Passing in a string parameter value might require including double quotes in the value.  Getting these double quotes to not be stripped off by kepler.sh could be tricky.  Kepler uses Ptolemy II as its execution engine and http://ptolemy.eecs.berkeley.edu/ptolemyII/ptIIfaq.htm#invoking%20Ptolemy%20II? discusses setting Parameter in Ptolemy II.  In particular:

Note that strings need to have double quotes converted to " so to set a parameter named c to the string "bar" it might be necessary to do something like:
   $PTII/bin/ptolemy foo.xml -a 5 -y.b 10 -c "\&quot\;bar\&quot\;"
   
The " is necessary to convert the double quote to something safe to in an XML file. The backslashes are necessary to protect the & and ;from the shell in the shell script.
Note that the ptolemy.actor.parameters.ParameterSet attribute is a better way to set parameters at run time. ParameterSet is an attribute that reads multiple values from a file and sets corresponding parameters in the container.
Kepler and Ptolemy use different start up scripts, but it might be worth trying "\"/Users/wernsing/rest.py\""

2) The fact that the model works ok from the GUI is interesting, it could be that there is something up with type resolution.  I'm not sure if Kepler 2.4 is based on a version of Ptolemy II that has backward type inference, but you could try setting the enableBackwardTypeInference top level parameter, http://www.mail-archive.com/kepler-users@kepler-project.org/msg02468.html says:

Re: [kepler-users] How do I set the backward type inference for a particular actor?

Christopher Brooks Tue, 22 Oct 2013 18:01:54 -0700
Search for "Parameter", drag it in, rename it to "enableBackwardTypeInference" and set the value to "true". Unfortunately, Kepler does not have the model-specfic context menu that allows one to add a parameter by right clicking on the background, There is probably a bug here to be reported, which I will do now.

How I would proceed is by creating small examples that exercise setting parameter, setting a Parameter that is a String, setting a PortParameter, settng a PortParameter connected to a Python actor etc.

_Christopher

On 12/5/13 4:42 AM, GARY WERNSING wrote:
I am trying to pass a parameter to a workflow via the command line. Chapter two of the user manual suggests it is straight forward and that adding '-x 4 -y "foo"' to the command line would set both x and y. I am starting to think there is something unspoken about actually using this technique.

I have a workflow that executes properly when I run it from the Kepler GUI but fails when run from the command line. My command line is:

/Applications/Kepler-2.4/Kepler.app/Contents/Resources/Java/kepler.sh -runkar -ScriptLocation "/Users/wernsing/rest.py" /Users/wernsing/KeplerData/workflows/MyWorkflows/RESTviaPython.kar

At some point later I get

...
    [null] Command failed.
    [null] ptolemy.actor.TypeConflictException: Types resolved to unacceptable type . .RESTviaPython due to the following objects:
    [null]   (variable .RESTviaPython.ScriptLocation: unknown)
...

My workflow has three Port Parameters one of which is named "ScriptLocation". When I run the workflow from the Kepler GUI I get the expected result (a file appears on my desktop) so I have some confidence that the workflow is correct. I am baffled as to how to get the command line invocation to set the Port Parameters.

Any advice and/or magic incantations would be greatly appreciated.

--Gary
_______________________________________________
Kepler-users mailing list
Kepler-users at kepler-project.org
http://lists.nceas.ucsb.edu/kepler/mailman/listinfo/kepler-users


-- 
Christopher Brooks, PMP                       University of California
Academic Program Manager & Software Engineer  US Mail: 337 Cory Hall
CHESS/iCyPhy/Ptolemy/TerraSwarm               Berkeley, CA 94720-1774
cxh at eecs.berkeley.edu, 707.332.0670           (Office: 545Q Cory)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nceas.ucsb.edu/kepler/pipermail/kepler-users/attachments/20131205/50a00690/attachment-0001.html>


More information about the Kepler-users mailing list