Task("t1"),  # first task
        Task("t2"),  # second task
    ))
SCRIPT_TEMPLATE = """%manual
  Manual for task t2
  Operations: if this task fails, set it to complete, report next working day
  Analyst:    Check something ...
%end
%include <head.h>
echo "I am part of a suite that lives in %ECF_HOME%"
%include <tail.h>

%manual
  There can be multiple manual pages in the same file.
  When viewed they are simply concatenated.
%end
"""

if __name__ == '__main__':
    # create script template file
    with open(ECF_HOME + "/files/t2.ecf", "w") as t2:
        print(SCRIPT_TEMPLATE, file=t2)

    HOST = os.getenv("ECF_HOST", "localhost")
    PORT = int(os.getenv("ECF_PORT", "%d" % (1500 + os.getuid())))
    CLIENT = Client(HOST, PORT)

    NODE = "/%s/t2" % NAME  # this may be a family, a task path
    CLIENT.replace(NODE, DEFS)
    print("replaced node %s into" % NODE, HOST, PORT)
Example #2
0
            Task("t3").add(
                Time("12:00"),
                Date("1.*.*")),
            Task("t4").add(
                Time("+00:02")),
            Task("t5").add(
                Time("00:02"))))


if __name__ == "__main__":
    SUITE = create()
    if True:
        import fif
        import el52_block_case as case
        import el53_block_daily as daily
        import el54_block_for as ffor
        SUITE.add(
            Family("visualise").add(
                fif.family_if(),
                case.family_case(),
                daily.process(),
                ffor.family_for()))
    DEFS = Defs()
    DEFS.add_suite(SUITE)
    CLIENT = Client(os.getenv("ECF_HOST", "localhost"),
                           os.getenv("ECF_PORT", 2500))
    DEFS.generate_scripts()
    RESULT = DEFS.simulate(); # print(RESULT)
    NODE = '/' + SUITE.name()
    CLIENT.replace("/%s" % NODE, DEFS)
Example #3
0
   ecflow_client --abort=trap  # Notify ecFlow that something went
                               # wrong, using 'trap' as the reason
   trap 0                      # Remove the trap
   exit 0                      # End the script
}

# Trap any calls to exit and errors caught by the -e flag
trap ERROR 0

# Trap any signal that may cause the script to fail
trap '{ echo "Killed by a signal"; ERROR ; }' 1 2 3 4 5 6 7 8 10 12 13 15"""
deploy(head, include + "head.h")

#####################################################################
tail = """wait            # wait for background process to stop
ecflow_client --complete  # Notify ecFlow of a normal end
trap 0                    # Remove all traps
exit 0                    # End the shell"""
deploy(tail, include + "tail.h")

#####################################################################
# loading a node into ecflow server
defs = Defs()
defs.add_suite(suite)
HOST = os.getenv("ECF_HOST", "localhost")
PORT = os.getenv("ECF_PORT", "2500")
client = Client(HOST, PORT)
path = '/%s' % suite.name() 
client.replace(path, defs)
print("#\n#MSG: node", path, "is now replaced on", HOST, PORT)