[Saga-devel] saga SVN commit 3309: /trunk/adaptors/aws/aws_job/
amerzky at cct.lsu.edu
amerzky at cct.lsu.edu
Fri Jan 16 10:22:06 CST 2009
User: amerzky
Date: 2009/01/16 10:22 AM
Modified:
/trunk/adaptors/aws/aws_job/
aws_job_adaptor.cpp, aws_job_service.cpp, aws_job_service.hpp
Log:
scattered changes, mostly about log verbosity
A
File Changes:
Directory: /trunk/adaptors/aws/aws_job/
=======================================
File [modified]: aws_job_adaptor.cpp
Delta lines: +1 -0
===================================================================
--- trunk/adaptors/aws/aws_job/aws_job_adaptor.cpp 2009-01-16 16:21:16 UTC (rev 3308)
+++ trunk/adaptors/aws/aws_job/aws_job_adaptor.cpp 2009-01-16 16:21:53 UTC (rev 3309)
@@ -130,6 +130,7 @@
ini_[name]["ec2_keystore" ] = ini_["defaults"]["ec2_keystore" ];
ini_[name]["java_home" ] = ini_["defaults"]["java_home" ];
ini_[name]["ec2_home" ] = ini_["defaults"]["ec2_home" ];
+ ini_[name]["ec2_scripts" ] = ini_["defaults"]["ec2_scripts" ];
ini_[name]["ec2_keepalive"] = ini_["defaults"]["ec2_keepalive"];
File [modified]: aws_job_service.cpp
Delta lines: +48 -17
===================================================================
--- trunk/adaptors/aws/aws_job/aws_job_service.cpp 2009-01-16 16:21:16 UTC (rev 3308)
+++ trunk/adaptors/aws/aws_job/aws_job_service.cpp 2009-01-16 16:21:53 UTC (rev 3309)
@@ -63,6 +63,7 @@
for ( it = contexts.begin (); ! ok && it != contexts.end () ; it++ )
{
+ dump_context (*it);
if ( (*it).get_attribute (saga::attributes::context_type) == types[i] )
{
ok = true;
@@ -96,7 +97,7 @@
{
// no host - create a new VM instance to submit jobs to.
- proc.set_cmd (ini_["ec2_home"] + "/bin/ec2-run-instances");
+ proc.set_cmd (ini_["ec2_scripts"] + "/ec2-run-instances");
proc.add_args ("-k", ini_["ec2_keypair_name"]);
proc.add_arg (ini_["ec2_instance"]);
@@ -122,7 +123,7 @@
- proc.set_cmd (ini_["ec2_home"] + "/bin/ec2-describe-instances");
+ proc.set_cmd (ini_["ec2_scripts"] + "/ec2-describe-instances");
proc.clear_args ();
proc.add_arg (vm_id_);
@@ -146,7 +147,7 @@
}
state = out_words[5];
- std::cout << state << std::endl;
+ // std::cout << state << std::endl;
}
@@ -169,8 +170,6 @@
int count = 0;
while ( true )
{
- std::cout << "trying ssh" << std::endl;
-
proc.set_cmd ("/usr/bin/ssh");
proc.clear_args ();
@@ -178,7 +177,9 @@
proc.add_args ("-o", "StrictHostKeyChecking=no");
proc.add_args ("-i", ini_["ec2_proxy"]);
proc.add_arg ("root@" + vm_ip_);
- proc.add_arg ("/bin/true");
+ // proc.add_arg ("/bin/true");
+ proc.add_arg ("/usr/bin/touch");
+ proc.add_arg ("/tmp/ssh_was_here");
(void) proc.run_sync ();
@@ -188,7 +189,7 @@
}
else
{
- std::cout << "trying ssh failed" << std::endl;
+ SAGA_LOG_ALWAYS ("trying ssh failed");
::sleep (1);
}
@@ -198,16 +199,16 @@
}
}
- std::cout << "trying ssh ok" << std::endl;
+ SAGA_LOG_ALWAYS ("trying ssh ok");
// instanc e is up, ssh is up - now run an image preparation if needed
if ( ini_["ec2_image_prep"] == "" )
{
- std::cout << "no image prep needed" << std::endl;
+ SAGA_LOG_ALWAYS ("no image prep needed");
}
else
{
- std::cout << "preparing image" << std::endl;
+ SAGA_LOG_ALWAYS ("preparing image");
// stage the prep script to the VM
proc.set_cmd ("/usr/bin/scp");
@@ -259,7 +260,7 @@
std::string vm_id_ = host;
- proc.set_cmd (ini_["ec2_home"] + "/bin/ec2-describe-instances");
+ proc.set_cmd (ini_["ec2_scripts"] + "/ec2-describe-instances");
proc.clear_args ();
proc.add_arg (vm_id_);
@@ -304,7 +305,7 @@
std::string vm_ip_ = host;
- proc.set_cmd (ini_["ec2_home"] + "/bin/ec2-describe-instances");
+ proc.set_cmd (ini_["ec2_scripts"] + "/ec2-describe-instances");
std::vector <std::string> out = proc.run_sync ();
@@ -355,7 +356,7 @@
// contexts, as we don't want to spread credentials beyond their respective
// universe.
- std::cout << "copying identity file" << std::endl;
+ SAGA_LOG_ALWAYS ("copying identity file");
proc.set_cmd ("/usr/bin/scp");
@@ -373,7 +374,7 @@
if ( proc.fail () )
{
- std::cout << "could not copy ssh key" << std::endl;
+ SAGA_LOG_ALWAYS ("could not copy ssh key");
throw;
}
@@ -383,7 +384,7 @@
// (FIXME), but allows us to have a uniform SAGA configuration for all VMs.
// FIXME: that should be better done with the prep scripts above.
- std::cout << "copying ~/.saga.ini" << std::endl;
+ SAGA_LOG_ALWAYS ("copying ~/.saga.ini");
proc.set_cmd ("/usr/bin/scp");
proc.clear_args ();
@@ -410,7 +411,7 @@
if ( proc.fail () )
{
- std::cout << "could not copy saga.ini" << std::endl;
+ SAGA_LOG_ALWAYS ("could not copy saga.ini");
throw;
}
@@ -457,7 +458,7 @@
msg += vm_id_;
SAGA_LOG_ALWAYS (msg.c_str ());
- saga::adaptors::utils::process proc (ini_["ec2_home"] + "/bin/ec2-terminate-instances", env_);
+ saga::adaptors::utils::process proc (ini_["ec2_scripts"] + "/ec2-terminate-instances", env_);
proc.add_arg (vm_id_);
(void) proc.run_sync ();
@@ -508,6 +509,36 @@
SAGA_ADAPTOR_THROW ("Not Implemented", saga::NotImplemented);
}
+ void job_service_cpi_impl::dump_context (saga::context c)
+ {
+ std::cout << " --------------------------------------\n";
+
+ std::vector <std::string> attribs = c.list_attributes ();
+
+ for ( int i = 0; i < attribs.size (); i++ )
+ {
+ std::string key = attribs[i];
+ std::string val;
+
+ if ( c.attribute_is_vector (key) )
+ {
+ std::vector <std::string> vals = c.get_vector_attribute (key);
+ for ( int j = 0; j < vals.size (); j++ )
+ {
+ val += vals[j] + " ";
+ }
+ }
+ else
+ {
+ val = c.get_attribute (key);
+ }
+
+ std::cout << key << " \t: " << val << std::endl;
+ }
+
+ std::cout << " --------------------------------------\n";
+ }
+
} // namespace aws_job
////////////////////////////////////////////////////////////////////////
File [modified]: aws_job_service.hpp
Delta lines: +2 -0
===================================================================
--- trunk/adaptors/aws/aws_job/aws_job_service.hpp 2009-01-16 16:21:16 UTC (rev 3308)
+++ trunk/adaptors/aws/aws_job/aws_job_service.hpp 2009-01-16 16:21:53 UTC (rev 3309)
@@ -58,7 +58,9 @@
std::map <std::string, std::string> ini_;
std::map <std::string, std::string> env_;
+ void dump_context (saga::context c);
+
public:
// constructor of the job_service cpi
job_service_cpi_impl (proxy * p,
More information about the saga-devel
mailing list