Back to index

nordugrid-arc-nox  1.1.0~rc6
info_types.h
Go to the documentation of this file.
00001 #ifndef GRID_MANAGER_INFO_TYPES_H
00002 #define GRID_MANAGER_INFO_TYPES_H
00003 
00004 #include <string>
00005 #include <list>
00006 #include <iostream>
00007 
00008 #include <arc/DateTime.h>
00009 #include <arc/client/JobDescription.h>
00010 
00011 /* 
00012   Defines few data types used by grid-manager to store information
00013   about jobs.
00014 */
00015 
00016 /*
00017   Pair of values containing file's path (pfn - physical file name)
00018   and it's source or destination on the net (lfn - logical file name)
00019 */
00020 class FileData {
00021  public:
00022   typedef std::list<FileData>::iterator iterator;
00023   FileData(void);
00024   FileData(const char *pfn_s,const char *lfn_s);
00025   std::string pfn;  /* path relative to session dir */
00026   std::string lfn;  /* input/output url or size.checksum */
00027   FileData& operator= (const char* str);
00028   bool operator== (const char* name);
00029   bool operator== (const FileData& data);
00030   bool has_lfn(void);
00031 };
00032 std::istream &operator>> (std::istream &i,FileData &fd);
00033 std::ostream &operator<< (std::ostream &o,const FileData &fd);
00034 
00035 
00036 /*
00037   Most important information about job extracted from different sources
00038   (mostly from job description) and stored in separate file for 
00039   relatively quick and simple access.
00040 */
00041 class JobLocalDescription {
00042  /* all values are public, this class is just for convenience */
00043  public:
00044  JobLocalDescription(void):jobid(""),globalid(""),lrms(""),queue(""),localid(""),
00045                            DN(""),starttime((time_t)(-1)),lifetime(""),
00046                            notify(""),processtime((time_t)(-1)),exectime((time_t)(-1)),
00047                            clientname(""),clientsoftware(""),
00048                            reruns(0),downloads(-1),uploads(-1),rtes(-1),
00049                            jobname(""),jobreport(),
00050                            cleanuptime((time_t)(-1)),expiretime((time_t)(-1)),
00051                            failedstate(""),
00052                            credentialserver(""),gsiftpthreads(1),
00053                            dryrun(false),diskspace(0),
00054                            migrateactivityid(""), forcemigration(false),
00055                            transfershare(JobLocalDescription::transfersharedefault)                        
00056   {}
00057 
00058   JobLocalDescription& operator=(const Arc::JobDescription& arc_job_desc);
00059   
00060   std::string jobid;         /* job's unique identificator */
00061   /* attributes stored in job.ID.local */
00062   std::string globalid;      /* BES ActivityIdentifier, i.e. globally unique id */
00063   std::string lrms;          /* lrms type to use - pbs */
00064   std::string queue;         /* queue name  - default */
00065   std::string localid;       /* job's id in lrms */
00066   std::list<std::string> arguments;    /* executable + arguments */
00067   std::string DN;            /* user's distinguished name aka subject name */
00068   Arc::Time starttime;      /* job submission time */
00069   std::string lifetime;      /* time to live for submission directory */
00070   std::string notify;        /* notification flags used and email address */
00071   Arc::Time processtime;      /* time to start job processing (downloading) */
00072   Arc::Time exectime;         /* time to start execution */
00073   std::string clientname;    /* IP+port of user interface + info given by ui */
00074   std::string clientsoftware; /* Client's version */
00075   int    reruns;             /* number of allowed reruns left */
00076   int    downloads;          /* number of downloadable files requested */
00077   int    uploads;            /* number of uploadable files requested */
00078   int    rtes;               /* number of RTEs requested (absent RTEs later) */
00079   std::string jobname;       /* name of job given by user */
00080   std::list<std::string> projectnames;  /* project names, i.e. "ACIDs" */
00081   std::list<std::string> jobreport;     /* URLs of user's/VO's loggers */
00082   Arc::Time cleanuptime;      /* time to remove job completely */
00083   Arc::Time expiretime;       /* when delegation expires */
00084   std::string stdlog;        /* dirname to which log messages will be
00085                                 put after job finishes */
00086   std::string sessiondir;    /* job's session directory */
00087   std::string failedstate;   /* state at which job failed, used for rerun */
00088   std::string credentialserver; /* URL of server used to renew credentials - MyProxy */
00089   /* attributes stored in other files */
00090   std::list<FileData> inputdata;  /* input files */
00091   std::list<FileData> outputdata; /* output files */
00092   std::list<std::string> rte; /* output files */
00093   /* attributes taken from RSL */
00094   std::string action;        /* what to do - must be 'request' */
00095   std::string rc;            /* url to contact replica collection */
00096   std::string stdin_;         /* file name for stdin handle */
00097   std::string stdout_;        /* file name for stdout handle */
00098   std::string stderr_;        /* file name for stderr handle */
00099   std::string cache;         /* cache default, yes/no */
00100   int    gsiftpthreads;      /* number of parallel connections to use 
00101                                 during gsiftp down/uploads */
00102   bool   dryrun;             /* if true, this is test job */
00103   unsigned long long int diskspace;  /* anount of requested space on disk (unit bytes) */
00104 
00105   std::list<std::string> activityid;     /* ID of activity */
00106   std::string migrateactivityid;     /* ID of activity that is being migrated*/
00107   bool forcemigration;      /* Ignore if killing of old job fails */
00108 
00109   std::string transfershare; /* share assigned to job for transfer fair share */
00110   static const char* const transfersharedefault; /* default value for transfer share */
00111   
00112 };
00113 
00114 /* Information stored in job.#.lrms_done file */
00115 class LRMSResult {
00116  private:
00117   int code_;
00118   std::string description_;
00119   bool set(const char* s);
00120  public:
00121   LRMSResult(void):code_(-1),description_("") { };
00122   LRMSResult(const std::string& s) { set(s.c_str()); };
00123   LRMSResult(int c):code_(c),description_("") { };
00124   LRMSResult(const char* s) { set(s); };
00125   void operator=(const std::string& s) { set(s.c_str()); };
00126   void operator=(const char* s) { set(s); };
00127   int code(void) const { return code_; }; 
00128   const std::string& description(void) const { return description_; };
00129 };
00130 std::istream& operator>>(std::istream& i,LRMSResult &r);
00131 std::ostream& operator<<(std::ostream& i,const LRMSResult &r);
00132 
00133 /*
00134   Writes to 'o' string 'str' prepending each blank space with \ .
00135 */
00136 void output_escaped_string(std::ostream &o,const std::string &str);
00137 
00138 #endif