...
Here is the previous example using the with statement:
Code Block |
---|
language | py |
---|
title | Using With |
---|
|
#!/usr/bin/env python2.7
|
...
from ecflow import Defs,Suite,Family,Task,Edit,Trigger,Complete,Event,Meter,Time,Day,Date
import |
...
os
import sys
version = sys.version_info |
...
if version[1] < 7:
print "This example requires python version 2.7, but found : " + str(version)
exit(0)
print "Creating suite definition"
with |
...
Defs() as defs:
with defs.add_suite("test") as suite:
suite |
...
+= Edit(ECF_HOME=os.path.join(os.getenv("HOME"), |
...
...
+= Edit(ECF_INCLUDE =os.path.join(os.getenv("HOME"), |
...
...
with suite.add_family("f1") as f1:
f1 |
...
...
...
, Meter("progress", 1, 100, 90))
f1 |
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
, Trigger("t1:progress ge 30")) |
...
...
...
, Trigger("t1:progress ge 60") |
...
...
...
, Trigger("t1:progress ge 90")) |
...
...
...
with suite.add_family("f2") as f2:
f2 |
...
...
...
, Time("00:30 23:30 00:30"))
f2 |
...
...
...
...
...
...
...
...
...
...
...
...
...
("Checking job creation: .ecf -> .job0" |
...
)
print(defs.check_job_creation())
|
...
...
("Checking trigger expressions")
|
...
...
...
...
("Saving definition to file 'test.def'")
|
...
defs.save_as_defs("test.def") |
Horizontal Navigation Bar |
---|
Button Group |
---|
Button Hyperlink |
---|
title | Previous |
---|
type | standard |
---|
url | https://software.ecmwf.int/wiki/display/ECFLOW/Time+Dependencies |
---|
|
Button Hyperlink |
---|
title | Up |
---|
type | standard |
---|
url | https://software.ecmwf.int/wiki/display/ECFLOW/Going+Further |
---|
|
Button Hyperlink |
---|
title | Next |
---|
type | standard |
---|
url | https://software.ecmwf.int/wiki/display/ECFLOW/Advanced+Topics |
---|
|
|
|
...