<html>#886: SimFactory does not correctly detect a failed submit command
<table style='border-spacing: 1ex 0pt; '>
<tr><td style='text-align:right'> Reporter:</td><td>Ian Hinder</td></tr>
<tr><td style='text-align:right'>   Status:</td><td>resolved</td></tr>
<tr><td style='text-align:right'>Milestone:</td><td></td></tr>
<tr><td style='text-align:right'>  Version:</td><td></td></tr>
<tr><td style='text-align:right'>     Type:</td><td>bug</td></tr>
<tr><td style='text-align:right'> Priority:</td><td>minor</td></tr>
<tr><td style='text-align:right'>Component:</td><td>SimFactory</td></tr>
</table>

<p>Changes (by Roland Haas):</p>
<p><table>
<tr><td>status:</td><td>resolved (was new)</td></tr>
</table></p>
<p>If qsub can't be found, simfactory doesn't notice that the command returned a nonzero exit code, and proceeds to return 0 itself.  The submit command is in simrestart.py:</p>
<div class="codehilite"><pre><span></span>        output = simlib.ExecuteCommand(submitCommand, output=True)
</pre></div>


<p>This should check that the exit code is zero, or fail noisily.  What it actually does is</p>
<div class="codehilite"><pre><span></span>        fd = os.popen(command)
        output = fd.read()
        fd.close()

        return output
</pre></div>


<p>Apart from the weird reuse of the output input argument as a return value for something else, it is not checking the exit code in the case where the output was requested.</p>
<p><strong>Keyword:</strong></p>
<p>Comment (by Roland Haas):</p>
<p>Simfactory checks for error  in (all) ExecuteCommand calls since git hash <a data-is-external-link="true" href="https://bitbucket.org/simfactory/simfactory2/commits/a38ff132e4c5a955becab7f462f948f4b3e3be2e" rel="nofollow">a38ff13</a> "check errors when calling ExecuteCommand(...,output=True)" of <a data-is-external-link="true" href="https://bitbucket.org/simfactory/simfactory2" rel="nofollow">simfactory2</a>  from  Fri Jul 10 11:32:55 2015 +0200. This includes the call in submit, which forces the jobid to be "-1" in this case and reports an error to the user (but does not return a non-zero exit code to the shell).</p>
<p>--<br/>
Ticket URL: <a href='https://bitbucket.org/einsteintoolkit/tickets/issues/886/simfactory-does-not-correctly-detect-a'>https://bitbucket.org/einsteintoolkit/tickets/issues/886/simfactory-does-not-correctly-detect-a</a></p>
</html>