[Saga-devel] ssh job adaptor

Andre Merzky andre at merzky.net
Fri Jan 9 06:13:52 CST 2009


The ssh job adaptor should be usable now - I'd be happy if
people could give it a try, and post feedback.

I attach the README, which contains a blurb about
limitations.

examples/misc contains ssh_job.cpp and ssh_file.cpp, which
you can use to play around with the ssh adaptors.

Cheers, Andre.

------------------------------------------------------------------------
  #include <saga/saga.hpp>

  int main ()
  {
    saga::context c ("ssh");
    c.set_attribute ("UserID", "merzky");
    c.set_defaults  ();

    saga::session s;
    s.add_context (c);

    std::string host = "qb.loni.org";

    saga::job::service js (s, std::string ("ssh://") + host);
    
    saga::job::ostream in;
    saga::job::istream out;
    saga::job::istream err;

    saga::job::job j = js.run_job ("/bin/uname -a", host, in, out, err);

    while ( true )
    {
      char buffer[255];
      out.read (buffer, sizeof (buffer));

      if ( out.gcount () > 0 )
        std::cout << std::string (buffer, out.gcount ());
      if ( out.fail () )
        break;
    }

    j.wait ();

    if ( j.get_state () == saga::job::Done )
      std::cout << "job done\n";
    else
      std::cout << "job failed\n";
  }
------------------------------------------------------------------------

------------------------------------------------------------------------
Jonas merzky ~/links/saga/trunk/examples/misc : make && ./ssh_job
Linux qb3 2.6.9-55.0.9.EL_lustre.1.6.4custom #20 SMP Wed Dec 12 10:58:22 CST 2007 x86_64 x86_64 x86_64 GNU/Linux
job done
------------------------------------------------------------------------



-- 
Nothing is ever easy.


More information about the saga-devel mailing list