...
Python
checking can save a lot of time.
The following points should be noted about about job creation checking:
Hence ECF_PORT and ECF_HOST in the
job file will have default values.
Job files have a .job0 extension, whereas the server will always generate jobs with a extension .job<1-n>, i.e. t1.job1, t1.job2.
The numbers correspond to
ECF_TRYNO which is never zero.
Checking is done using ecflow.Defs.check_job_creation
Update $HOME/course/test.py with:
Code Block |
---|
language | py |
---|
title | $HOME/course/test.py |
---|
|
#!/usr/bin/env python2.7
import os
|
importfrom ecflow import Defs,Suite,Task,Edit
print "Creating suite definition" |
defsecflow.Defs()
suite = defs.add_suite("test")
suite.add_variable("ECF_HOME", os.path.join(os.getenv("HOME"), "course")
defs = Defs(
Suite('test',
Edit(ECF_HOME=home) |
suite.add_task("t1",
Task('t1')))
print defs
print "Checking job creation: .ecf -> .job0"
print defs.check_job_creation()
# We can assert, so that we only progress |
, all job creation works
# assert len(defs.check_job_creation()) == 0, "Job generation failed |
"
Note |
---|
It is highly advisable that job creation checking is enabled for all subsequent examples. |
What to do
- Add job creation checking to $HOME/course/test.py
- Examine the job file
$HOME/course/test/t1.job0
...