Adding a label
It is very useful to see task specific information in the ecflow_ui. This can be achieved by defining
a label, i.e. a string that is attached to a task, and that can be populates using the
child command ecflow_client --label.
Update Task Script
To create a new family label with a task t1, start by creating the task script at $HOME/course/test/label/t1.ecf
%include <head.h>
n=1
while [[ $n -le 5 ]] # Loop 5 times
do
msg="The date is now $(date)"
ecflow_client --label=info "$msg" # Set the label
sleep 30 # Wait half a minute
(( n = $n + 1 ))
done
ecflow_client --label=info "Job is done!" # Set the final label
%include <tail.h>
Update Suite Definition
Update the suite definition file to add the new family label and task t1.
suite test
edit ECF_INCLUDE "{{HOME}}/course" # replace '$HOME' appropriately
edit ECF_HOME "{{HOME}}/course"
[... previous families omitted for brevity ..]
family label
task t1
label info ""
endfamily
endsuite
The following example shows how to add a ecflow.Label in Python. (Note: families f1 and f2 are omitted for brevity).
import os
from ecflow import (
Defs,
Suite,
Family,
Task,
Edit,
Trigger,
Complete,
Event,
Meter,
Time,
Day,
Date,
Label,
)
def create_family_label():
return Family("label", Task("t1", Label("info", "")))
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_label()))
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")
What to do
Create the new task script file, as shown above.
Modify the suite definition to include the new family and task, as shown above.
Replace the suite, using:
ecflow_client --suspend /test ecflow_client --replace /test test.def
python3 test.py python3 client.py
Observer the label change using the ecflow_ui.
Customise the label colouring in ecFlowUI, at Tools > Preferences… > Appearance > Node Labels