Bug #3097
closedincorrect classpath in generated ptexecute.sh and momlexecute.sh
0%
Description
The scripts ptexecute.sh and momlexecute.sh generated by build.xml (v1.366)
do not have the jars in $KEPLER/lib/jar/ in the classpath. (same for
ptexecute.bat and momlexecute.bat on windows). kepler.sh has the same classpath,
but works since it uses ClassPathHacker to dynamically add the jars at runtime.
One solution is to modify PtExecuteApplication (ptexecute.sh) and
MoMLSimpleApplication (momlexecute.sh) to also use ClassPathHacker. A more
flexible approach would be to create a single "loader" class that worked for
all three: PtExecuteApplication, MoMLSimpleApplication, and KeplerApplication.
Thoughts?
Related issues
Updated by Matt Jones almost 17 years ago
A class with the name 'ClassPathHacker' worries me a bit. I think we need a robust class loader that can work under all 3 applications to dynamically add jars at runtime.
Updated by Dan Higgins almost 17 years ago
ClassPathHacker is the name given by the author to his class for dynamic classpath additions. Using the authors choice seems quite appropriate for a very useful piece of code. It cannot be used with ptexecute.sh and momlexecute.sh because they are Ptolemy code and do not include the dynamic calls to load jars.
Updated by Dan Higgins almost 17 years ago
crawl will check in fixes after RC1
Dan Higgins
Updated by Chad Berkley over 16 years ago
On the 1.0 release conference call, we discussed creating one shell script to replace all of the current ones. There should be two flags: -cache/nocache and -gui/nogui which would allow a user to set whether he/she wanted to use the kepler cache (and have the problem where you can't run more than one instance of kepler) or whether he/she would want to use a GUI. In the case of nogui, any gui components in a workflow should be ignored and they should not throw an exception.
Updated by Daniel Crawl over 16 years ago
I added a new target to the build file: 'ant build_wfexecute_sh' creates
wfexecute.sh, which accepts -gui/-nogui and -cache/-nocache arguments.
Chad, could you please test this to make sure it handles your use-case?
Thanks,
--dan
Updated by Christopher Brooks over 16 years ago
I tried wfexecute, it looks pretty slick, below are some comments.
- The name is a little funny. wtf comes to mind, which is vulgar.
Maybe call it wfexec? I dunno.
- Only wfexecute.bat is created? What about Unix?
- Perhaps the Usage message should indicate which of nogui/gui A comment at the top about what the script does might help.
and -nocache/cache are the defaults.
- When I run:
.\wfexecute gui demos/getting-started/03-ImageDisplay.xml Perhaps the rule that builds wfexecute.bat should also build
The image displays and then exits. Perhaps there should be
a way to have the output stay visible?
the kepler.jar file as the script will not work unless kepler.jar
is present. Maybe the build directory should also be in the
path of this script? I'm not sure about that though.
Also, about ClassPathHacker, I think the name should be changed.
I'm quite sad that the term "Hack" has been maligned by non-hackers
to mean something evil, but it is a reality. ClassPathMunger
might be an alternative name.
Just my $0.02
Updated by Daniel Crawl over 16 years ago
I moved the wfexecute functionality into kepler.sh and kepler.bat.
Remaining tasks:
1. kepler.bat functionality should be moved into kepler.exe. I tried building kepler.exe, but Launch4J fails:
C:\k\kepler>ant buildwinexe
Buildfile: build.xml
buildwinexe:
[launch4j] Compiling resources
[launch4j] c:\program files\Launch4J\bin\windres.exe: C:\DOCUME~1\a\LOCALS~1\Temp\launch4j39769rc:4: syntax error
BUILD FAILED
C:\k\kepler\build.xml:1622: net.sf.launch4j.BuilderException: net.sf.launch4j.ExecException: Exec failed: [Ljava.lang.String;@1dfafd1
2. (from comment #6) pause before exiting when running with '-gui'.
3. running with '-nogui' means running MoMLSimpleApplication:
- '-nogui -cache' is not possible since MoMLSimpleApplication does not read a
Configuration (cache is loaded via a Configuration).
- MoMLSimpleApplication does not filter Display actor or any GUI Kepler
actors.
#2 and #3 are enhancements since they would be new functionality. After #1 is resolved, I'd say re-target the remaining to the 1.1 release.
Updated by Daniel Crawl over 16 years ago
I updated kepler.exe for windows and removed kepler.bat.
The remaining tasks are enhancements for a later release.
Updated by Chad Berkley over 15 years ago
Need to make sure this functionality still works with the new modular system and new build system.
Updated by Chad Berkley over 15 years ago
Created a new task 'ant startupScript' which generates 4 scripts to start kepler. kepler.sh, kepler.bat, kepler.exe and Kepler.app/. The .sh and .bat files will take as many arguments as are needed to launch kepler. The .exe and .app are for windows and osx respectively. I do not believe they can take the additional arguments.
Will test the #2 and #3 next week. If they work, I will close this bug.
Updated by Chad Berkley over 15 years ago
Update:
2. (from comment #6) pause before exiting when running with '-gui'.
I'm looking into this now. I'm not exactly sure how to pause the execution since this functionality uses reflection to create and call the class that executes the workflow. Anyone know how to do this?
3. running with '-nogui' means running MoMLSimpleApplication:
- '-nogui -cache' is not possible since MoMLSimpleApplication does not read a
Configuration (cache is loaded via a Configuration).
This error is now caught and explained to the user.
- MoMLSimpleApplication does not filter Display actor or any GUI Kepler
actors.
I think this point could be an entirely new bug in and of itself. Not sure how to do this quickly. I'll put it in a new bug and target it post-2.0
Updated by Chad Berkley over 15 years ago
Execution now pauses. Will break "- MoMLSimpleApplication does not filter Display actor or any GUI Kepler actors." into a separate bug.