예제 #1
0
def create_family_house_keeping():
    return Family("house_keeping",
                  Task("clear_log",
                       Cron("22:30", days_of_week=[0])))


def create_family_f3():
    return Family("f3",
                  Task("t1",
                       Label("info", "")))


print("Creating suite definition")
home = os.path.abspath(Path(Path(__file__).parent, "../../../build/course"))
defs = Defs(
    Suite('test',
          Edit(ECF_INCLUDE=home, ECF_HOME=home),
          create_family_f1(),
          create_family_house_keeping(),
          create_family_f3()))
print(defs)

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

print("Saving definition to file 'test.def'")
defs.save_as_defs(str(Path(home, "test.def")))

# To restore the definition from file 'test.def' we can use:
# restored_defs = ecflow.Defs("test.def")
예제 #2
0
prep_task = suite.add_task('prep_task')
prep_task.add_variable("PYSCRIPT", os.path.join(home, 'iprep_ecf.py'))
prep_task.add_variable("IO_LOCATION", "/home/michael/host_share/japan-io")
prep_task.add_variable("RUNOFF_LOCATION", "/home/michael/host_share/ecmwf")

suite += create_ensemble_family()

plain_table_task = suite.add_task('plain_table_task')
plain_table_task.add_trigger("ensemble_family == complete")
plain_table_task.add_variable("PYSCRIPT",
                              os.path.join(home, 'spt_extract_plain_table.py'))
plain_table_task.add_variable("OUT_LOCATION",
                              "/home/michael/host_share/japan-io/output")
plain_table_task.add_variable(
    "LOG_FILE", os.path.join(home, 'run_rapid/ecf_out/plain_table.log'))
plain_table_task.add_variable("NCES_EXEC",
                              "/home/michael/miniconda3/envs/ecflow/bin/nces")

print(defs)

print("check trigger expressions")
check = defs.check()
assert len(check) == 0, check

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

print("Saving definition to file 'run_rapid.def'")
defs.save_as_defs("run_rapid.def")