From: Greg Ercolano <erco@(email surpressed)>
Subject: [Q+A] Using 'rush -submit' in custom scripts
   Date: Wed, 07 Mar 2012 23:29:04 -0500
Msg# 2197
View Complete Thread (1 article) | All Threads
Last Next
> We're writing our own custom submit script, using 'rush -submit'.
> Are there any special instructions on how to check for errors?

   Yes, here are some suggestions.

   These I'd consider MANDATORY:

        o Check the exit code of 'rush -submit' to see
          if it succeeded; 0 means success, non-zero means it failed.

        o If a non-zero exit code is returned, and you're
          using a GUI to handle the submission, present the
          stdout/stderr of the failed 'rush -submit' command
          to the user; this will aid in debugging the problem.

   These I'd consider "optional":

        o To determine the jobid of the submitted job,
          parse the stdout of the 'rush -submit' command
          with e.g. the following regex to parse the jobid:

              RUSH_JOBID.(\S+)

          Or, if using scanf() in C or C++, you might use:

		char c, jobid[80];
		if ( sscanf(s, "RUSH_JOBID%c%79s", &c, &jobid) == 2)
			{ printf("The jobid is '%s'\n", jobid); }

        o Even though a job might submit successfully,
          it's possible for 'rush -submit' to print /warning messages/
          about the submission.

          Assume that any non-blank lines besides the line containing
          'RUSH_JOBID' are warning messages that it would be wise
          to either display to the user, or at very least preserve
          in a submission log that the developers may want to later
          look at to trace problems.

Last Next