...
Python
To delete the suite definition, reload and begin using the Client Server API: First update test.py to add task t2
Code Block | ||||
---|---|---|---|---|
| ||||
import os from ecflow import Defs,Suite,Task,Edit print("Creating suite definition") home = os.path.join(os.getenv("HOME"), "course") defs = Defs( Suite('test', Edit(ECF_HOME=home), Task('t1'), Task('t2'))) print(defs) print("Checking job creation: .ecf -> .job0") print(defs.check_job_creation()) print("Saving definition to file 'test.def'") defs.save_as_defs("test.def") |
To delete all suites in the server and reload modified test.def, we could update client.py
Code Block | ||||
---|---|---|---|---|
| ||||
import ecflow print("Client -> Server: delete, then load a new definition") try: ci = ecflow.Client() ci.delete_all() # clear out the server ci.load("test.def") # load the definition into the server ci.begin_suite("test") # start the suite except RuntimeError as e: print("Failed:", e) |
Rather than deleting, loading and beginning the suite every time you can replace
all or part of the suite. (i.e. to replace the whole suite see below)
Additionally we do not want the suite to start straight away. This can be done
by suspending the suite in ecflow_ui before reloading.
However we will need to remember to do this, each time. To get round this we will
suspend the suite use the Client Server API:
Modify client.py with:
Code Block | ||||
---|---|---|---|---|
| ||||
import ecflow print("Client -> Server: replacing suite '/test' in the server, with a new definition") try: ci = ecflow.Client() ci.suspend("/test") # so that we can resume manually in ecflow_ui ci.replace("/test", "test.def") except RuntimeError as e: print "Failed:", e |
Note |
---|
For brevity the examples that follow, will not show the loading of the suite. |
What to do
- Suspend the suite using ecflow_ui or via python by modifying your client.py to add ecflow.Client.suspend
- Create the new task
- Create t2.ecf by copying from t1.ecf
- Update python scripts test.py and client.py or test.def
- Replace the suite
python: python test.py
python | python3 test.py | ./test.py
python client.py | python3 client.py | ./client.py
text: ecflow_client --replace=/test test.def - Resume the the suite using ecflow_ui
- In ecflow_ui watch the two task running. They should run at the same time
...