00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include "TGrid.h"
00023 #include "TAlienJob.h"
00024 #include "TAlienJobStatus.h"
00025 #include "TObjString.h"
00026 #include "gapi_job_operations.h"
00027
00028 ClassImp(TAlienJob)
00029
00030
00031
00032 TGridJobStatus *TAlienJob::GetJobStatus() const
00033 {
00034
00035
00036
00037 TString jobID;
00038 jobID = fJobID;
00039
00040 GAPI_JOBARRAY *gjobarray = gapi_queryjobs("-", "%", "-", "-", "-", "-",
00041 jobID.Data(), "-", "-");
00042
00043 if (!gjobarray)
00044 return 0;
00045
00046 if (gjobarray->size() == 0) {
00047 delete gjobarray;
00048 return 0;
00049 }
00050
00051 TAlienJobStatus *status = new TAlienJobStatus();
00052
00053 GAPI_JOB gjob = gjobarray->at(0);
00054 std::map<std::string, std::string>::const_iterator iter = gjob.gapi_jobmap.begin();
00055 for (; iter != gjob.gapi_jobmap.end(); ++iter) {
00056 status->fStatus.Add(new TObjString(iter->first.c_str()), new TObjString(iter->second.c_str()));
00057 }
00058
00059 delete gjobarray;
00060
00061 return status;
00062 }
00063
00064
00065 Bool_t TAlienJob::Cancel()
00066 {
00067
00068
00069
00070 if (gGrid) {
00071 return gGrid->Kill((TGridJob*)this);
00072 }
00073 Error("Cancel","No GRID connection (gGrid=0)");
00074 return kFALSE;
00075 }
00076
00077
00078 Bool_t TAlienJob::Resubmit()
00079 {
00080
00081
00082
00083 if (gGrid) {
00084 return gGrid->Resubmit((TGridJob*)this);
00085 }
00086 Error("Cancel","No GRID connection (gGrid=0)");
00087 return kFALSE;
00088 }