TAlienJob.cxx

Go to the documentation of this file.
00001 // @(#)root/alien:$Id: TAlienJob.cxx 20882 2007-11-19 11:31:26Z rdm $
00002 // Author: Jan Fiete Grosse-Oetringhaus   06/10/2004
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2004, Rene Brun and Fons Rademakers.               *
00006  * All rights reserved.                                                  *
00007  *                                                                       *
00008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00010  *************************************************************************/
00011 
00012 //////////////////////////////////////////////////////////////////////////
00013 //                                                                      //
00014 // TAlienJob                                                            //
00015 //                                                                      //
00016 // Alien implentation of TGridJob                                       //
00017 //                                                                      //
00018 // Related classes are TAlienJobStatus.                                 //
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    // Queries the job for its status and returns a TGridJobStatus object.
00035    // Returns 0 in case of failure.
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    // Cancels a job e.g. sends a kill command.
00068    // Returns kFALSE in case of failure, otherwise kTRUE.
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    // Resubmits a job.
00081    // Returns kFALSE in case of failure, otherwise kTRUE.
00082 
00083    if (gGrid) {
00084       return gGrid->Resubmit((TGridJob*)this);
00085    }
00086    Error("Cancel","No GRID connection (gGrid=0)");
00087    return kFALSE;
00088 }

Generated on Tue Jul 5 14:45:30 2011 for ROOT_528-00b_version by  doxygen 1.5.1