TGLiteJob.cxx

Go to the documentation of this file.
00001 // @(#) root/glite:$Id: TGLiteJob.cxx 24647 2008-07-03 14:20:28Z anar $
00002 // Author: Anar Manafov <A.Manafov@gsi.de> 2006-04-10
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2008, 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 /*! \file TGLiteJob.cxx
00014 gLite implementation of TGridJob*//*
00015 
00016          version number:    $LastChangedRevision: 1678 $
00017          created by:        Anar Manafov
00018                             2006-04-10
00019          last changed by:   $LastChangedBy: manafov $ $LastChangedDate: 2008-01-21 18:22:14 +0100 (Mon, 21 Jan 2008) $
00020 
00021          Copyright (c) 2006-2008 GSI GridTeam. All rights reserved.
00022 *************************************************************************/
00023 
00024 // glite-api-wrapper
00025 #include <glite-api-wrapper/gLiteAPIWrapper.h>
00026 // ROOT RGLite
00027 #include "TGLiteJob.h"
00028 #include "TGLiteJobStatus.h"
00029 
00030 //////////////////////////////////////////////////////////////////////////
00031 //
00032 // The TGLiteJob class is a part of RGLite plug-in and
00033 // represents a Grid job and offers a possibility to
00034 // query the job status and retrieve its output sandbox.
00035 //
00036 // Related classes are TGLite.
00037 //
00038 //////////////////////////////////////////////////////////////////////////
00039 
00040 ClassImp(TGLiteJob)
00041 
00042 using namespace std;
00043 using namespace glite_api_wrapper;
00044 using namespace MiscCommon;
00045 
00046 //______________________________________________________________________________
00047 TGridJobStatus* TGLiteJob::GetJobStatus() const
00048 {
00049    // The GetJobStatus() method queries the job for its status.
00050    // RETURN:
00051    //      a TGridJobStatus object.
00052 
00053    // Returns 0 in case of failure.
00054    return dynamic_cast<TGridJobStatus*>(new TGLiteJobStatus(fJobID));
00055 }
00056 
00057 
00058 //______________________________________________________________________________
00059 Int_t TGLiteJob::GetOutputSandbox(const char* _localpath, Option_t* /*opt*/)
00060 {
00061    // Retrieving the output sandbox files.
00062    // INPUT:
00063    //      _localpath  [in] - a local destination path for output sandbox.
00064    // NOTE:
00065    //      The other parameter is unsupported.
00066    // RETURN:
00067    //      The method returns -1 in case of errors and 0 otherwise.
00068 
00069    // TODO: Add Info message;
00070    // TODO: Add option "nopurge" to TGLiteJob::GetOutputSandbox, since it's supported now by glite-api-wrapper
00071    try {
00072       CJobManager::delivered_output_t joboutput_path;
00073       CGLiteAPIWrapper::Instance().GetJobManager().JobOutput(string(fJobID), _localpath, &joboutput_path);
00074 
00075       // Print all output directories
00076       CJobManager::delivered_output_t::const_iterator iter = joboutput_path.begin();
00077       CJobManager::delivered_output_t::const_iterator iter_end = joboutput_path.end();
00078       Info("GetOutputSandbox", "The output has been delivered [ job ] -> [local output directory]");
00079       for (; iter != iter_end; ++iter) {
00080          stringstream ss;
00081          ss << "[" << iter->first << "] -> [" << iter->second << "]";
00082          Info("GetOutputSandbox", ss.str().c_str());
00083       }
00084       return 0;
00085    } catch (const exception &_e) {
00086       Error("GetOutputSandbox", "Exception: %s", _e.what());
00087       return -1;
00088    }
00089 }
00090 
00091 
00092 //______________________________________________________________________________
00093 Bool_t TGLiteJob::Resubmit()
00094 {
00095    // Not implemented for RGLite.
00096 
00097    MayNotUse("Resubmit");
00098    return kFALSE;
00099 }
00100 
00101 
00102 //______________________________________________________________________________
00103 Bool_t TGLiteJob::Cancel()
00104 {
00105    // The Cancel() method cancels a gLite job, which was assigned to the class.
00106    // RETURN:
00107    //      kTRUE if succeeded and kFALSE otherwise.
00108 
00109    try {
00110       CGLiteAPIWrapper::Instance().GetJobManager().JobCancel(string(fJobID));
00111    } catch (const exception &_e) {
00112       Error("Cancel", "Exception: %s", _e.what());
00113       return kFALSE;
00114    }
00115    return kTRUE;
00116 }

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