Issue: When scripting the submission of jobs, the job ID output by Moab will contain a newline character, which will cause problems if that output is captured and used as a dependency definition.
Solution: The newline character needs to be stripped from the captured job ID prior to using it. As an example, consider the following:
$ JID=$(echo sleep 10 | msub)$ echo $JID$JID$JIDMoab.239 Moab.239 Moab.239echo "depend=afterok:$JID"depend=afterok:Moab.239
As you can see, the depend= will not be correct in this case. To fix this, change it to add a line that fixes the job ID, as in the the following example:$ JID=$(echo sleep 10 | msub)$ JID=$(echo $JID | sed -e 's/[[:space:]]//')$ echo $JID$JID$JIDMoab.239Moab.239Moab.239echo "depend=afterok:$JID"depend=afterok:Moab.239
For some reason, piping msub's output through "sed" did not seem to work, so use the above method.Tags: dependencies, script