SAGA Adaptor CPI v.1.0
|
00001 #ifndef SAGA_PACKAGES_CPR_CPRJOB_HPP 00002 #define SAGA_PACKAGES_CPR_CPRJOB_HPP 00003 00004 #if defined(__WAVE__) && defined(SAGA_CREATE_PREPROCESSED_FILES) 00005 #pragma wave option(preserve: 2, line: 1, output: "preprocessed/cpr_job.hpp") 00006 #endif 00007 // Copyright (c) 2005-2009 Hartmut Kaiser 00008 // Copyright (c) 2007 Ole Weidner (oweidner@cct.lsu.edu) 00009 // Copyright (c) 2008 Andre Merzky (andre@merzky.net) 00010 // 00011 // Distributed under the Boost Software License, Version 1.0. (See accompanying 00012 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 00013 00014 #if defined(__WAVE__) && defined(SAGA_CREATE_PREPROCESSED_FILES) 00015 #pragma wave option(output: null) 00016 #endif 00017 00018 #include <string> 00019 #include <vector> 00020 #include <iosfwd> 00021 00022 // include dependent spec sections 00023 #include <saga/saga/util.hpp> 00024 #include <saga/saga/base.hpp> 00025 #include <saga/saga/types.hpp> 00026 #include <saga/saga/session.hpp> 00027 #include <saga/saga/call.hpp> 00028 #include <saga/saga/job.hpp> 00029 00030 #include <saga/saga/packages/cpr/config.hpp> 00031 00032 #include <saga/saga/detail/attribute.hpp> 00033 #include <saga/saga/detail/permissions.hpp> 00034 00035 // suppress warnings about dependent classes not being exported from the dll 00036 #if defined(BOOST_MSVC) 00037 #pragma warning(push) 00038 #pragma warning(disable: 4251 4231 4275 4660) 00039 #endif 00040 00041 #ifdef SAGA_DEBUG 00042 #include <saga/saga/packages/cpr/preprocessed/cpr_job.hpp> 00043 #else 00044 00045 #if defined(__WAVE__) && defined(SAGA_CREATE_PREPROCESSED_FILES) 00046 #pragma wave option(preserve: 2, line: 1, output: "preprocessed/cpr_job.hpp") 00047 #endif 00048 00049 namespace saga 00050 { 00055 namespace cpr { 00056 00060 namespace attributes 00061 { 00062 // inherited from saga::job::job? 00063 } 00064 00073 namespace metrics 00074 { 00077 char const* const checkpoint = "cpr_job.Checkpoint"; 00078 00081 char const* const checkpointed = "cpr_job.Checkpointed"; 00082 00085 char const* const recover = "cpr_job.Recover"; 00086 00089 char const* const recovered = "cpr_job.Recovered"; 00090 } 00091 00092 // /*! \brief The state is equivalent to the inherited 00093 // * saga::job::state, but adds the Checkpointing and Recovering state. 00094 // * 00095 // * Checkpointing identifies a job instance which is in 00096 // * the process of checkpointing. 00097 // * 00098 // * Recovering identifies a job instance which is in 00099 // * the process of recovering. 00100 // */ 00101 enum state 00102 { 00103 Unknown = saga::job::Unknown, // -1 00104 New = saga::job::New, // 0 00105 Running = saga::job::Running, // 1 00106 Failed = saga::job::Failed, // 2 00107 Done = saga::job::Done, // 3 00108 Canceled = saga::job::Canceled, // 4 00109 Suspended = saga::job::Suspended, // 5 00110 Checkpointing = 6, 00111 Recovering = 7 00112 }; 00113 00118 class SAGA_CPR_PACKAGE_EXPORT job 00119 : public saga::job::job 00120 { 00121 private: 00122 friend struct saga::detail::attribute<job>; // needs to access get_impl() 00123 friend struct saga::detail::permissions<job>; 00124 00126 // job cpr management 00127 SAGA_CALL_PRIV_1 (checkpoint, saga::url) 00128 SAGA_CALL_PRIV_1 (recover, saga::url) 00129 00130 SAGA_CALL_PRIV_1 (cpr_stage_in, saga::url) 00131 SAGA_CALL_PRIV_1 (cpr_stage_out, saga::url) 00132 00133 SAGA_CALL_PRIV_0 (cpr_last) 00134 SAGA_CALL_PRIV_0 (cpr_list) 00136 00137 protected: 00139 00140 typedef saga::detail::attribute<job> attribute_base; 00141 TR1::shared_ptr <saga::impl::cpr_job> get_impl_sp(void) const; 00142 saga::impl::cpr_job* get_impl (void) const; 00143 explicit job (saga::impl::cpr_job *); 00145 00146 public: 00151 job(); 00152 00157 explicit job (saga::object const& o); 00158 00163 ~job(); 00164 00169 job &operator= (saga::object const& o); 00170 00176 void checkpoint (saga::url u = saga::url ()) 00177 { 00178 checkpointpriv (u, saga::task_base::Sync()); 00179 } 00181 SAGA_CALL_PUB_1_DEF_1 (checkpoint, saga::url, saga::url ()) 00183 00189 void recover (saga::url u = saga::url ()) 00190 { 00191 recoverpriv (u, saga::task_base::Sync()); 00192 } 00194 SAGA_CALL_PUB_1_DEF_1 (recover, saga::url, saga::url ()) 00196 00202 void cpr_stage_in (saga::url u = saga::url ()) 00203 { 00204 cpr_stage_inpriv (u, saga::task_base::Sync()); 00205 } 00207 SAGA_CALL_PUB_1_DEF_1 (cpr_stage_in, saga::url, saga::url ()) 00209 00215 void cpr_stage_out (saga::url u = saga::url ()) 00216 { 00217 cpr_stage_outpriv (u, saga::task_base::Sync()); 00218 } 00220 SAGA_CALL_PUB_1_DEF_1 (cpr_stage_out, saga::url, saga::url ()) 00222 00228 std::vector <saga::url> cpr_list (void) 00229 { 00230 saga::task t = cpr_listpriv(saga::task_base::Sync()); 00231 return t.get_result <std::vector <saga::url> > (); 00232 } 00234 SAGA_CALL_PUB_0_DEF_0 (cpr_list) 00236 00242 saga::url cpr_last (void) 00243 { 00244 saga::task t = cpr_lastpriv(saga::task_base::Sync()); 00245 return t.get_result <saga::url> (); 00246 } 00248 SAGA_CALL_PUB_0_DEF_0 (cpr_last) 00250 }; 00251 00252 } // namespace job 00253 } // namespace saga 00254 00255 #if defined(__WAVE__) && defined(SAGA_CREATE_PREPROCESSED_FILES) 00256 #pragma wave option(output: null) 00257 #endif 00258 00259 #endif // !defined(SAGA_DEBUG) 00260 00261 // re-enable warnings about dependent classes not being exported from the dll 00262 #if defined(BOOST_MSVC) 00263 #pragma warning(pop) 00264 #endif 00265 00266 #endif // !defined(SAGA_PACKAGES_CPR_CPRJOB_HPP) 00267