[kepler-dev] Environment Variables

Slavisa Garic sgaric at gmail.com
Tue Jun 10 03:19:59 PDT 2014


Hi Michal,

Basically we have our own actor that we use to execute commands either
locally or remotely using our own tools (Nimrod/G and Nimrod/K). The
problem is in those actors when I try to evaluate the expression which has
environment variable in it that is not part of the regular set (PATH, HOME
etc). Is there some way I can evaluate them programatically?

I had to change the code so that the parameter mode is set to lazy
(command.setLazy(true)) because we try to build the environment from
incoming ports and such. If I could load the environment variable list and
parse it myself in the code I would do it. So do you have any idea how to
access it in code?

Thanks in advance for your answers,
Slavisa


On Tue, Jun 10, 2014 at 12:11 PM, Michal Owsiak <michalo at man.poznan.pl>
wrote:

> Is this something you are looking for (see attachment)
>
> Michal
>
>
>  That works fine. Can we use this somehow in External Execution actors? I
>> tried and failed.
>>
>> What we need is a way to use environment variables to locate executables,
>> e.g. FSLDIR=/opt/local/bet, so that I can execute $FSLDIR/bin/bet. I
>> understand that if added to PATH these will be accessible by simply by
>> executing 'bet' but we'd still like to have access to environment
>> variables
>> to locate specific versions etc.
>>
>> Slavisa
>>
>>
>> On Tue, Jun 10, 2014 at 11:56 AM, Michal Owsiak <michalo at man.poznan.pl>
>> wrote:
>>
>>  Try following instead.
>>>
>>> Inside expression actor use following:
>>>
>>> getenv("YOUR_VARIABLE_GOES_HERE")
>>>
>>> Michal
>>>
>>>
>>>   Hi,
>>>
>>>>
>>>> Could someone explain to me if there is a bug or I am doing something
>>>> wrong
>>>> that my workflows can't access environment variables.
>>>>
>>>> I tried setting them up in usual ways (profile scripts) and by using
>>>> environment.txt but no actor has access to them.
>>>>
>>>> For example I tried setting up TESTVAR and then accessing it in constant
>>>> actor but it raises an error as if it was not there. Top of the
>>>> exception
>>>> stack is just below.
>>>>
>>>> Regards,
>>>> Slavisa Garic
>>>> PS. I can see this being set with kepler-2.4.0/module-info/
>>>> environment.txt
>>>> when Kepler is launched by kepler.sh and I get messages such as
>>>>
>>>> ....
>>>> Set environment variable: TESTVAR = mymessage
>>>> Set environment variable: R_HOME = /Library/Frameworks/R.
>>>> framework/Resources
>>>> ....
>>>>
>>>>
>>>> ptolemy.kernel.util.IllegalActionException: Error evaluating
>>>> expression:
>>>>
>>>>  $TESTVAR
>>>>>     in .Unnamed1.Constant.value
>>>>> Because:
>>>>> Error parsing expression "$TESTVAR"
>>>>> Because:
>>>>> Encountered "" at line 1, column 1.
>>>>> Was expecting one of:
>>>>>
>>>>> Because:
>>>>> Error evaluating expression: $TESTVAR
>>>>>     in .Unnamed1.Constant.value
>>>>> Because:
>>>>> Error parsing expression "$TESTVAR"
>>>>> Because:
>>>>> Encountered "" at line 1, column 1.
>>>>> Was expecting one of:
>>>>>
>>>>> at ptolemy.data.expr.Variable.validate(Variable.java:1491)
>>>>> at ptolemy.moml.MoMLParser.endDocument(MoMLParser.java:802)
>>>>> at com.microstar.xml.XmlParser.doParse(XmlParser.java:162)
>>>>> at com.microstar.xml.XmlParser.parse(XmlParser.java:132)
>>>>> at ptolemy.moml.MoMLParser.parse(MoMLParser.java:1540)
>>>>> at ptolemy.moml.MoMLParser.parse(MoMLParser.java:1512)
>>>>> at ptolemy.moml.MoMLParser.parse(MoMLParser.java:1668)
>>>>> at ptolemy.moml.MoMLChangeRequest._execute(MoMLChangeRequest.java:289)
>>>>> at ptolemy.actor.gui.PtolemyQuery$3._execute(PtolemyQuery.java:824)
>>>>> at ptolemy.kernel.util.ChangeRequest.execute(ChangeRequest.java:171)
>>>>> at ptolemy.kernel.util.NamedObj._executeChangeRequests(
>>>>> NamedObj.java:2559)
>>>>> at ptolemy.kernel.util.NamedObj.executeChangeRequests(
>>>>> NamedObj.java:725)
>>>>> at ptolemy.kernel.util.NamedObj.requestChange(NamedObj.java:1776)
>>>>> at ptolemy.actor.CompositeActor.requestChange(CompositeActor.
>>>>> java:1957)
>>>>> at ptolemy.kernel.util.NamedObj.requestChange(NamedObj.java:1761)
>>>>> at ptolemy.actor.gui.PtolemyQuery.changed(PtolemyQuery.java:885)
>>>>> at ptolemy.gui.Query._notifyListeners(Query.java:1928)
>>>>> at ptolemy.gui.Query$QueryFocusListener.focusLost(Query.java:2515)
>>>>> at java.awt.AWTEventMulticaster.focusLost(AWTEventMulticaster.
>>>>> java:213)
>>>>> at java.awt.Component.processFocusEvent(Component.java:6306)
>>>>> at java.awt.Component.processEvent(Component.java:6170)
>>>>> at java.awt.Container.processEvent(Container.java:2084)
>>>>> at java.awt.Component.dispatchEventImpl(Component.java:4776)
>>>>> at java.awt.Container.dispatchEventImpl(Container.java:2142)
>>>>> at java.awt.Component.dispatchEvent(Component.java:4604)
>>>>> at
>>>>> java.awt.KeyboardFocusManager.redispatchEvent(
>>>>> KeyboardFocusManager.java:
>>>>> 1856)
>>>>> at
>>>>> java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(
>>>>> DefaultKeyboardFocusManager.java:920)
>>>>> at
>>>>> java.awt.DefaultKeyboardFocusManager.dispatchEvent(
>>>>> DefaultKeyboardFocusManager.java:578)
>>>>>
>>>>>
>>>> .....
>>>>
>>>>  .....
>>>>>
>>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> Kepler-dev mailing list
>>>> Kepler-dev at kepler-project.org
>>>> http://lists.nceas.ucsb.edu/kepler/mailman/listinfo/kepler-dev
>>>>
>>>>
>>>>  _______________________________________________
>>> Kepler-dev mailing list
>>> Kepler-dev at kepler-project.org
>>> http://lists.nceas.ucsb.edu/kepler/mailman/listinfo/kepler-dev
>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nceas.ucsb.edu/kepler/pipermail/kepler-dev/attachments/20140610/089e39f2/attachment.html>


More information about the Kepler-dev mailing list