Bug #3529
closedcannot always set parameters when running workflow from command line
0%
Description
When -nogui is used, MoMLSimpleApplication loads and runs the workflow. This class does not support setting model parameters. (This functionality exists in MoMLApplication, so maybe the code to set parameters could be split out).
Updated by Christopher Brooks about 16 years ago
I'll take this one. Maybe MoMLSimpleApplication is not the
place for this, since it makes the application not so simple.
Currently, MoMLSimpleApplication is in ptolemy.moml because it does not
require the Configuration and other classes that are used by MoMLApplication
in ptolemy.actor.gui.
MoMLApplication has a homegrown way of handling command line arguments where
the arguments are parsed by the current class and if the argument is not parsed
by the current class, then the argument is parsed by the parent class.
The problem here is that MoMLSimpleApplication and MoMLApplication both extend
Object. So, we would need to a different implementation so as to avoid code
duplication.
Updated by Christopher Brooks over 15 years ago
I've created ptolemy.moml.MoMLCommandLineApplication, which
takes command line arguments that update the parameters.
See
http://mercury.nceas.ucsb.edu/kepler/pipermail/kepler-users/2009-February/001332.html
for further discussion.
I looked at refactoring the code, and it would be a big job. Probably
ptolemy.actor.gui.MoMLApplication should extend a class in ptolemy.moml that
provides the basic infrastructure. The amount of code duplication in
this new class is fairly small. If this was to be avoided, we would want
ptolemy.actor.gui.MoMLApplication to call a utility function. However,
this would increase complexity.
However, there are issues in the devel tree:
1) https://dev.kepler-project.org/developers/reference/executing-kepler-from-the-command-line
was way out of date. There is no kepler.sh or kepler file in my tree.
I added some text at the bottom that describes the current situation.
2) There is discussion at
http://mercury.nceas.ucsb.edu/kepler/pipermail/kepler-dev/2009-February/013829.html
about how to run from the command line, but I'm not sure how to pass a command
line argument.
To close this bug, I'd like to be able to invoke a workflow from the command
line and pass it an argument.
Something like:
ant run-workflow-no-gui -Dworkflow=/Users/cxh/ptII/ptolemy/moml/test/MoMLCommandLineApplicationTest.xml -DmyParameter=2
BTW - I really don't like the -Dworkflow= syntax. We should probably
have a kepler script that buries this from the user.
Updated by Daniel Crawl over 15 years ago
Parameters can now be passed when using -nogui.
Additionally, 'ant startup-script' creates kepler.sh so you don't need to use ant's -Dworkflow= syntax.