Changeset 3243

Show
Ignore:
Timestamp:
1/6/2009 3:52:00 AM (11 months ago)
Author:
amerzky
Message:

some code cleanup and documentation

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • saga/trunk/examples/misc/aws.cpp

    r3242 r3243  
    66 
    77#include <saga/saga.hpp> 
    8  
    9 #define COUNT 100 
    108 
    119void print_io (saga::job::job j) 
     
    4038                 std::string            instance = "") 
    4139{ 
     40 
    4241  saga::url js_url (type + "://" + instance); 
    4342 
    44   std::cout << " ----------------------- 0 (" << type << ") \n"; 
     43  std::cout << " ----------------------- (" << type << " - " << js_url << ") \n"; 
    4544 
    46   saga::session s1; 
    4745 
    48   std::cout << " ----------------------- 1 (" << type << ") \n"; 
     46  // create a context for that cloud type 
     47  saga::context c (type); 
     48  c.set_defaults (); 
    4949 
    50   saga::context c1 (type); 
     50  // attach it to the session 
     51  saga::session s; 
     52  s.add_context (c); 
    5153 
    52   std::cout << " ----------------------- 2 (" << type << ") \n"; 
     54  // create a job service in that session 
     55  saga::job::service js (s, js_url); 
    5356 
    54   c1.set_defaults (); 
     57  // create and run a job on that job service (i.e. on that VM) 
     58  saga::job::job j = js.create_job (jd); 
     59  j.run (); 
    5560 
    56   std::cout << " ----------------------- 3 (" << type << ") \n"; 
    57  
    58   s1.add_context (c1); 
    59  
    60   std::cout << " ----------------------- 4 (" << type << " - " << js_url << ") \n"; 
    61  
    62   saga::job::service js1 (s1, js_url); 
    63  
    64   std::cout << " ----------------------- 5 (" << type << ") \n"; 
    65  
    66   saga::job::job j1 = js1.create_job (jd); 
    67  
    68   std::cout << " ----------------------- 6 (" << type << ") \n"; 
    69  
    70   j1.run (); 
    71  
    72   std::cout << " ----------------------- 7 (" << type << ") \n"; 
    73  
    74   print_io (j1); 
    75  
    76   std::cout << " ----------------------- 8 (" << type << ") \n"; 
     61  // print job output 
     62  print_io (j); 
    7763} 
    7864 
     
    9783    jd.set_vector_attribute (saga::job::attributes::description_arguments, args); 
    9884 
    99     saga::url t ("file://localhost//Users/merzky/links/saga/projects/applications/MapReduce/samples/file.txt"); 
    10085 
    10186    //  FIXME: the job service contact should point to the ec2 service instance. 
    10287    //  Problem: what protocol to use?  We need to denotify the context type (do 
    103     //  we?), _and_ the ec2 service protocol (http/https). 
     88    //  we?), _and_ the ec2 service protocol (http/https).  Anyway, this needs to  
     89    //  be fixed in the adaptor. 
    10490    // 
    10591    // "https://ec2.amazonaws.com/" 
     
    10793    // "https://tp-vm1.ci.uchicago.edu:8445/wsrf/services/ElasticNimbusService" 
    10894    // "https://vm02.cct.lsu.edu:8443/" 
    109      
    110  // test_cloud (jd, "ec2"); 
    111     test_cloud (jd, "ec2",        "i-d642c7bf"); 
     95 
     96    // create a new instance on ec2, and run a test job 
     97    test_cloud (jd, "ec2"); 
     98 
     99    // access a running VM instance on ec2, and run a test job 
     100 // test_cloud (jd, "ec2",        "i-d642c7bf"); 
     101 
     102    // samoe for eucalyptus 
     103 // test_cloud (jd, "eucalyptus"); 
    112104 // test_cloud (jd, "eucalyptus", "i-417E085F"); 
     105 
     106    // samoe for nimbus 
    113107 // test_cloud (jd, "nimbus"); 
     108 // test_cloud (jd, "nimbus",     "i-3247A527"); 
    114109   
    115110  }