Back to index

nordugrid-arc-nox  1.1.0~rc6
Public Member Functions | Public Attributes | Static Public Attributes
JobLocalDescription Class Reference

#include <info_types.h>

Collaboration diagram for JobLocalDescription:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 JobLocalDescription (void)
JobLocalDescriptionoperator= (const Arc::JobDescription &arc_job_desc)

Public Attributes

std::string jobid
std::string globalid
std::string lrms
std::string queue
std::string localid
std::list< std::string > arguments
std::string DN
Arc::Time starttime
std::string lifetime
std::string notify
Arc::Time processtime
Arc::Time exectime
std::string clientname
std::string clientsoftware
int reruns
int downloads
int uploads
int rtes
std::string jobname
std::list< std::string > projectnames
std::list< std::string > jobreport
Arc::Time cleanuptime
Arc::Time expiretime
std::string stdlog
std::string sessiondir
std::string failedstate
std::string credentialserver
std::list< FileDatainputdata
std::list< FileDataoutputdata
std::list< std::string > rte
std::string action
std::string rc
std::string stdin_
std::string stdout_
std::string stderr_
std::string cache
int gsiftpthreads
bool dryrun
unsigned long long int diskspace
std::list< std::string > activityid
std::string migrateactivityid
bool forcemigration
std::string transfershare

Static Public Attributes

static const char *const transfersharedefault = "_default"

Detailed Description

Definition at line 41 of file info_types.h.


Constructor & Destructor Documentation

Definition at line 44 of file info_types.h.

                          :jobid(""),globalid(""),lrms(""),queue(""),localid(""),
                           DN(""),starttime((time_t)(-1)),lifetime(""),
                           notify(""),processtime((time_t)(-1)),exectime((time_t)(-1)),
                           clientname(""),clientsoftware(""),
                           reruns(0),downloads(-1),uploads(-1),rtes(-1),
                           jobname(""),jobreport(),
                           cleanuptime((time_t)(-1)),expiretime((time_t)(-1)),
                           failedstate(""),
                           credentialserver(""),gsiftpthreads(1),
                           dryrun(false),diskspace(0),
                           migrateactivityid(""), forcemigration(false),
                           transfershare(JobLocalDescription::transfersharedefault)                        
  {}

Member Function Documentation

JobLocalDescription & JobLocalDescription::operator= ( const Arc::JobDescription arc_job_desc)

Definition at line 119 of file info_types.cpp.

{
  action = "request";

  projectnames.clear();
  projectnames.push_back(arc_job_desc.Identification.JobVOName);

  jobname = arc_job_desc.Identification.JobName;
  downloads = 0;
  uploads = 0;
  rtes = 0;
  outputdata.clear();
  inputdata.clear();
  rte.clear();
  transfershare="_default";

  const std::list<Arc::Software>& sw = arc_job_desc.Resources.RunTimeEnvironment.getSoftwareList();
  for (std::list<Arc::Software>::const_iterator itSW = sw.begin(); itSW != sw.end(); ++itSW, ++rtes)
    rte.push_back(std::string(*itSW));

  for (std::list<Arc::FileType>::const_iterator file = arc_job_desc.DataStaging.File.begin();
       file != arc_job_desc.DataStaging.File.end(); ++file) {
    std::string fname = file->Name;
    if(fname.empty()) continue; // Can handle only named files
    if(fname[0] != '/') fname = "/"+fname; // Just for safety
    // Because ARC job description does not keep enough information
    // about initial JSDL description we have to make some guesses here.
    if(!file->Source.empty()) { // input file
      // Only one source per file supported
      inputdata.push_back(FileData(fname.c_str(), ""));
      if (file->Source.front().URI &&
          file->Source.front().URI.Protocol() != "file") {
        inputdata.back().lfn = file->Source.front().URI.fullstr();
        ++downloads;
      }

      if (inputdata.back().has_lfn()) {
        Arc::URL u(inputdata.back().lfn);

        if (file->IsExecutable ||
            file->Name == arc_job_desc.Application.Executable.Name) {
          u.AddOption("exec", "yes");
        }
        if (u.Option("cache").empty())
          u.AddOption("cache", (file->DownloadToCache ? "yes" : "no"));
        if (u.Option("threads").empty() && file->Source.front().Threads > 1)
          u.AddOption("threads", Arc::tostring(file->Source.front().Threads));
        inputdata.back().lfn = u.fullstr();
      }
    }
    if (!file->Target.empty()) { // output file
      FileData fdata(fname.c_str(), file->Target.front().URI.fullstr().c_str());
      outputdata.push_back(fdata);
      ++uploads;

      if (outputdata.back().has_lfn()) {
        Arc::URL u(outputdata.back().lfn);
        if (u.Option("threads").empty() && file->Target.front().Threads > 1)
          u.AddOption("threads", Arc::tostring(file->Source.front().Threads));
        outputdata.back().lfn = u.fullstr();
      }
    }
    if (file->KeepData) {
      // user downloadable file
      FileData fdata(fname.c_str(), NULL);
      outputdata.push_back(fdata);
    }
  }

  // Order of the following calls matters!
  arguments.clear();
  arguments = arc_job_desc.Application.Executable.Argument;
  arguments.push_front(arc_job_desc.Application.Executable.Name);

  stdin_ = arc_job_desc.Application.Input;
  stdout_ = arc_job_desc.Application.Output;
  stderr_ = arc_job_desc.Application.Error;

  if (arc_job_desc.Resources.DiskSpaceRequirement.DiskSpace > -1)
    diskspace = (unsigned long long int)arc_job_desc.Resources.DiskSpaceRequirement.DiskSpace;

  processtime = arc_job_desc.Application.ProcessingStartTime;

  const int lifetimeTemp = (int)arc_job_desc.Resources.SessionLifeTime.GetPeriod();
  if (lifetimeTemp > 0) lifetime = lifetimeTemp;

  activityid = arc_job_desc.Identification.ActivityOldId;

  stdlog = arc_job_desc.Application.LogDir;

  jobreport.clear();
  for (std::list<Arc::URL>::const_iterator it = arc_job_desc.Application.RemoteLogging.begin();
       it != arc_job_desc.Application.RemoteLogging.end(); it++) {
    jobreport.push_back(it->str());
  }

  {
    int n = 0;
    for (std::list<Arc::NotificationType>::const_iterator it = arc_job_desc.Application.Notification.begin();
         it != arc_job_desc.Application.Notification.end(); it++) {
      if (n >= 3) break; // Only 3 instances are allowed.
      std::string states;
      for (std::list<std::string>::const_iterator s = it->States.begin();
           s != it->States.end(); ++s) {
        char state = StateToShortcut(*s);
        if(state == ' ') continue;
        states+=state;
      }
      if(states.empty()) continue;
      if(it->Email.empty()) continue;
      if (n != 0) notify += " ";
      notify += states + " " + it->Email;
      n++;
    }
  }

  if (!arc_job_desc.Resources.CandidateTarget.empty() &&
      !arc_job_desc.Resources.CandidateTarget.front().QueueName.empty())
    queue = arc_job_desc.Resources.CandidateTarget.front().QueueName;

  if (!arc_job_desc.Application.CredentialService.empty() &&
      arc_job_desc.Application.CredentialService.front())
    credentialserver = arc_job_desc.Application.CredentialService.front().str();

  if (arc_job_desc.Application.Rerun > -1)
    reruns = arc_job_desc.Application.Rerun;

  return *this;
};

Here is the call graph for this function:


Member Data Documentation

Definition at line 94 of file info_types.h.

std::list<std::string> JobLocalDescription::activityid

Definition at line 105 of file info_types.h.

std::list<std::string> JobLocalDescription::arguments

Definition at line 66 of file info_types.h.

Definition at line 99 of file info_types.h.

Definition at line 82 of file info_types.h.

Definition at line 73 of file info_types.h.

Definition at line 74 of file info_types.h.

Definition at line 88 of file info_types.h.

unsigned long long int JobLocalDescription::diskspace

Definition at line 103 of file info_types.h.

Definition at line 67 of file info_types.h.

Definition at line 76 of file info_types.h.

Definition at line 102 of file info_types.h.

Definition at line 72 of file info_types.h.

Definition at line 83 of file info_types.h.

Definition at line 87 of file info_types.h.

Definition at line 107 of file info_types.h.

Definition at line 62 of file info_types.h.

Definition at line 100 of file info_types.h.

Definition at line 90 of file info_types.h.

Definition at line 60 of file info_types.h.

Definition at line 79 of file info_types.h.

std::list<std::string> JobLocalDescription::jobreport

Definition at line 81 of file info_types.h.

Definition at line 69 of file info_types.h.

Definition at line 65 of file info_types.h.

Definition at line 63 of file info_types.h.

Definition at line 106 of file info_types.h.

Definition at line 70 of file info_types.h.

Definition at line 91 of file info_types.h.

Definition at line 71 of file info_types.h.

std::list<std::string> JobLocalDescription::projectnames

Definition at line 80 of file info_types.h.

Definition at line 64 of file info_types.h.

Definition at line 95 of file info_types.h.

Definition at line 75 of file info_types.h.

std::list<std::string> JobLocalDescription::rte

Definition at line 92 of file info_types.h.

Definition at line 78 of file info_types.h.

Definition at line 86 of file info_types.h.

Definition at line 68 of file info_types.h.

Definition at line 98 of file info_types.h.

Definition at line 96 of file info_types.h.

Definition at line 84 of file info_types.h.

Definition at line 97 of file info_types.h.

Definition at line 109 of file info_types.h.

const char *const JobLocalDescription::transfersharedefault = "_default" [static]

Definition at line 110 of file info_types.h.

Definition at line 77 of file info_types.h.


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