Late
Sometimes tasks do not complete in an expected time constrait, and the user needs to be notificatied. This notification can be performed by using late attribute.
Each node can only have one late attribute, and late attributes only apply to tasks. When a late attribute is defined on a suite or family, it will be inherited; and, any late attribute defined lower down the hierarchy will override the aspect (submitted, active, complete) defined higher up.
A late attribute defines time constraints for a task to be: submitted, active or complete.
-ssubmitted: The amount of time the node can stay submitted (format[+]hh:mm). The time value is always relative, so+is simply ignored, if present. The late flag is set if the node stays submitted longer than the specified amount of time.-aactive: The time of day the node must have become active (formathh:mm). The late flag is set if the node is still queued or submitted after the specified time.-ccomplete: The amount of time node can take to become complete (format[+]hh:mm). If relative, the amount of time that the node can take to complete since becoming active; otherwise, the node must be complete by the specified time.
task t1
late -s +00:15 -a 20:00 -c +02:00
The late in the example above is interpreted as:
the node can stay submitted for a maximum of 15 minutes
and it must become active by 20:00
and the runtime must not exceed 2 hours.
For the purposes of this tutorial, the late attribute will apply a contraint to the runtime only.
Suite Definition
Modify the suite definition file, as follows:
# Definition of the suite test.
suite test
edit ECF_INCLUDE "$HOME/course" # replace $HOME with the path to your home directory
edit ECF_HOME "$HOME/course"
family f6
edit SLEEP 120
task t1
late -c +00:01 # set late flag if task take longer than a minute
endfamily
endsuite
import os
from ecflow import (
Defs,
Suite,
Family,
Task,
Edit,
Trigger,
Complete,
Event,
Meter,
Time,
Day,
Date,
Label,
RepeatString,
RepeatInteger,
RepeatDate,
InLimit,
Limit,
Late,
)
def create_family_f6():
return Family(
"f6", Edit(SLEEP=120), Task("t1", Late(complete="+00:01"))
) # set late flag if task t1 takes longer than a minute
print("Creating suite definition")
home = os.path.join(os.getenv("HOME"), "course")
defs = Defs(Suite("test", Edit(ECF_INCLUDE=home, ECF_HOME=home), create_family_f6()))
print(defs)
print("Checking job creation: .ecf -> .job0")
print(defs.check_job_creation())
print("Checking trigger expressions")
assert len(defs.check()) == 0, defs.check()
print("Saving definition to file 'test.def'")
defs.save_as_defs("test.def")
Task Script
Create new task script file $HOME/course/test/f6/t1.ecf, related to the new task.
%include <head.h>
echo "I will now sleep for %SLEEP% seconds"
sleep %SLEEP%
%include <tail.h>
What to do
Apply the changes to suite definition.
Create the new task script file as shown above.
In the ecflow_ui, run the suite and observer the late flag being set
When the job completes, requeue the family
f6or taskt1, and observe that this clears the late flag.In the ecflow_ui, the late flag can also be cleared manually, by selecting task
t1, and then in the Right Mouse Button context menu, select Special, and Clear late flag.