Back to index

nordugrid-arc-nox  1.1.0~rc6
Public Member Functions | Private Attributes
JobUserHelper Class Reference

#include <users.h>

Collaboration diagram for JobUserHelper:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 JobUserHelper (const std::string &cmd)
 ~JobUserHelper (void)
bool run (JobUser &user)

Private Attributes

std::string command
Arc::Runproc

Detailed Description

Definition at line 20 of file users.h.


Constructor & Destructor Documentation

JobUserHelper::JobUserHelper ( const std::string &  cmd)

Definition at line 377 of file users.cpp.

                                                 {
  command=cmd;
  proc=NULL;
}

Definition at line 382 of file users.cpp.

                                  {
#ifndef NO_GLOBUS_CODE
    if(proc != NULL) {
      delete proc;
      proc=NULL;
    };
#endif
}

Member Function Documentation

bool JobUserHelper::run ( JobUser user)

Definition at line 392 of file users.cpp.

                                     {
    if(proc != NULL) {
      if(proc->Running()) {
        return true; /* it is already/still running */
      };
      delete proc;
      proc=NULL;
    };
    /* start/restart */
    if(command.length() == 0) return true;  /* has anything to run ? */
    char* args[100]; /* up to 98 arguments should be enough */
    std::string args_s = command;
    std::string arg_s;
    int n;
    for(n=0;n<99;n++) {
      arg_s=config_next_arg(args_s);
      if(arg_s.length() == 0) break;
      args[n]=strdup(arg_s.c_str());
    };
    args[n]=NULL;
    logger.msg(Arc::VERBOSE,"Starting helper process (%s): %s",
               user.UnixName().c_str(),command.c_str());
    std::string helper_id="helper."+user.UnixName();
    bool started=RunParallel::run(user,helper_id.c_str(),args,&proc);
    for(n=0;n<99;n++) {
      if(args[n] == NULL) break;
      free(args[n]);
    };
    if(started) return true;
    if(proc && (*proc)) return true;
    if(proc) { delete proc; proc=NULL; };
    logger.msg(Arc::ERROR,"Helper process start failed (%s): %s",
               user.UnixName().c_str(),command.c_str());
    /* start failed */
    /* doing nothing - maybe in the future */
    return false;
}

Here is the call graph for this function:


Member Data Documentation

std::string JobUserHelper::command [private]

Definition at line 23 of file users.h.

Definition at line 25 of file users.h.


The documentation for this class was generated from the following files: