[Saga-devel] saga SVN commit 3409: /trunk/adaptors/condor/job/

jpabecasis at cct.lsu.edu jpabecasis at cct.lsu.edu
Sat Jan 31 15:21:28 CST 2009


User: jpabecasis
Date: 2009/01/31 03:21 PM

Modified:
 /trunk/adaptors/condor/job/
  classad.hpp, condor_job.hpp, condor_job_adaptor.cpp, description.hpp, shared_job_data.hpp

Log:
 Case insensitive processing of Condor attributes

File Changes:

Directory: /trunk/adaptors/condor/job/
======================================

File [modified]: classad.hpp
Delta lines: +9 -2
===================================================================
--- trunk/adaptors/condor/job/classad.hpp	2009-01-30 16:39:03 UTC (rev 3408)
+++ trunk/adaptors/condor/job/classad.hpp	2009-01-31 21:19:59 UTC (rev 3409)
@@ -26,6 +26,7 @@
 #include <boost/spirit/core/composite/sequence.hpp>
 #include <boost/spirit/utility/chset.hpp>
 
+#include <boost/algorithm/string/case_conv.hpp>
 #include <boost/algorithm/string/replace.hpp>
 
 #include <map>
@@ -163,6 +164,8 @@
                             { "&gt;",   ">" }
                         };
 
+                    boost::to_lower(k_);
+
                     for (std::size_t i = 0;
                             i < sizeof(escapes)/sizeof(*escapes); ++i)
                     {
@@ -212,16 +215,20 @@
             attributes_.clear();
         }
 
-        void set_attribute(std::string const & key, /* classad_type type, */
+        void set_attribute(std::string key, /* classad_type type, */
                 std::string const & type,
                 std::string const & val)
         {
+            boost::to_lower(key);
+
             value v = { type, val };
             attributes_[ key ] = v;
         }
 
-        boost::optional<value> get_attribute(std::string const & key) const
+        boost::optional<value> get_attribute(std::string key) const
         {
+            boost::to_lower(key);
+
             boost::optional<value> attr;
             attribute_iterator iter = attributes_.find(key);
 

File [modified]: condor_job.hpp
Delta lines: +1 -1
===================================================================
--- trunk/adaptors/condor/job/condor_job.hpp	2009-01-30 16:39:03 UTC (rev 3408)
+++ trunk/adaptors/condor/job/condor_job.hpp	2009-01-31 21:19:59 UTC (rev 3409)
@@ -76,7 +76,7 @@
 
         void update_state()
         {
-            typedef std::map<std::string, std::string> attribute_map;
+            typedef shared_job_data::attribute_map attribute_map;
 
             // If the proxy no longer exists, there's no point in updating our
             // state. We should just die, already.

File [modified]: condor_job_adaptor.cpp
Delta lines: +5 -1
===================================================================
--- trunk/adaptors/condor/job/condor_job_adaptor.cpp	2009-01-30 16:39:03 UTC (rev 3408)
+++ trunk/adaptors/condor/job/condor_job_adaptor.cpp	2009-01-31 21:19:59 UTC (rev 3409)
@@ -8,6 +8,7 @@
 #include "condor_job_service.hpp"
 #include "condor_job.hpp"
 
+#include <boost/algorithm/string/case_conv.hpp>
 #include <boost/foreach.hpp>
 
 namespace saga { namespace adaptors { namespace condor {
@@ -42,7 +43,10 @@
             saga::ini::ini default_section = adap_ini.get_section(default_);
 
             BOOST_FOREACH(entry const & var, default_section.get_entries())
-                default_section_.insert(std::make_pair(var.first, var.second));
+            {
+                std::string key = boost::to_lower_copy(var.first);
+                default_section_.insert(std::make_pair(key, var.second));
+            }
         }
 
         // CLI configuration

File [modified]: description.hpp
Delta lines: +21 -20
===================================================================
--- trunk/adaptors/condor/job/description.hpp	2009-01-30 16:39:03 UTC (rev 3408)
+++ trunk/adaptors/condor/job/description.hpp	2009-01-31 21:19:59 UTC (rev 3409)
@@ -11,6 +11,7 @@
 #include <saga/saga/attribute.hpp>
 #include <saga/impl/exception.hpp>
 
+#include <boost/algorithm/string/case_conv.hpp>
 #include <boost/algorithm/string/predicate.hpp>
 #include <boost/algorithm/string/replace.hpp>
 #include <boost/filesystem.hpp>
@@ -51,7 +52,7 @@
         BOOST_FOREACH(attribute const & data, desc.attributes_)
         {
             if (!data.second.empty())
-                if (data.first == "Queue")
+                if (data.first == "queue")
                     postlog     += data.first +  " "  + data.second + "\n";
                 else
                     content += data.first + " = " + data.second + "\n";
@@ -76,18 +77,18 @@
         {
             using namespace saga::job::attributes;
 
-            map_attribute(description_queue, "Universe");
+            map_attribute(description_queue, "universe");
             {
                 //  FIXME!
                 //  supported values: Vanilla, Standard, Scheduler, Local,
                 //  Grid, MPI, Java, VM
             }
 
-            require_attribute   (description_executable,    "Executable");
-            map_attribute_vector(description_arguments,     "Arguments");
-            map_attribute_vector(description_environment,   "Environment");
+            require_attribute   (description_executable,    "executable");
+            map_attribute_vector(description_arguments,     "arguments");
+            map_attribute_vector(description_environment,   "environment");
 
-            map_attribute(description_working_directory, "Remote_InitialDir");
+            map_attribute(description_working_directory, "remote_initialdir");
 
             // TODO Interactive - Not implemented
             if (saga_description_.attribute_exists(description_interactive))
@@ -102,13 +103,13 @@
                         "support Interactive jobs.", saga::NotImplemented);
             }
 
-            map_attribute(description_input,    "Input");
-            map_attribute(description_output,   "Output");
-            map_attribute(description_error,    "Error");
+            map_attribute(description_input,    "input");
+            map_attribute(description_output,   "output");
+            map_attribute(description_error,    "error");
 
-            map_attribute(description_job_start_time, "Deferral_Time");
+            map_attribute(description_job_start_time, "deferral_time");
 
-            map_attribute(description_number_of_processes, "Queue", "1");
+            map_attribute(description_number_of_processes, "queue", "1");
 
             process_file_transfer();
 
@@ -124,7 +125,7 @@
                             description_job_contact))
                     if (boost::starts_with(contact, "mailto:"))
                     {
-                        attributes_["Notify_User"] = contact.substr(7);
+                        attributes_["notify_user"] = contact.substr(7);
                         break;
                     }
             }
@@ -173,12 +174,12 @@
                     requirements_.push_back(req);
             }
 
-            map_requirement(description_total_cpu_count,        "Cpus");
-            map_requirement(description_total_physical_memory,  "Memory");
+            map_requirement(description_total_cpu_count,        "cpus");
+            map_requirement(description_total_physical_memory,  "memory");
 
             // TODO: Do the mappings
-            map_requirement(description_cpu_architecture,       "Arch");
-            map_requirement(description_operating_system_type,  "OpSys");
+            map_requirement(description_cpu_architecture,       "arch");
+            map_requirement(description_operating_system_type,  "opsys");
 
             {
                 std::string requirements;
@@ -190,7 +191,7 @@
                 }
 
                 if (!requirements.empty())
-                    attributes_["Requirements"] = requirements;
+                    attributes_["requirements"] = requirements;
             }
         }
 
@@ -301,11 +302,11 @@
                 }
 
                 if (!input.empty())
-                    attributes_["Transfer_Input_Files"] = input;
+                    attributes_["transfer_input_files"] = input;
                 if (!output.empty())
-                    attributes_["Transfer_Output_Files"] = output;
+                    attributes_["transfer_output_files"] = output;
                 if (!output_remaps.empty())
-                    attributes_["Transfer_Output_Remaps"]
+                    attributes_["transfer_output_remaps"]
                         = "\"" + output_remaps + "\"";
 
                 return true;

File [modified]: shared_job_data.hpp
Delta lines: +2 -1
===================================================================
--- trunk/adaptors/condor/job/shared_job_data.hpp	2009-01-30 16:39:03 UTC (rev 3408)
+++ trunk/adaptors/condor/job/shared_job_data.hpp	2009-01-31 21:19:59 UTC (rev 3409)
@@ -23,6 +23,7 @@
     {
         typedef boost::recursive_mutex mutex;
         typedef boost::recursive_mutex::scoped_lock scoped_lock;
+        typedef std::map<std::string, std::string> attribute_map;
 
         mutex state_change_mtx;
         boost::condition state_change;
@@ -31,7 +32,7 @@
         saga::job::description description;
         saga::job::state state;
 
-        std::map<std::string, std::string> attributes;
+        attribute_map attributes;
 
         std::string full_job_id;
         std::string cluster_id;



More information about the saga-devel mailing list