Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

The notebook code can be downloaded.

Code Block
languagepy
import pyflow as p

home = os.getenv("HOME") + "/eflow_server"
user = os.getenv("USER")
with p.Suite("lorenz", 
             ECF_HOME=home, ECF_INCLUDE=home, ECF_FILES=home, ECF_OUT=home, 
             ECF_EXTN=".ecf", USER=user, SCHOST="localhost",
             ECF_JOB_CMD="/home/ma/emos/bin/trimurti %USER% %SCHOST% %ECF_JOB% %ECF_JOBOUT%") as suite:
    p.Defstatus("suspended")
    with p.Family("course2018"):
        with p.Task("compute"):
            p.Script("python <<@@\n" + script + "\n@@")  # import script
        with p.Family("multi"):  # once imported, alter script, run multiple tasks
            for num in xrange (1,5):
                with p.Task("compute%d" % num):
                     p.Script("python <<@@\n" +  # a better choice may will be using ecflow variable
                         script.replace("[1.0, 1.0, 1.0]",
                                        "[%d.0, %d.0, 1.0]" % (num, num)) + "\n@@") 
suite.deploy_suite(overwrite=True)  # create task template files
suite.replace_on_server("localhost:2500") # replace the suite in the server

...

View file
nameecflow-jupyter-2018.ipynb
height250

Code Block
languagepy
jupyter notebook ecflow-jupyter-2018.ipynb

The following notebook is closer to the tutorial, with head.h, tail.h and task template managed directly by the designer.


Code Block
languagepy
import ecf
from ecf import *

home = os.getenv("HOME") + "/ecflow_server"
user = os.getenv("USER")

node = Suite("lorenz").add(
    Defstatus("suspended"),
    ecf.Edit(ECF_HOME=home, ECF_INCLUDE=home + "/include", ECF_FILES=home + "/files",
             ECF_OUT=home, 
             ECF_EXTN=".ecf", USER=user, SCHOST="localhost",
 ECF_JOB_CMD="/home/ma/emos/bin/trimurti %USER% %SCHOST% %ECF_JOB% %ECF_JOBOUT%"),
    ecf.Family("ecf").add(
            Task("compute").add(),
        
    ecf.Family("multi").add(  # once imported, alter script, run multiple tasks
           [ecf.Family("%02d" % num).add(
              Edit(XYZ="[%d.0, %d.0, %d.0]" % (num, num, num)),
              Task("compute"))
            for num in xrange(0, 5)])))
client = ecf.Client("localhost@2500")
defs = ecf.Defs()
defs.add_suite(node)
client.replace("/lorenz", defs)


View file
nameecflow-jupyter-ecf-2018.ipynb
height250


Code Block
jupyter notebook ecflow-jupyter-ecf-2018.ipynb

...