[Saga-devel] saga SVN commit 3242: /trunk/examples/misc/

amerzky at cct.lsu.edu amerzky at cct.lsu.edu
Tue Jan 6 03:52:17 CST 2009


User: amerzky
Date: 2009/01/06 03:52 AM

Modified:
 /trunk/examples/misc/
  aws.cpp

Log:
 some code cleanup and documentation

File Changes:

Directory: /trunk/examples/misc/
================================

File [modified]: aws.cpp
Delta lines: +29 -34
===================================================================
--- trunk/examples/misc/aws.cpp	2009-01-06 09:46:03 UTC (rev 3241)
+++ trunk/examples/misc/aws.cpp	2009-01-06 09:52:00 UTC (rev 3242)
@@ -6,8 +6,6 @@
 
 #include <saga/saga.hpp>
 
-#define COUNT 100
-
 void print_io (saga::job::job j)
 {
   saga::job::istream out = j.get_stdout ();
@@ -39,41 +37,29 @@
                  std::string            type, 
                  std::string            instance = "")
 {
+
   saga::url js_url (type + "://" + instance);
 
-  std::cout << " ----------------------- 0 (" << type << ") \n";
+  std::cout << " ----------------------- (" << type << " - " << js_url << ") \n";
 
-  saga::session s1;
 
-  std::cout << " ----------------------- 1 (" << type << ") \n";
+  // create a context for that cloud type
+  saga::context c (type);
+  c.set_defaults ();
 
-  saga::context c1 (type);
+  // attach it to the session
+  saga::session s;
+  s.add_context (c);
 
-  std::cout << " ----------------------- 2 (" << type << ") \n";
+  // create a job service in that session
+  saga::job::service js (s, js_url);
 
-  c1.set_defaults ();
+  // create and run a job on that job service (i.e. on that VM)
+  saga::job::job j = js.create_job (jd);
+  j.run ();
 
-  std::cout << " ----------------------- 3 (" << type << ") \n";
-
-  s1.add_context (c1);
-
-  std::cout << " ----------------------- 4 (" << type << " - " << js_url << ") \n";
-
-  saga::job::service js1 (s1, js_url);
-
-  std::cout << " ----------------------- 5 (" << type << ") \n";
-
-  saga::job::job j1 = js1.create_job (jd);
-
-  std::cout << " ----------------------- 6 (" << type << ") \n";
-
-  j1.run ();
-
-  std::cout << " ----------------------- 7 (" << type << ") \n";
-
-  print_io (j1);
-
-  std::cout << " ----------------------- 8 (" << type << ") \n";
+  // print job output
+  print_io (j);
 }
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -96,21 +82,30 @@
 
     jd.set_vector_attribute (saga::job::attributes::description_arguments, args);
 
-    saga::url t ("file://localhost//Users/merzky/links/saga/projects/applications/MapReduce/samples/file.txt");
 
     //  FIXME: the job service contact should point to the ec2 service instance.
     //  Problem: what protocol to use?  We need to denotify the context type (do
-    //  we?), _and_ the ec2 service protocol (http/https).
+    //  we?), _and_ the ec2 service protocol (http/https).  Anyway, this needs to 
+    //  be fixed in the adaptor.
     //
     // "https://ec2.amazonaws.com/"
     // "http://mayhem9.cs.ucsb.edu:8773/services/Eucalyptus"
     // "https://tp-vm1.ci.uchicago.edu:8445/wsrf/services/ElasticNimbusService"
     // "https://vm02.cct.lsu.edu:8443/"
-    
- // test_cloud (jd, "ec2");
-    test_cloud (jd, "ec2",        "i-d642c7bf");
+
+    // create a new instance on ec2, and run a test job
+    test_cloud (jd, "ec2");
+
+    // access a running VM instance on ec2, and run a test job
+ // test_cloud (jd, "ec2",        "i-d642c7bf");
+
+    // samoe for eucalyptus
+ // test_cloud (jd, "eucalyptus");
  // test_cloud (jd, "eucalyptus", "i-417E085F");
+
+    // samoe for nimbus
  // test_cloud (jd, "nimbus");
+ // test_cloud (jd, "nimbus",     "i-3247A527");
   
   }
   catch ( saga::exception const & e )



More information about the saga-devel mailing list