Start a new topic

Scripting : having the list of the running session with __ctx__.executeCommand

Is __ctx__.executeCommand still available?

I'm trying to set up a scipt to telle if my current process is already running using __ctx__.executeCommand like this : 


_ctx__.executeCommand(get sessions TEST_PROCESS_CONCURRENT status running)


The complet jython script is the following : 

import time

Process_To_Check = __ctx__.getVariableValue("${../CALLING_SESSION}$")

Iter_Max = __ctx__.getVariableValue("%{PITER}%")

Wait_Delay = __ctx__.getVariableValue("%{PWAITDELAY}%")

Iter = 1

while Iter < Iter_Max:

    found = 0

     s = __ctx__.executeCommand(get sessions Process_To_Check status running)

 running)

    lst = s.split("\n")

    for i in range(len(lst)):

        if lst[i].startswith("${../PROCESS_TO_CHECK}$" + " "):

            found += 1

    time.sleep(Wait_Delay)

    Iter += 1

if found > 1:

    raise Exception("Another process is already running")


image

But I have the following error : 

javax.script.ScriptException: SyntaxError: no viable alternative at input 'sessions' in <script> at line number 12 at column number 35

 at org.python.jsr223.PyScriptEngine.scriptException(PyScriptEngine.java:213)

 at org.python.jsr223.PyScriptEngine.compileScript(PyScriptEngine.java:93)

 at org.python.jsr223.PyScriptEngine.eval(PyScriptEngine.java:31)

 at java.scripting/javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:264)

 at com.indy.engine.actionCodes.ScriptingActionCodeI._executeCodewithRSet(ScriptingActionCodeI.java:84)

 at com.indy.engine.actionCodes.ScriptingActionCodeI.executeCodewithRSet(ScriptingActionCodeI.java:152)

 at com.indy.engine.actionCodes.ScriptingActionCodeI.executeSimpleCode(ScriptingActionCodeI.java:229)

 at com.indy.engine.manager.ActionCodeExecutor.executeCode(ActionCodeExecutor.java:140)

 at com.indy.engine.manager.ActionCodeExecutor.run(ActionCodeExecutor.java:267)

 at java.base/java.lang.Thread.run(Thread.java:829)

Caused by: File "<script>", line 12

    s = __ctx__.executeCommand(get sessions TEST_PROCESS_CONCURRENT status running)

                                  ^

SyntaxError: no viable alternative at input 'sessions'


 

 

 

 

Login to post a comment