...
Horizontal Navigation Bar | ||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
In this exercise, we will use one of the command-line features of ecflow.
We will use query command, to determine the state of a node, event, meter. An alternative to the query command would be to use the python api.API.
The general format is:
Code Block | ||||
---|---|---|---|---|
| ||||
ecflow_client --query arg1 arg2 arg3 |
Where:
- arg1 = [ state | event | meter | label | variable | trigger | limit | limit_max ]
- arg2 = <path> | <path>:name where name is name of a event, meter,limit or variable
- arg3 = trigger expression (optional) | prev | next # prev,next only used when arg1 is repeat
Here are some examples using the query command:
- state=$(ecflow_client --query state /path/to/node) # return node state to standard outstate
- dstate=$(ecflow_client --query dstate /path/to/node) # state that can includes suspended
value=$(ecflow_client --query repeat /path/to/node ) # return the current value as a string
value=$(ecflow_client --query repeat /path/to/node prev prev ) # # return the previous value as a string, does not modify real repeat
value=$(ecflow_client --query repeat /path/to/node next) # return the next value as a string, does not modify real repeat
- event=$(ecflow_client --query event /path/to/task/with/event:event_name) # return set | clear to standard out
- meter=$(ecflow_client --query meter /path/to/task/with/meter:meter_name) # returns the current value of the meter to standard outmeter
- value=$(ecflow_client --query variable /path/to/task/with/var:var_name ) # returns the variable value to standard out
limit_value=$(ecflow_client --query limit /path/to/task/with/limit:limit_name) # returns the current value of the limit to standard outlimit
limit_max=$(ecflow_client --query limit_max /path/to/task/with/limit:limit_name) # returns the max value of the limit to standard outlimit
- label_value=$(ecflow_client --query label %ECF_NAME%:label_name) # returns the current value of the label to standard outlabel
- value=$(ecflow_client --query trigger /path/to/node/with/trigger \"/suite/task == complete\") # return true if expression evaluates false otherwise
The general format is:
Code Block |
---|
ecflow_client --query arg1 arg2 arg3 |
Where:
- arg1 = [ state | event | meter | label | variable | trigger | limit | limit_max ]
- arg2 = <path> | <path>:name where name is name of a event, meter,limit or variable
- arg3 = trigger expression (optional) | prev | next # prev,next only used when arg1 is repeat
Ecf Script
We will create new query .task
Code Block | ||||
---|---|---|---|---|
| ||||
%include <head.h> meter=$(ecflow_client --query meter /test/f1/t1:progress) while [[ $meter -lt 100 ]] do sleep 2 meter=$(ecflow_client --query meter /test/f1/t1:progress) eventa=$(ecflow_client --query event /test/f1/t2:a) eventb=$(ecflow_client --query event /test/f1/t2:b) t5_state=$(ecflow_client --query state /test/f1/t5) ecflow_client --label=query "meter($meter) eventa($eventa) eventb($eventb) t5_state($t5_state)" done %include <tail.h> |
...
What to do
- Go back to the previous exercise where we finished adding a meter.
- Edit the definition file or python to add the modifications. You should only need to add a task query.
- create file query.ecf to call ecflow_client –meter –query
- Replace the suite
python: python3 test.py ; python3 client.py
text: ecflow_client --suspend=/test ; ecflow_client --replace=/test test.def - Observe the tasks in ecflow_ui
Modify query.ecf, to use ecflow_client --query variable, and show this variable in the query label.
Note Although a variable is accessible in the script by using %VAR%, ecflow_client --query variable might be more useful in an interactive shell or a different server
Horizontal Navigation Bar | ||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
...