...
Horizontal Navigation Bar |
---|
Button Group |
---|
Button Hyperlink |
---|
title | Previous |
---|
type | standard |
---|
url | https://softwareconfluence.ecmwf.int/wiki/display/ECFLOW/Understanding+the+client |
---|
|
Button Hyperlink |
---|
title | Up |
---|
type | standard |
---|
url | https://softwareconfluence.ecmwf.int/wiki/display/ECFLOW/Tutorial |
---|
|
Button Hyperlink |
---|
title | Next |
---|
type | standard |
---|
url | https://softwareconfluence.ecmwf.int/wiki/display/ECFLOW/Starting+the+suite |
---|
|
|
|
The next step is to let ecflow_server know about your suite or to “load” the suite definition file.
This checks the file test.def and describes the suite to the ecflow_server.
This can be done in several ways, depending on how the suite was created.
...
Note |
---|
Choose between the two methods below, to avoid errors associated with loading suite definition twice. |
...
Text
From within the course directory do the following from the unix UNIX shell:
Code Block |
---|
|
ecflow_client --load=test.def |
If the check fails, the suite is not loaded.
You will have already seen ecflow_client being used in head.h and tail.h include files.
Note |
---|
Please ensure you have exported ECF_PORT, alternatively use --port <port_number> on the command line. |
Python
We can ask the python script to write out the defs as ‘.def’ definition file
#!/usr/bin/env python2.7
Code Block |
---|
language | py |
---|
title | $HOME/course/test.py |
---|
|
import os
|
importfrom ecflow import Defs,Suite,Task,Edit
print |
("Creating suite definition")
home = os.path.join(os.getenv("HOME"), "course")
defs = |
ecflow.)
suite = defs.add_suite("test")
suite.add_variable("ECF_HOME", os.getenv("HOME") + "/course")
suite.add_task("t1")
print defs
print
Suite('test',
Edit(ECF_HOME=home),
Task('t1')))
print(defs)
print("Checking job creation: .ecf -> .job0" |
(defs.check_job_creation())
print |
("Saving definition to file 'test.def'")
defs.save_as_defs("test.def")
# To restore the definition from file 'test.def' we can use:
# restored_defs = ecflow.Defs("test.def") |
If you called “defs.save_as_defs()” the file test.def will be written.
This can be loaded in the server as described earlier. (See Text)
try:
print ("Load the in memory definition(defs) into the server")
ci = ecflow.Client();
ci.load(defs) # load the in memory python definition(def) into server
except RuntimeError, as e:
print ("Failed: " + str(,e);
However, it is recommended that the building of the suite definition is separated
from loading it into the server. The loading should be placed into a file. client.py.
#!/usr/bin/env python2.7
import ecflow
Code Block |
---|
language | py |
---|
title | $HOME/course/client.py |
---|
|
import ecflow
try:
print |
("Loading definition in 'test.def' into the server")
ci = ecflow.Client() |
;
ci.load("test.def") # read definition from disk and load into the server
except RuntimeError |
, "+str(;
If everything is OK, you should have defined a suite in the server.
Have a look in the window running the ecflow_server, and look at the log file
What to do
- Load the definition file. Choose between loading as a text file, or using python api.API (Update $HOME/course/test.py to write out the definition to disk)
- If using python, examine test.def and create the file client.py.
- Check the log file.
You cannot use the load command IF the suite exists: If you encounter errors associated with loading the suite twice, then you can delete all the suites 'test' suite in the server.
Code Block |
---|
ecflow_client --delete=_all_ |
If the suite exists on the server: The definition can then be re-loaded part or all of the suite.
Alternatively you can use replace a suite or any node, please You need to be careful if the suite is set up to run automatically.
The replace command is used to re-load part or all of the suite. Please type the following for help on replace.
Code Block |
---|
ecflow_client --help replace
ecflow_client --replace=/test test.def # e.g. to replace the whole suite
ecflow_client --replace=/test/t1 test.def # or just the one task |
Horizontal Navigation Bar |
---|
Button Group |
---|
Button Hyperlink |
---|
title | Previous |
---|
type | standard |
---|
url | https://softwareconfluence.ecmwf.int/wiki/display/ECFLOW/Understanding+the+client |
---|
|
Button Hyperlink |
---|
title | Up |
---|
type | standard |
---|
url | https://softwareconfluence.ecmwf.int/wiki/display/ECFLOW/Tutorial |
---|
|
Button Hyperlink |
---|
title | Next |
---|
type | standard |
---|
url | https://softwareconfluence.ecmwf.int/wiki/display/ECFLOW/Starting+the+suite |
---|
|
|
|
...