Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 4.0
HTML
<div class="section" id="checking-job-creation">
<span id="index-0"></span><span id="id1"></span>
<p>In the previous section we have implemented our first task (the <tt class="file docutils literal"><span class="pre">t1.ecf</span></tt> file).</p>
<p>The t1.ecf script needs to be preprocessed to generate the <a class="reference internal" href="/wiki/display/ECFLOW/Glossary#term-job-file"><em class="xref std std-term">job file</em></a>.</p>
<p>This <a class="reference internal" href="/wiki/display/ECFLOW/Glossary#term-pre-processing"><em class="xref std std-term">pre-processing</em></a> is done automatically by <a class="reference internal" href="/wiki/display/ECFLOW/Glossary#term-ecflow-server"><em class="xref std std-term">ecflow_server</em></a> the when the task is about to run.</p>
<p>However it is possible to check the <a class="reference internal" href="/wiki/display/ECFLOW/Glossary#term-job-creation"><em class="xref std std-term">job creation</em></a> before the <a class="reference internal" href="/wiki/display/ECFLOW/Glossary#term-suite-definition"><em class="xref std std-term">suite definition</em></a>
is loaded into the <a class="reference internal" href="/wiki/display/ECFLOW/Glossary#term-ecflow-server"><em class="xref std std-term">ecflow_server</em></a>.</p>
<div class="section" id="text">
<h2>Text<a class="headerlink" href="#text" title="Permalink to this headline">¶</a></h2>
<p>Automated job creation checking is only available with Python.</p>
<p>If the <a class="reference internal" href="/wiki/display/ECFLOW/Glossary#term-ecflow-server"><em class="xref std std-term">ecflow_server</em></a> can&#8217;t locate the <a class="reference internal" href="/wiki/display/ECFLOW/Glossary#term-ecf-script"><em class="xref std std-term">ecf script</em></a>, please see <a class="reference internal" href="/wiki/display/ECFLOW/Glossary#term-ecf-file-location-algorithm"><em class="xref std std-term">ecf file location algorithm</em></a></p>
</div>
<div class="section" id="python">
<h2>Python<a class="headerlink" href="#python" title="Permalink to this headline">¶</a></h2>
<div class="line-block">
<div class="line">The process of <a class="reference internal" href="/wiki/display/ECFLOW/Glossary#term-job-creation"><em class="xref std std-term">job creation</em></a> can be checked before the <a class="reference internal" href="/wiki/display/ECFLOW/Glossary#term-suite-definition"><em class="xref std std-term">suite definition</em></a></div>
<div class="line">is loaded into the <a class="reference internal" href="/wiki/display/ECFLOW/Glossary#term-ecflow-server"><em class="xref std std-term">ecflow_server</em></a>. The following checks are done:</div>
</div>
<ul class="simple">
<li>Locating <a class="reference internal" href="/wiki/display/ECFLOW/Glossary#term-ecf-script"><em class="xref std std-term">ecf script</em></a> files, corresponding to the <a class="reference internal" href="/wiki/display/ECFLOW/Glossary#term-task"><em class="xref std std-term">task</em></a> in 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>Performing <a class="reference internal" href="/wiki/display/ECFLOW/Glossary#term-pre-processing"><em class="xref std std-term">pre-processing</em></a></li>
</ul>
<div class="line-block">
<div class="line">When the <a class="reference internal" href="/wiki/display/ECFLOW/Glossary#term-suite-definition"><em class="xref std std-term">suite definition</em></a> is large and has many <a class="reference internal" href="/wiki/display/ECFLOW/Glossary#term-ecf-script"><em class="xref std std-term">ecf script</em></a> this</div>
<div class="line">checking can save a lot of time.</div>
</div>
<p>The following point&#8217;s should be noted about about <a class="reference internal" href="/wiki/display/ECFLOW/Glossary#term-job-creation"><em class="xref std std-term">job creation</em></a> checking:</p>
<ul>
<li><div class="first line-block">
<div class="line">It is <strong>independent</strong> of the <a class="reference internal" href="/wiki/display/ECFLOW/Glossary#term-ecflow-server"><em class="xref std std-term">ecflow_server</em></a>.</div>
<div class="line">Hence ECF_PORT and ECF_NODE in the <a class="reference internal" href="/wiki/display/ECFLOW/Glossary#term-job-file"><em class="xref std std-term">job file</em></a> will have default values.</div>
</div>
</li>
<li><div class="first line-block">
<div class="line">Job filefiles have a <strong>.job0</strong> extension, whereas the server will always generate</div>
<div class="line">jobs with a extension <strong>.job&lt;1-n&gt;</strong>,  i.e t1.job1, t1.job2.</div>
<div class="line">The numbers correspond to <a class="reference internal" href="/wiki/display/ECFLOW/Glossary#term-ecf-tryno"><em class="xref std std-term">ECF_TRYNO</em></a> which is never zero.</div>
</div>
</li>
<li><div class="first line-block">
<div class="line">By default the <a class="reference internal" href="/wiki/display/ECFLOW/Glossary#term-job-file"><em class="xref std std-term">job file</em></a> is created in the same directory</div>
<div class="line">as the <a class="reference internal" href="/wiki/display/ECFLOW/Glossary#term-ecf-script"><em class="xref std std-term">ecf script</em></a>. See <a class="reference internal" href="/wiki/display/ECFLOW/Glossary#term-ecf-job"><em class="xref std std-term">ECF_JOB</em></a></div>
</div>
</li>
</ul>
<p>Checking is done using <a class="reference internal" href="/wiki/display/ECFLOW/ecFlow+Python+Api#ecflow.Defs.check_job_creation" title="ecflow.Defs.check_job_creation"><tt class="xref py py-class docutils literal"><span class="pre">ecflow.Defs.check_job_creation</span></tt></a></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">&quot;Creating suite definition&quot;</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">&quot;test&quot;</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">&quot;ECF_HOME&quot;</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">&quot;HOME&quot;</span><span class="p">)</span> <span class="o">+</span> <span class="s">&quot;/course&quot;</span><span class="p">)</span>
<span class="n">suite</span><span class="o">.</span><span class="n">add_task</span><span class="p">(</span><span class="s">&quot;t1&quot;</span><span class="p">)</span>
<span class="k">print</span> <span class="n">defs</span>

<span class="k">print</span> <span class="s">&quot;Checking job creation: .ecf -&gt; .job0&quot;</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="c"># We can assert, so that we only progress, once all job creation works</span>
<span class="c"># assert len(defs.check_job_creation()) == 0, &quot;Job generation failed&quot;</span>
</pre></div>
</div>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">It is highly advisable that <a class="reference internal" href="/wiki/display/ECFLOW/Glossary#term-job-creation"><em class="xref std std-term">job creation</em></a> checking is enabled
for all subsequent examples.</p>
</div>
<p><strong>What to do:</strong></p>
<ol class="arabic simple">
<li>Add <a class="reference internal" href="/wiki/display/ECFLOW/Glossary#term-job-creation"><em class="xref std std-term">job creation</em></a> checking.</li>
<li>Examine the job file <tt class="file docutils literal"><span class="pre">$HOME/course/test/t1.job0</span></tt></li>
</ol>
</div>
</div>