Exemplo n.º 1
0
void RDORuntime::postProcess()
{
    getTracer()->startWriting();
    LPIResultList::iterator it = m_resultAllList.begin();
    while (it != m_resultAllList.end())
    {
        try
        {
            (*it)->calcStat(this, getResults().getOStream());
        }
        catch (const RDORuntimeException&)
        {}
        ++it;
    }

    try
    {
        parent_type::postProcess();
        writeExitCode();
        getTracer()->stopWriting();
    }
    catch (const RDORuntimeException& e)
    {
        writeExitCode();
        getTracer()->stopWriting();
        throw e;
    }
}
Exemplo n.º 2
0
/****** Interactive/qrsh/--qrsh_starter ***************************************
*
*  NAME
*     qrsh_starter -- start a command special correct environment
*
*  SYNOPSIS
*     qrsh_starter <environment file> <noshell>
*     int main(int argc, char **argv[])
*
*  FUNCTION
*     qrsh_starter is used to start a command, optionally with additional
*     arguments, in a special environment.
*     The environment is read from the given <environment file>.
*     The command to be executed is read from the environment variable
*     QRSH_COMMAND and executed either standalone, passed to a wrapper
*     script (environment  variable QRSH_WRAPPER) or (default) in a users login
*     shell (<shell> -c <command>).
*     On exit of the command, or if an error occurs, an exit code is written
*     to the file $TMPDIR/qrsh_exit_code.
*
*     qrsh_starter is called from qrsh to start the remote processes in 
*     the correct environment.
*
*  INPUTS
*     environment file - file with environment information, each line 
*                        contains a tuple <name>=<value>
*     noshell          - if this parameter is passed, the command will be
*                        executed standalone
*
*  RESULT
*     EXIT_SUCCESS, if all actions could be performed,
*     EXIT_FAILURE, if an error occured
*
*  EXAMPLE
*     setenv QRSH_COMMAND "echo test"
*     env > ~/myenvironment
*     rsh <hostname> qrsh_starter ~/myenvironment 
*
*  SEE ALSO
*     Interactive/qsh/--Interactive
*
****************************************************************************
*/
int main(int argc, char *argv[])
{
   int   exitCode = 0;
   char *command  = NULL;
   char *wrapper = NULL;
   int  noshell  = 0;

   /* check for correct usage */
   if(argc < 2) {
      fprintf(stderr, "usage: %s <job spooldir> [noshell]\n", argv[0]);
      exit(EXIT_FAILURE);        
   }

   /* check for noshell */
   if(argc > 2) {
      if(strcmp(argv[2], "noshell") == 0) {
         noshell = 1;
      }
   }

   if(!readConfig(argv[1])) {
      writeExitCode(EXIT_FAILURE, 0);
      exit(EXIT_FAILURE);
   }

   /* setup environment */
   command = setEnvironment(argv[1], &wrapper);
   if(command == NULL) {
      writeExitCode(EXIT_FAILURE, 0);
      exit(EXIT_FAILURE);
   }   

   if(!changeDirectory()) {
      writeExitCode(EXIT_FAILURE, 0);
      exit(EXIT_FAILURE);
   }

   /* start job */
   exitCode = startJob(command, wrapper, noshell);

   /* JG: TODO: At this time, we could already pass the exitCode to qrsh.
    *           Currently, this is done by shepherd, but only after 
    *           qrsh_starter and rshd exited.
    *           If we pass exitCode to qrsh, we also have to implement the
    *           shepherd_about_to_exit mechanism here.
    */

   /* write exit code and exit */
   return writeExitCode(EXIT_SUCCESS, exitCode);
}