Back to index

nordugrid-arc-nox  1.1.0~rc6
JobStateARC1.cpp
Go to the documentation of this file.
00001 #ifdef HAVE_CONFIG_H
00002 #include <config.h>
00003 #endif
00004 
00005 #include <arc/StringConv.h>
00006 
00007 #include "JobStateARC1.h"
00008 
00009 namespace Arc {
00010 
00011   JobState::StateType JobStateARC1::StateMap(const std::string& state) {
00012     std::string state_ = Arc::lower(state);
00013     std::string::size_type p = state_.find("pending:");
00014     if(p != std::string::npos) {
00015       state_.erase(p,8);
00016     }
00017     if (state_ == "accepted")
00018       return JobState::ACCEPTED;
00019     else if (state_ == "preparing" ||
00020              state_ == "prepared")    // obtained through BES
00021       return JobState::PREPARING;
00022     else if (state_ == "submit" ||
00023              state_ == "submitting")  // obtained through BES
00024       return JobState::SUBMITTING;
00025     else if (state_ == "inlrms:q")
00026       return JobState::QUEUING;
00027     else if (state_ == "inlrms:r" ||
00028              state_ == "inlrms:executed" ||
00029              state_ == "inlrms:s" ||
00030              state_ == "inlrms:e" ||
00031              state_ == "executing" || // obtained through BES
00032              state_ == "executed" ||  // obtained through BES
00033              state_ == "killing")     // obtained through BES
00034       return JobState::RUNNING;
00035     else if (state_ == "finishing")
00036       return JobState::FINISHING;
00037     else if (state_ == "finished")
00038       return JobState::FINISHED;
00039     else if (state_ == "killed")
00040       return JobState::KILLED;
00041     else if (state_ == "failed")
00042       return JobState::FAILED;
00043     else if (state_ == "deleted")
00044       return JobState::DELETED;
00045     else if (state_ == "")
00046       return JobState::UNDEFINED;
00047     else
00048       return JobState::OTHER;
00049   }
00050 
00051 }