#if defined(__WAVE__) #pragma wave option(preserve: 2, line: 0, output: "preprocessed/job.cpp") #endif // Copyright (c) 2005-2007 Hartmut Kaiser (hartmut.kaiser@gmail.com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) #if defined(__WAVE__) #pragma wave option(preserve: 0, output: null) #endif #include #include #include #include #include #include #ifdef SAGA_DEBUG #include #else #if defined(__WAVE__) #pragma wave option(preserve: 2, output: "preprocessed/job.cpp") #endif /////////////////////////////////////////////////////////////////////////////// namespace saga { namespace impl { job::job (std::string rm, saga::job_description jd, saga::session const & s, TR1::shared_ptr cpi_instance) : task_base ("job_cpi::sync_run", cpi_instance, saga::task_base::New), proxy(saga::object::Job, s) { // initialize the instance data typedef adaptors::v1_0::job_cpi_instance_data instance_data_type; typedef adaptors::instance_data job_instance_data; { job_instance_data data; data.init_data (this, TR1::shared_ptr ( new instance_data_type(rm, jd))); } // lock goes out of scope } job::job (std::string rm, std::string jobid, saga::session const & s, TR1::shared_ptr cpi_instance) : task_base ("job_cpi::sync_run", cpi_instance, saga::task_base::New), proxy(saga::object::Job, s) { // initialize the instance data typedef adaptors::v1_0::job_cpi_instance_data instance_data_type; typedef adaptors::instance_data job_instance_data; // initialize cpi instance { job_instance_data data; data.init_data (this, TR1::shared_ptr ( new instance_data_type(rm, jobid))); } // lock goes out of scope } void job::init() { // initialize a CPI instance and execute required functions this->initcpi(saga::adaptors::job_cpi); } job::~job (void) { // release all attached adaptors now saga::impl::proxy::release_cpis(); // free the instance data typedef adaptors::v1_0::job_cpi_instance_data instance_data_type; typedef adaptors::instance_data job_instance_data; job_instance_data data; data.release_data (this); } // task interface SAGA_CALL_IMPL_IMPL_0 (job, job_cpi, saga::void_t, run) SAGA_CALL_IMPL_IMPL_0 (job, job_cpi, saga::void_t, cancel) SAGA_CALL_IMPL_IMPL_1 (job, job_cpi, bool, wait, double) // job inspection SAGA_CALL_IMPL_IMPL_0 (job, job_cpi, std::string, get_job_id) SAGA_CALL_IMPL_IMPL_0 (job, job_cpi, saga::job::state, get_state) SAGA_CALL_IMPL_IMPL_0 (job, job_cpi, std::string, get_state_detail) SAGA_CALL_IMPL_IMPL_0 (job, job_cpi, saga::job_description, get_job_description) SAGA_CALL_IMPL_IMPL_0 (job, job_cpi, saga::ostream, get_stdin) SAGA_CALL_IMPL_IMPL_0 (job, job_cpi, saga::istream, get_stdout) SAGA_CALL_IMPL_IMPL_0 (job, job_cpi, saga::istream, get_stderr) // job management SAGA_CALL_IMPL_IMPL_0 (job, job_cpi, saga::void_t, suspend) SAGA_CALL_IMPL_IMPL_0 (job, job_cpi, saga::void_t, resume) SAGA_CALL_IMPL_IMPL_0 (job, job_cpi, saga::void_t, checkpoint) SAGA_CALL_IMPL_IMPL_2 (job, job_cpi, saga::void_t, migrate, saga::job_description, std::string) SAGA_CALL_IMPL_IMPL_1 (job, job_cpi, saga::void_t, signal, int) } // namespace impl } // namespace saga /////////////////////////////////////////////////////////////////////////////// #endif