<div class="section" id="labels">
<span id="index-0"></span><span id="id1"></span>
<div class="line-block">
<div class="line">Sometime it is very useful to see <a class="reference internal" href="/wiki/display/ECFLOW/Glossary#term-task"><em class="xref std std-term">task</em></a> specific information in <a class="reference internal" href="/wiki/display/ECFLOW/Glossary#term-ecflowview"><em class="xref std std-term">ecflowview</em></a>.</div>
<div class="line">For this we can define a <a class="reference internal" href="/wiki/display/ECFLOW/Glossary#term-label"><em class="xref std std-term">label</em></a>. A <a class="reference internal" href="/wiki/display/ECFLOW/Glossary#term-label"><em class="xref std std-term">label</em></a> is a string that is attached to a <a class="reference internal" href="/wiki/display/ECFLOW/Glossary#term-task"><em class="xref std std-term">task</em></a></div>
<div class="line">and that can be updated using the <a class="reference internal" href="/wiki/display/ECFLOW/Glossary#term-child-command"><em class="xref std std-term">child command</em></a> <a class="reference internal" href="/wiki/display/ECFLOW/Glossary#term-ecflow-client"><em class="xref std std-term">ecflow_client</em></a> –label</div>
</div>
<div class="section" id="ecf-script">
<h2>Ecf Script<a class="headerlink" href="#ecf-script" title="Permalink to this headline">¶</a></h2>
<div class="line-block">
<div class="line">We will create new family f3 with a task t1.</div>
<div class="line">Create <a class="reference internal" href="/wiki/display/ECFLOW/Glossary#term-ecf-script"><em class="xref std std-term">ecf script</em></a> <tt class="file docutils literal"><span class="pre">$HOME/course/test/f3/t1.ecf</span></tt></div>
</div>
<div class="highlight-python"><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>
</div>
<div class="section" id="text">
<h2>Text<a class="headerlink" href="#text" title="Permalink to this headline">¶</a></h2>
<div class="highlight-python"><pre># 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 f3
task t1
label info ""
endfamily
endsuite</pre>
</div>
</div>
<div class="section" id="python">
<h2>Python<a class="headerlink" href="#python" title="Permalink to this headline">¶</a></h2>
<p>The following section shows how to add a <a class="reference internal" href="/wiki/display/ECFLOW/ecFlow+Python+Api#ecflow.Label" title="ecflow.Label"><tt class="xref py py-class docutils literal"><span class="pre">ecflow.Label</span></tt></a> in python:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="c">#!/usr/bin/env python2.7</span>
<span class="kn">import</span> <span class="nn">os</span>
<span class="kn">import</span> <span class="nn">ecflow</span>
<span class="k">print</span> <span class="s">"Creating suite definition"</span>
<span class="n">defs</span> <span class="o">=</span> <span class="n">ecflow</span><span class="o">.</span><span class="n">Defs</span><span class="p">()</span>
<span class="n">suite</span> <span class="o">=</span> <span class="n">defs</span><span class="o">.</span><span class="n">add_suite</span><span class="p">(</span><span class="s">"test"</span><span class="p">)</span>
<span class="n">suite</span><span class="o">.</span><span class="n">add_variable</span><span class="p">(</span><span class="s">"ECF_INCLUDE"</span><span class="p">,</span> <span class="n">os</span><span class="o">.</span><span class="n">getenv</span><span class="p">(</span><span class="s">"HOME"</span><span class="p">)</span> <span class="o">+</span> <span class="s">"/course"</span><span class="p">)</span>
<span class="n">suite</span><span class="o">.</span><span class="n">add_variable</span><span class="p">(</span><span class="s">"ECF_HOME"</span><span class="p">,</span> <span class="n">os</span><span class="o">.</span><span class="n">getenv</span><span class="p">(</span><span class="s">"HOME"</span><span class="p">)</span> <span class="o">+</span> <span class="s">"/course"</span><span class="p">)</span>
<span class="n">suite</span><span class="o">.</span><span class="n">add_family</span><span class="p">(</span><span class="s">"f3"</span><span class="p">)</span><span class="o">.</span><span class="n">add_task</span><span class="p">(</span><span class="s">"t1"</span><span class="p">)</span><span class="o">.</span><span class="n">add_label</span><span class="p">(</span><span class="s">"info"</span><span class="p">,</span><span class="s">""</span><span class="p">)</span>
<span class="k">print</span> <span class="n">defs</span>
<span class="k">print</span> <span class="s">"Checking job creation: .ecf -> .job0"</span>
<span class="k">print</span> <span class="n">defs</span><span class="o">.</span><span class="n">check_job_creation</span><span class="p">()</span>
<span class="k">print</span> <span class="s">"Saving definition to file 'test.def'"</span>
<span class="n">defs</span><span class="o">.</span><span class="n">save_as_defs</span><span class="p">(</span><span class="s">"test.def"</span><span class="p">)</span>
</pre></div>
</div>
<p><strong>What to do:</strong></p>
<ol class="arabic simple">
<li>Modify the <a class="reference internal" href="/wiki/display/ECFLOW/Glossary#term-suite-definition"><em class="xref std std-term">suite definition</em></a> file or python script</li>
<li>Create the new <a class="reference internal" href="/wiki/display/ECFLOW/Glossary#term-ecf-script"><em class="xref std std-term">ecf script</em></a> file <tt class="file docutils literal"><span class="pre">$HOME/course/test/f3/t1.ecf</span></tt></li>
<li>Replace the <a class="reference internal" href="/wiki/display/ECFLOW/Glossary#term-suite-definition"><em class="xref std std-term">suite definition</em></a></li>
<li>Watch in <a class="reference internal" href="/wiki/display/ECFLOW/Glossary#term-ecflowview"><em class="xref std std-term">ecflowview</em></a></li>
</ol>
</div>
</div>
|