SAGA C++ API 1.6
job_description.cpp
Go to the documentation of this file.
00001 //  Copyright (c) 2005-2009 Hartmut Kaiser
00002 // 
00003 //  Distributed under the Boost Software License, Version 1.0. (See accompanying 
00004 //  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
00005 
00006 //  this is needed in every file including detail/attribute_impl.hpp and not 
00007 //  belonging to the engine
00008 
00009 //#define SAGA_ATTRIBUTE_EXPORTS
00010 #define SAGA_NO_IMPORT_ATTRIBUTE
00011 #define SAGA_EXPORT_ATTRIBUTE       SAGA_JOB_PACKAGE_EXPORT
00012 
00013 #include <boost/assign/list_inserter.hpp>
00014 #include <boost/assign/std/vector.hpp>
00015 
00016 // include job API and implementation
00017 #include <saga/saga/job.hpp>
00018 #include <saga/saga/adaptors/metric.hpp>
00019 #include <saga/impl/job.hpp>
00020 
00021 #include <saga/saga/detail/attribute_impl.hpp>
00022 
00024 namespace saga { namespace job {
00025 
00026     description::description ()
00027         : object (new saga::impl::description())
00028     {
00029         using namespace boost::assign;
00030         std::vector<std::string> valid_keys;
00031         valid_keys += 
00032               attributes::description_executable,
00033               attributes::description_arguments,
00034               attributes::description_environment,
00035               attributes::description_working_directory, 
00036               attributes::description_interactive,
00037               attributes::description_input,
00038               attributes::description_output,
00039               attributes::description_error,
00040               attributes::description_file_transfer,
00041               attributes::description_cleanup,
00042               attributes::description_job_start_time,
00043               attributes::description_total_cpu_time,
00044               attributes::description_wall_time_limit,
00045               attributes::description_total_physical_memory,
00046               attributes::description_cpu_architecture, 
00047               attributes::description_operating_system_type,
00048               attributes::description_candidate_hosts,
00049               attributes::description_queue,
00050               attributes::description_job_contact,
00051               attributes::description_job_project,
00052               attributes::description_spmd_variation,
00053               attributes::description_total_cpu_count,
00054               attributes::description_number_of_processes,
00055               attributes::description_processes_per_host,
00056               attributes::description_threads_per_process
00057         ;
00058 
00059       // initialize list of valid keys          
00060       this->init_keynames(valid_keys);
00061 
00062       strmap_type attributes_scalar_rw;
00063       insert(attributes_scalar_rw)
00064               (attributes::description_executable, "")
00065               (attributes::description_operating_system_type, "")
00066               (attributes::description_cpu_architecture, "")
00067               (attributes::description_total_cpu_count, "")
00068               (attributes::description_spmd_variation, "")
00069               (attributes::description_number_of_processes, "")
00070               (attributes::description_processes_per_host, "")
00071               (attributes::description_threads_per_process, "")
00072               (attributes::description_working_directory, "")
00073               (attributes::description_interactive, "")
00074               (attributes::description_input, "")
00075               (attributes::description_output, "")
00076               (attributes::description_error, "")
00077               (attributes::description_cleanup, "")
00078               (attributes::description_job_start_time, "")
00079               (attributes::description_total_cpu_time, "")
00080               (attributes::description_wall_time_limit, "")
00081               (attributes::description_total_physical_memory, "")
00082               (attributes::description_queue, "")
00083               (attributes::description_job_contact, "")
00084           ;
00085 
00086       strmap_type attributes_vector_rw;
00087       insert(attributes_vector_rw)
00088               (attributes::description_candidate_hosts, "")
00089               (attributes::description_file_transfer, "")
00090               (attributes::description_environment, "")
00091               (attributes::description_arguments, "")
00092               (attributes::description_candidate_hosts, "")
00093               (attributes::description_job_project, "")
00094           ;
00095 
00096       // initialize attribute implementation
00097       this->init (strmap_type(), attributes_scalar_rw, 
00098           strmap_type(), attributes_vector_rw);
00099       this->init (false, true);   // cache only implementation
00100   }
00101 
00102   description::description(saga::impl::description *impl)
00103     : object (impl)
00104   {
00105   }
00106 
00107   description::~description (void)
00108   {
00109   }
00110 
00112   description::description (saga::object const& o)
00113     : saga::object (o)
00114   {
00115       if (this->get_type() != saga::object::JobDescription)
00116       {
00117           SAGA_THROW("Bad type conversion.", saga::BadParameter);
00118       }
00119   }
00120 
00121   description &description::operator= (saga::object const& o)
00122   {
00123       return saga::object::operator=(o), *this;
00124   }
00125 
00126   } // namespace job
00127 
00128   namespace detail
00129   {
00131     //  implement the attribute functions (we need to explicitly specialize 
00132     //  the template because the functions are not implemented inline)
00133     template struct SAGA_JOB_PACKAGE_EXPORT_REPEAT attribute<job::description>;
00134 
00135     template struct SAGA_JOB_PACKAGE_EXPORT attribute_priv<job::description, task_base::Async>;
00136     template struct SAGA_JOB_PACKAGE_EXPORT attribute_priv<job::description, task_base::Task>;
00137     template struct SAGA_JOB_PACKAGE_EXPORT attribute_priv<job::description, task_base::Sync>;
00138 
00139     template struct SAGA_JOB_PACKAGE_EXPORT attribute_sync<job::description>;
00140   }
00141 
00143 } // namespace saga
00144 
00145 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines