Back to index

nordugrid-arc-nox  1.1.0~rc6
Job.cpp
Go to the documentation of this file.
00001 // -*- indent-tabs-mode: nil -*-
00002 
00003 #ifdef HAVE_CONFIG_H
00004 #include <config.h>
00005 #endif
00006 
00007 #include <arc/IString.h>
00008 #include <arc/ArcConfig.h>
00009 #include <arc/client/Job.h>
00010 
00011 namespace Arc {
00012 
00013   Job::Job()
00014     : ExitCode(-1),
00015       WaitingPosition(-1),
00016       RequestedTotalWallTime(-1),
00017       RequestedTotalCPUTime(-1),
00018       RequestedMainMemory(-1),
00019       RequestedSlots(-1),
00020       UsedTotalWallTime(-1),
00021       UsedTotalCPUTime(-1),
00022       UsedMainMemory(-1),
00023       UsedSlots(-1),
00024       SubmissionTime(-1),
00025       ComputingManagerSubmissionTime(-1),
00026       StartTime(-1),
00027       ComputingManagerEndTime(-1),
00028       EndTime(-1),
00029       WorkingAreaEraseTime(-1),
00030       ProxyExpirationTime(-1),
00031       CreationTime(-1),
00032       Validity(-1),
00033       VirtualMachine(false) {}
00034 
00035   Job::~Job() {}
00036 
00037   void Job::Print(bool longlist) const {
00038 
00039     std::cout << IString("Job: %s", JobID.str()) << std::endl;
00040     if (!Name.empty())
00041       std::cout << IString(" Name: %s", Name) << std::endl;
00042     if (!State().empty())
00043       std::cout << IString(" State: %s (%s)", State.GetGeneralState(), State())
00044                 << std::endl;
00045     if (ExitCode != -1)
00046       std::cout << IString(" Exit Code: %d", ExitCode) << std::endl;
00047     if (!Error.empty()) {
00048       std::list<std::string>::const_iterator iter;
00049       for (iter = Error.begin(); iter != Error.end(); iter++)
00050         std::cout << IString(" Error: %s", *iter) << std::endl;
00051     }
00052     if (longlist) {
00053       if (!Owner.empty())
00054         std::cout << IString(" Owner: %s", Owner) << std::endl;
00055       if (!OtherMessages.empty())
00056         for (std::list<std::string>::const_iterator iter = OtherMessages.begin();
00057              iter != OtherMessages.end(); iter++)
00058           std::cout << IString(" Other Messages: %s", *iter)
00059                     << std::endl;
00060       if (!ExecutionCE.empty())
00061         std::cout << IString(" ExecutionCE: %s", ExecutionCE)
00062                   << std::endl;
00063       if (!Queue.empty())
00064         std::cout << IString(" Queue: %s", Queue) << std::endl;
00065       if (UsedSlots != -1)
00066         std::cout << IString(" Used Slots: %d", UsedSlots) << std::endl;
00067       if (WaitingPosition != -1)
00068         std::cout << IString(" Waiting Position: %d", WaitingPosition)
00069                   << std::endl;
00070       if (!StdIn.empty())
00071         std::cout << IString(" Stdin: %s", StdIn) << std::endl;
00072       if (!StdOut.empty())
00073         std::cout << IString(" Stdout: %s", StdOut) << std::endl;
00074       if (!StdErr.empty())
00075         std::cout << IString(" Stderr: %s", StdErr) << std::endl;
00076       if (!LogDir.empty())
00077         std::cout << IString(" Grid Manager Log Directory: %s", LogDir)
00078                   << std::endl;
00079       if (SubmissionTime != -1)
00080         std::cout << IString(" Submitted: %s",
00081                              (std::string)SubmissionTime) << std::endl;
00082       if (EndTime != -1)
00083         std::cout << IString(" End Time: %s", (std::string)EndTime)
00084                   << std::endl;
00085       if (!SubmissionHost.empty())
00086         std::cout << IString(" Submitted from: %s", SubmissionHost)
00087                   << std::endl;
00088       if (!SubmissionClientName.empty())
00089         std::cout << IString(" Submitting client: %s",
00090                              SubmissionClientName) << std::endl;
00091       if (RequestedTotalCPUTime != -1)
00092         std::cout << IString(" Requested CPU Time: %s",
00093                              RequestedTotalCPUTime.istr())
00094                   << std::endl;
00095       if (UsedTotalCPUTime != -1)
00096         std::cout << IString(" Used CPU Time: %s",
00097                              UsedTotalCPUTime.istr()) << std::endl;
00098       if (UsedTotalWallTime != -1)
00099         std::cout << IString(" Used Wall Time: %s",
00100                              UsedTotalWallTime.istr()) << std::endl;
00101       if (UsedMainMemory != -1)
00102         std::cout << IString(" Used Memory: %d", UsedMainMemory)
00103                   << std::endl;
00104       if (WorkingAreaEraseTime != -1)
00105         std::cout << IString((State == JobState::DELETED) ?
00106                              istring(" Results were deleted: %s") :
00107                              istring(" Results must be retrieved before: %s"),
00108                              (std::string)WorkingAreaEraseTime)
00109                   << std::endl;
00110       if (ProxyExpirationTime != -1)
00111         std::cout << IString(" Proxy valid until: %s",
00112                              (std::string)ProxyExpirationTime)
00113                   << std::endl;
00114       if (CreationTime != -1)
00115         std::cout << IString(" Entry valid from: %s",
00116                              (std::string)CreationTime) << std::endl;
00117       if (Validity != -1)
00118         std::cout << IString(" Entry valid for: %s",
00119                              Validity.istr()) << std::endl;
00120     }
00121 
00122     std::cout << std::endl;
00123 
00124   } // end Print
00125 
00126 } // namespace Arc