ecFlow's documentation is now on readthedocs!
Let’s add another task named t2.
You will need to modify the suite definition file and add a new script.

You must also create a file t2.ecf in $HOME/course/test. Simply copy t1.ecf.

First, modify the suite definition



It is good practice to suspend your suite before you reload any part of it.
In ecflow_ui right click on the suite and select “Suspend”.
Once you made your change(specified below) you can right-click on the suite and “Resume” it.
# Definition of the suite test
suite test
   edit ECF_HOME "$HOME/course"  # replace '$HOME' with the path to your home directory
   task t1
   task t2

As before replace $HOME with the real path to your home directory.

Then you must load the file again:
ecflow_client --load=test.def
This will fail because the suite is already loaded

Because the suite is already defined, you need to delete and reload it first:

ecflow_client --delete=_all_
ecflow_client --load=test.def

Then restart the suite:

 ecflow_client --begin=test

Rather than deleting, loading and beginning the suite every time you can replace
all or part of the suite for example to replace whole suite.

 ecflow_client --replace=/test test.def

or to replace part of the suite:

 ecflow_client --replace=/test/t2 test.def


To delete the suite definition, reload and begin using the Client Server API: First update to add task t2

import os
from ecflow import Defs,Suite,Task,Edit
print("Creating suite definition")
home = os.path.join(os.getenv("HOME"),  "course")
defs = Defs( 

print("Checking job creation: .ecf -> .job0")

print("Saving definition to file 'test.def'")

To delete all suites in the server and reload the modified test.def, we could update

import ecflow 
print("Client -> Server: delete, then load a new definition")   
    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 around this we will
suspend the suite use the Client Server API:
Modify with:
import ecflow 
print("Client -> Server: replacing suite '/test' in the server, with a new definition")
    ci = ecflow.Client()
    ci.suspend("/test")              # so that we can resume manually in ecflow_ui
    ci.replace("/test", "test.def")  # replace suite /test with suite of same name in test.def
except RuntimeError as e:
    print("Failed:",   e) 

For brevity the examples that follow, will not show the loading of the suite.

What to do

  1. Suspend the suite using ecflow_ui or via python by modifying your to add ecflow.Client.suspend
  2. Create a new task
  3. Create t2.ecf by copying from t1.ecf
  4. Update python scripts and or test.def
  5. Replace the suite
    python: python3     |  ./
                  python3  |  ./
    text:      ecflow_client --replace=/test test.def
  6. Resume the suite using ecflow_ui
  7. In ecflow_ui watch the two tasks running. They should run at the same time

1 Comment

  1. Unknown User (ma0)

    Since replacing the node is such a common task, you can use a convenience function in, to avoid having to call

    replace on server
    defs.test.replace_on_server()   # assumes you have exported ECF_HOST and ECF_PORT

    Alternatively you can specify the host and port directly:

    defs.test.replace_on_server("localhost",str(os.getuid()+1500))  # here os.getuid()+1500 is the port number and mimick's what uses

    The default is to suspend the port being replaced first. This can be bypassed.