Back to index

nordugrid-arc-nox  1.1.0~rc6
Functions
job_request.h File Reference
#include <string>
#include "job_desc.h"
#include "../files/info_types.h"
#include <arc/client/JobDescription.h>
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

JobReqResult parse_job_req (const std::string &fname, JobLocalDescription &job_desc, std::string *acl=NULL, std::string *failure=NULL)
bool process_job_req (JobUser &user, const JobDescription &desc)
bool process_job_req (JobUser &user, const JobDescription &desc, JobLocalDescription &job_desc)
bool write_grami (const JobDescription &desc, const JobUser &user, const char *opt_add=NULL)
std::string read_grami (const JobId &job_id, const JobUser &user)
bool set_execs (const JobDescription &desc, const JobUser &user, const std::string &session_dir)

Function Documentation

JobReqResult parse_job_req ( const std::string &  fname,
JobLocalDescription job_desc,
std::string *  acl = NULL,
std::string *  failure = NULL 
)

Definition at line 113 of file job_request.cpp.

                                                                                                                    {
  Arc::JobDescription arc_job_desc;
  if (!get_arc_job_description(fname, arc_job_desc)) {
    if (failure) *failure = "Unable to read or parse job description.";
    return JobReqInternalFailure;
  }

  if (!arc_job_desc.Resources.RunTimeEnvironment.isResolved()) {
    if (failure)
      *failure = "Runtime environments have not been resolved.";
    return JobReqInternalFailure;
  }

  job_desc = arc_job_desc;

  if (acl) return get_acl(arc_job_desc, *acl);
  return JobReqSuccess;
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool process_job_req ( JobUser user,
const JobDescription desc 
)

Definition at line 84 of file job_request.cpp.

                                                               {
  JobLocalDescription job_desc;
  return process_job_req(user,desc,job_desc);
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool process_job_req ( JobUser user,
const JobDescription desc,
JobLocalDescription job_desc 
)

Definition at line 89 of file job_request.cpp.

                                                                                             {
  /* read local first to get some additional info pushed here by script */
  job_local_read_file(desc.get_id(),user,job_desc);
  /* some default values */
  job_desc.lrms=user.DefaultLRMS();
  job_desc.queue=user.DefaultQueue();
  job_desc.lifetime=Arc::tostring(user.KeepFinished());
  std::string filename;
  filename = user.ControlDir() + "/job." + desc.get_id() + ".description";
  if(parse_job_req(filename,job_desc) != JobReqSuccess) return false;
  if(job_desc.reruns>user.Reruns()) job_desc.reruns=user.Reruns();
  if((job_desc.diskspace>user.DiskSpace()) || (job_desc.diskspace==0)) {
    job_desc.diskspace=user.DiskSpace();
  };
  // Adjust number of rtes - exclude existing ones
  job_desc.rtes = filter_rtes(runtime_config_dir(),job_desc.rte);
  if(!job_local_write_file(desc,user,job_desc)) return false;
  if(!job_input_write_file(desc,user,job_desc.inputdata)) return false;
  if(!job_output_write_file(desc,user,job_desc.outputdata)) return false;
  if(!job_rte_write_file(desc,user,job_desc.rte)) return false;
  return true;
}

Here is the call graph for this function:

std::string read_grami ( const JobId job_id,
const JobUser user 
)

Definition at line 168 of file job_request.cpp.

                                                              {
  const char* local_id_param = "joboption_jobid=";
  int l = strlen(local_id_param);
  std::string id = "";
  char buf[256];
  std::string fgrami = user.ControlDir() + "/job." + job_id + ".grami";
  std::ifstream f(fgrami.c_str());
  if(!f.is_open()) return id;
  for(;!f.eof();) {
    istream_readline(f,buf,sizeof(buf));
    if(strncmp(local_id_param,buf,l)) continue;
    if(buf[0]=='\'') {
      l++; int ll = strlen(buf);
      if(buf[ll-1]=='\'') buf[ll-1]=0;
    };
    id=buf+l; break;
  };
  f.close();
  return id;
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool set_execs ( const JobDescription desc,
const JobUser user,
const std::string &  session_dir 
)

Definition at line 145 of file job_request.cpp.

                                                                                            {
  std::string fname = user.ControlDir() + "/job." + desc.get_id() + ".description";
  Arc::JobDescription arc_job_desc;
  if (!get_arc_job_description(fname, arc_job_desc)) return false;

  if (user.StrictSession()) {
    JobUser tmp_user(user.get_uid()==0?desc.get_uid():user.get_uid());
    set_execs_t arg; arg.arc_job_desc=&arc_job_desc; arg.session_dir=&session_dir;
    return (RunFunction::run(tmp_user, "set_execs", &set_execs_callback, &arg, 20) == 0);
  }
  return set_execs(arc_job_desc, session_dir);
}

Here is the call graph for this function:

bool write_grami ( const JobDescription desc,
const JobUser user,
const char *  opt_add = NULL 
)

Definition at line 158 of file job_request.cpp.

                                                                                     {
  const std::string fname = user.ControlDir() + "/job." + desc.get_id() + ".description";

  Arc::JobDescription arc_job_desc;
  if (!get_arc_job_description(fname, arc_job_desc)) return false;

  return write_grami(arc_job_desc, desc, user, opt_add);
}

Here is the call graph for this function: