Horizontal Navigation Bar |
---|
Button Group |
---|
Button Hyperlink |
---|
title | Previous |
---|
type | standard |
---|
url | https://confluence.ecmwf.int/display/ECFLOW/Add+a+Cron |
---|
|
Button Hyperlink |
---|
title | Up |
---|
type | standard |
---|
url | https://confluence.ecmwf.int/display/ECFLOW/Advanced+Topics |
---|
|
Button Hyperlink |
---|
title | Next |
---|
type | standard |
---|
url | https://confluence.ecmwf.int/display/ECFLOW/Query+state |
---|
|
|
|
Some time it is very useful to see task-specific information in ecflow_uiFor this, we can define a label. A label is a string that is attached to a task
Ecf Script
We will create a new family label with a task t1.
Code Block |
---|
language | bash |
---|
title | $HOME/course/test/label/t1.ecf |
---|
|
%include <head.h>
n=1
while [[ $n -le 5 ]] |
...
...
...
...
...
...
...
...
now $(date)"
ecflow_client |
...
--label=info "$msg" # Set the label
sleep 60 |
...
...
...
...
...
...
...
...
...
...
...
...
...
1 ))
done
ecflow_client --label=info "I have now finished my work."
%include <tail.h> |
Text
Code Block |
---|
# Definition of the suite test. Note Family f1,f2 from previous pages are omitted
suite test
edit ECF_INCLUDE "$HOME/course"
edit ECF_HOME "$HOME/course"
family label
task t1
label info ""
endfamily
endsuite |
Python
The following section shows how to add an ecflow.Label in python: ( Note: families f1 and f2 are omitted for brevity)
Code Block |
---|
language | py |
---|
title | $HOME/course/test.py |
---|
|
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
- Modify the suite definition file or python script
- Create the new ecf script file $HOME/course/test/label/t1.ecf
- Replace the suite definition
- Watch in ecflow_ui
- Change the label colour in ecflow_ui, Tools->Preferences...→Appearance->Node Labels
Horizontal Navigation Bar |
---|
Button Group |
---|
Button Hyperlink |
---|
title | Previous |
---|
type | standard |
---|
url | https://confluence.ecmwf.int/display/ECFLOW/Add+a+Cron |
---|
|
Button Hyperlink |
---|
title | Up |
---|
type | standard |
---|
url | https://confluence.ecmwf.int/display/ECFLOW/Advanced+Topics |
---|
|
Button Hyperlink |
---|
title | Next |
---|
type | standard |
---|
url | https://confluence.ecmwf.int/display/ECFLOW/Query+state |
---|
|
| endsuite</pre>
</div>
<p>The following section shows how to add a <tt ><span >ecflow.Label</span></tt> in python:</p>
<div ><div ><pre><span >#!/usr/bin/env python2.5</span>
<span >import</span> <span >os</span>
<span >import</span> <span >ecflow</span>
<span >def</span> <span >create_family_f3</span><span >():</span>
<span >f3</span> <span >=</span> <span >ecflow</span><span >.</span><span >Family</span><span >(</span><span >"f3"</span><span >)</span>
<span >t1</span> <span >=</span> <span >f3</span><span >.</span><span >add_task</span><span >(</span><span >"t1"</span><span >)</span>
<span >t1</span><span >.</span><span >add_label</span><span >(</span><span >"info"</span><span >,</span><span >""</span><span >);</span>
<span >return</span> <span >f3</span>
<span >defs</span> <span >=</span> <span >ecflow</span><span >.</span><span >Defs</span><span >()</span>
<span >suite</span> <span >=</span> <span >defs</span><span >.</span><span >add_suite</span><span >(</span><span >"test"</span><span >)</span>
<span >suite</span><span >.</span><span >add_variable</span><span >(</span><span >"ECF_INCLUDE"</span><span >,</span><span >os</span><span >.</span><span >getenv</span><span >(</span><span >"HOME"</span><span >)</span> <span >+</span> <span >"/course"</span><span >)</span>
<span >suite</span><span >.</span><span >add_variable</span><span >(</span><span >"ECF_HOME "</span><span >,</span><span >os</span><span >.</span><span >getenv</span><span >(</span><span >"HOME"</span><span >)</span> <span >+</span> <span >"/course"</span><span >)</span>
<span >suite</span><span >.</span><span >add_family</span><span >(</span> <span >create_family_f3</span><span >()</span> <span >)</span>
</pre></div>
</div>
<p>We now need to edit the <a href="/wiki/display/ECFLOW/Glossary#term-ecf-script"><em >ecf script</em></a> file <tt ><span >$HOME/course/test/f3/t1.ecf</span></tt>:</p>
<div ><pre>%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 60 # Wait a one minute
(( n = $n + 1 ))
done
ecflow_client --label info "I have now finished my work."
%include <tail.h></pre>
</div>
<p>What to do:</p>
<ol >
<li>Modify the <a href="/wiki/display/ECFLOW/Glossary#term-suite-definition"><em >suite definition</em></a> file or python script</li>
<li>Edit the new <a href="/wiki/display/ECFLOW/Glossary#term-ecf-script"><em >ecf script</em></a></li>
<li>Load the <a href="/wiki/display/ECFLOW/Glossary#term-suite-definition"><em >suite definition</em></a> file and begin the <a href="/wiki/display/ECFLOW/Glossary#term-suite"><em >suite</em></a></li>
<li>Watch in <a href="/wiki/display/ECFLOW/Glossary#term-ecflowview"><em >ecflowview</em></a></li>
</ol>
</div>
|