[kepler-dev] Determine whether -nogui was specified

Colin Enticott Colin.Enticott at csse.monash.edu.au
Wed Aug 12 18:11:48 PDT 2009


Just as a last note, the stack trace solution will not work under the PN 
director as the actor's thread starts at the "ProcessThread" class.

:-)
Colin

David Welker wrote:
> Hi Michal,
>
> I have added a fix to this. Now, if you want to know what command-line 
> args were passed, you can cycle through them. For example, here is 
> code that would allow you to see if -nogui was specified.
>
>
> import org.kepler.CommandLineArgs;
>
> ....
>
>
>
> public void fire() throws IllegalActionException
> {
>     
>     ....
>     
>     boolean noguiSpecified = false;
>
>     for( String arg : CommandLineArgs.get() )
>         if( arg.equals("-nogui") )
>                 {
>             noguiSpecified = true;
>                         break;
>                 }   
>
>     ....
>
> }
>
> Hope that helps. It certainly is a little cleaner that looking at 
> stack traces.
>
> David
>
>
>
> On Aug 12, 2009, at 12:10 PM, Michal Owsiak wrote:
>
>> Thanks for the info.
>>
>> The hack-way is not a pretty solution, but it will do a thing - I will
>> check that and tell you whether it works fine.
>>
>> What I am trying to accomplish is creating an actor that is able to show
>> dialog window - when GUI mode is enabled, and skip showing it, when
>> -nogui is passed. This way I can easily (without changing actor's
>> parameters within workflow) use the same scenario for both cases.
>> Otherwise I have to enable/disable some parameter.
>>
>> But as I have mentioned, I will check the "stack thing" - it should 
>> work.
>>
>> Anyway, if it is possible to add this feature it would be fine.
>>
>> Another useful feature (in case of -nogui mode) would be providing
>> Kepler developers with an access to command line arguments. This way it
>> would be possible to parametrize workflow from outside through the
>> application's parameters - this would useful whenever Kepler is started
>> as a part of a process.
>>
>> Regards
>>
>> michal
>>
>>> There is no really good way to do this at present.
>>>
>>> If -nogui passed in as an argument, then that affects what is called
>>> (either org.kepler.KeplerConfigurationApplication or
>>> ptolemy.moml.MoMLCommandLineApplication) but unfortunately the fact 
>>> that
>>> -nogui was passed in is not otherwise stored.
>>>
>>> A hackish way to detect whether new -nogui was passed in that should
>>> work (I haven't tried it) would be to examine the current stack trace
>>> and see if either of the following is present.
>>>
>>> org.kepler.KeplerConfigurationApplication.main(String[] args)
>>>
>>> OR
>>>
>>> ptolemy.moml.MoMLCommandLineApplication(String[] args)
>>>
>>> One of these classes is called if and only if -nogui was passed in as a
>>> command-line argument.
>>>
>>> What are you trying to accomplish? Should we make it more convenient to
>>> determine whether -nogui has been passed in on the command line?
>>>
>>> -David
>>>
>>>
>>>
>>> On Aug 12, 2009, at 2:38 AM, Michal Owsiak wrote:
>>>
>>>> Hello all,
>>>>
>>>> I want to check within the actor's fire() method whether Kepler was
>>>> started with "-nogui" argument. Is it possible to determine whether 
>>>> this
>>>> switch was used during Kepler execution? How this information can be
>>>> retrieved?
>>>>
>>>> Regards
>>>>
>>>> Michal
>>>>
>>>> -- 
>>>> Michal Owsiak <michalo at man.poznan.pl>
>>>> Poznan Supercomputing and Networking Center
>>>> ul. Noskowskiego 10, 61-704 Poznan, POLAND
>>>> http://www.man.poznan.pl
>>>> _______________________________________________
>>>> Kepler-dev mailing list
>>>> Kepler-dev at kepler-project.org
>>>> http://mercury.nceas.ucsb.edu/kepler/mailman/listinfo/kepler-dev
>>>
>>
>>
>> -- 
>> Michal Owsiak <michalo at man.poznan.pl>
>> Poznan Supercomputing and Networking Center
>> ul. Noskowskiego 10, 61-704 Poznan, POLAND
>> http://www.man.poznan.pl
>
> _______________________________________________
> Kepler-dev mailing list
> Kepler-dev at kepler-project.org
> http://mercury.nceas.ucsb.edu/kepler/mailman/listinfo/kepler-dev


-- 
Colin Enticott, Research Scientist, Ph: +61 03 9903 2215
Room H7.26, Level 7, Building H, Monash University Caulfield 3145, Australia 



More information about the Kepler-dev mailing list