[kepler-dev] Combining the CommandLine and Exec actors
Bertram Ludaescher
ludaesch at sdsc.edu
Sun Jun 26 10:20:31 PDT 2005
Dan Higgins writes:
> Bertram,
> Thank you for reminding me of the '&' option; frankly, I had
> forgotten that possibility.
yeah, those good old unix days ;-)
> Incidently, the Windows equivalent is
> 'start'; i.e.
> 'start acrobat' in the CommandLine actor will launch acrobat. The Java
> method 'exec' which creates a new process in the Command Line actor
> waits until the process finishes to return in the current
> implementation, but what I forgot is that the process is the commandline
> processor. That process will start a new background process which keeps
> running and then immediately returns when '&' or 'start' is used.
> The problem with this approach is that this secondary process is
> completely independent (i.e. no process id is returned to java as far as
> I can determine). Thus Kepler has no way to reference the background
> process. This is not always a problem. An use that I was thinking of is
> using other applications to display outputs - e.g. showing results in
> some other application such as using Acrobat to display pdf or
> Illustrator to show SVG files. It is somtimes desirable to launch such
> independent processes from within Kepler. (However, getting the results
> of such independent processes back into Kepler might be problematic.)
BTW, as you probably know, in a Unix shell you can "get back control"
after sending a job to the background (either with '&' or with C-z
(suspend) followed by 'bg') with the command 'fg' (foreground).
I think a job number might be given as an optional argument..
Even if you don't "reclaim control", some sort of exit code is
displayed when the job finishes (if I remember right).
So maybe this functionality could be useful to build into an actor!?
> Incidently, there is an 'Interactive Exec' actor in Kepler now which
> I created some time ago for an interactive R example. In this case, the
> process launched by java keeps running as a direct subprocess of the
> Kepler java process. (see the InteractiveR.xml workflow.) This didn't
> require any special director (it uses SDF). It keeps R running so that a
> series of commands can be entered using the InteractiveShell actor. In
> this case, the actor can keep track of the direct process launched by
> Interactive Exec because that process is directly executed (rather than
> indirectly through the command processor).
right. But this happens all within a single firing round, right?
Bertram
>
> Dan
>
> Bertram Ludaescher wrote:
>
> >Dan, Bilsay et al:
> >
> >In order to return control immediately w/o waiting for the initiated
> >command/subprocess to finish, it should be possible to use "&", at
> >least in Unix-style systems, right?
> >
> >So the good old
> > $ myjob &
> >would run myjob in the background.
> >
> >But then again, for platform independence it might be better to have a
> >parameter to the Cmd-Line actor that determines whether control is
> >returned immediately (a la "backgrounding") or after command
> >completetion.
> >
> >Ptolemy-hackers:
> >
> >Are there any directors (or could one conceive variants of the
> >existing ones) that are particularly well-suited/well-behaved with
> >Command-Line actor instances that return immediately?
> >
> >Bertram
> >
> >Dan Higgins writes:
> >..
> > > Finally, one option that I don't think we have considered in Exec or
> > > CommandLine is to launch a process and NOT wait for it to complete.
> > > (Currently I think we always use a 'waitFor()' method). This would be
> > > primarily of use for launching completely different applications for
> > > output/display at the end of a Kepler workflow. There are some occasions
> > > when this would be useful.
> >...
> >
> >
More information about the Kepler-dev
mailing list