Some tasks are marked as Failed even when the command ran successfully. This can cause problems with troubleshooting, chargeback, service license agreements, and cluster reporting.
When this occurs, you may see an error message such as:
Task failed during execution with exit code 1. Please check task’s output for error details.
The HPC Job Scheduler Service interprets a non-zero exit code as a failure. If the task’s command line returns a non-zero exit code, the task is marked as Failed. However, some applications return a non-zero exit code even when they succeed.
If your application returns non-zero exit codes for success, you can include an evaluation statement in the command line to check for successful exit codes. You can use the %ERRORLEVEL% environment variable to evaluate the application’s exit code, and in the case of success, return a value of 0 to the HPC Job Scheduler Service. Alternately, you can modify the command to ignore all exit codes.
For example, Robocopy.exe returns exit codes 0 and 1 for success. If you submit a task that specifies the command “robocopy c:\dirA c:\dirB *.*”, the task may complete successfully but be marked as Failed by the HPC Job Scheduler Service.
To check for successful exit codes (less than or equal to 1), you can modify the command as follows:
robocopy c:\dirA c:\dirB *.* ^& IF %ERRORLEVEL% LEQ 1 exit 0
To ignore exit codes, you can modify the command as follows:
robocopy c:\dirA c:\dirB *.* ^& exit 0
Modify the command line of a failed task with an evaluation statement or with the simple exit statement, and then resubmit the job. Verify that the task status upon completion is Finished.