import sys
import saga

def main():
    try:
        # Your ssh identity on the remote machine
        ctx = saga.Context("ssh")
        ctx.user_id = "oweidner" 

        session = saga.Session()
        session.add_context(ctx)

        # Create a job service object that represent the local machine.
        # The keyword 'fork://' in the url scheme triggers the 'shell' adaptor
        # which can execute jobs on the local machine as well as on a remote
        # machine via "ssh://hostname".
        js = saga.job.Service("ssh://gw68.quarry.iu.teragrid.org", session=session)

        # describe our job
        jd = saga.job.Description()

        # Next, we describe the job we want to run. A complete set of job
        # description attributes can be found in the API documentation.
        jd.environment     = {'MYOUTPUT':'"Hello from SAGA"'}
        jd.executable      = '/bin/echo'
        jd.arguments       = ['$MYOUTPUT']
        jd.output          = "mysagajob.stdout"
        jd.error           = "mysagajob.stderr"

        # Create a new job from the job description. The initial state of
        # the job is 'New'.
        myjob = js.create_job(jd)

        # Check our job's id and state
        print "Job ID    : %s" % (myjob.id)
        print "Job State : %s" % (myjob.state)

        print "\n...starting job...\n"

        # Now we can start our job.
        myjob.run()

        print "Job ID    : %s" % (myjob.id)
        print "Job State : %s" % (myjob.state)

        print "\n...waiting for job...\n"
        # wait for the job to either finish or fail
        myjob.wait()

        print "Job State : %s" % (myjob.state)
        print "Exitcode  : %s" % (myjob.exit_code)

        return 0

    except saga.SagaException, ex:
        # Catch all saga exceptions
        print "An exception occured: (%s) %s " % (ex.type, (str(ex)))
        # Trace back the exception. That can be helpful for debugging.
        print " \n*** Backtrace:\n %s" % ex.traceback
        return -1


if __name__ == "__main__":
    sys.exit(main())

@@ -87,17 +87,39 @@
  machine
+. Change if necessary.
 %0A
-
         
@@ -152,16 +152,17 @@
         
+#
 ctx.user
@@ -165,16 +165,17 @@
 user_id 
+ 
 = %22oweid
@@ -178,17 +178,76 @@
 weidner%22
- 
+%0A        #ctx.user_key = %22/Users/oweidner/.ssh/sagaproj_rsa%22
 %0A%0A      
@@ -574,16 +574,123 @@
 stname%22.
+ You can use 'localhost' or replace%0A        # it with the name/address of a machien you have ssh access to.
 %0A       
@@ -723,35 +723,17 @@
 h://
-gw68.quarry.iu.teragrid.org
+localhost
 %22, s
@@ -959,16 +959,16 @@
 tation.%0A
-
         
@@ -1000,16 +1000,17 @@
 OUTPUT':
+ 
 '%22Hello 

make example work with Jenkins