Пример #1
0
def main():
    
    try:
        # list of resource that are potentially 
        # available 
        machines = {
          'xray'    : 'pbs+ssh://xray.futuregrid.org',
          'india'   : 'pbs+ssh://india.futuregrid.org',
          'alamo'   : 'pbs+ssh://alamo.futuregrid.org',
          'louie'   : 'pbs+ssh://louie.loni.org',
          'queenbee': 'pbs+ssh://queenbee.loni.org'
        }

        # set up the security context:
        # if no security context is defined, the PBS
        # plugin will pick up the default set of ssh 
        # credentials of the user, i.e., ~/.ssh/id_rsa
        ctx = saga.context()
        ctx.type = saga.context.SSH
        ctx.userid  = 'oweidner' # like 'ssh username@host ...'
        ctx.userkey = '/Users/oweidner/.ssh/id_rsa_fg' # like ssh -i ...'

        # get some infos about the resources in our 
        # list, like number of waiting jobs, architecture, etc... 
        for machine in machines:
            print "\nResource: %s" % (machine)
            # create a discoverer and retrieve a list
            # of available serivces 
            sdd = saga.sd.discoverer(machines[machine])
            sdd.session.contexts.append(ctx)
            services = sdd.list_services() # filter: org.ogf.saga.service.job

            for service in services:
                # for each service, get some key metrics via the
                # service data object
                data = service.get_data()

                print "  * Serivce: '%s', type: '%s', url: '%s'" \
                  % (service.name, service.type, service.url)
                print "    |- Running Jobs         : %s" \
                  % (data.get_attribute("GlueCEStateRunningJobs"))      
                print "    |- Pending Jobs         : %s" \
                  % (data.get_attribute("GlueCEStateWaitingJobs"))   
                print "    |- Memory per Node      : %.2f GB" \
                  % (float(data.get_attribute("GlueHostMainMemoryRAMSize"))/1048576.0)     
                print "    |- Total CPUs           : %s" \
                  % (data.get_attribute("GlueSubClusterPhysicalCPUs"))      
                print "    |- Free CPUs            : %s" \
                  % (data.get_attribute("GlueCEStateFreeCPUs"))      
                print "    '- CPUs per Node        : %s" \
                  % (data.get_attribute("GlueHostArchitectureSMPSize"))      

    except saga.exception, ex:
        print "Oh, snap! An error occured: %s" % (str(ex))
Пример #2
0
def main():

    try:
        # list of resource that are potentially
        # available
        machines = {
            'xray': 'pbs+ssh://xray.futuregrid.org',
            'india': 'pbs+ssh://india.futuregrid.org',
            'alamo': 'pbs+ssh://alamo.futuregrid.org',
            'louie': 'pbs+ssh://louie.loni.org',
            'queenbee': 'pbs+ssh://queenbee.loni.org'
        }

        # set up the security context:
        # if no security context is defined, the PBS
        # plugin will pick up the default set of ssh
        # credentials of the user, i.e., ~/.ssh/id_rsa
        ctx = saga.context()
        ctx.type = saga.context.SSH
        ctx.userid = 'oweidner'  # like 'ssh username@host ...'
        ctx.usercert = '/Users/oweidner/.ssh/id_rsa_fg'  # like ssh -i ...'

        # get some infos about the resources in our
        # list, like number of waiting jobs, architecture, etc...
        for machine in machines:
            print "\nResource: %s" % (machine)
            # create a discoverer and retrieve a list
            # of available serivces
            sdd = saga.sd.discoverer(machines[machine])
            sdd.session.contexts.append(ctx)
            services = sdd.list_services()  # filter: org.ogf.saga.service.job

            for service in services:
                # for each service, get some key metrics via the
                # service data object
                data = service.get_data()

                print "  * Serivce: '%s', type: '%s', url: '%s'" \
                  % (service.name, service.type, service.url)
                print "    |- Running Jobs         : %s" \
                  % (data.get_attribute("GlueCEStateRunningJobs"))
                print "    |- Waiting Jobs         : %s" \
                  % (data.get_attribute("GlueCEStateWaitingJobs"))
                print "    |- Memory per Node      : %.2f GB" \
                  % (float(data.get_attribute("GlueHostMainMemoryRAMSize"))/1048576.0)
                print "    |- Total CPUs           : %s" \
                  % (data.get_attribute("GlueSubClusterPhysicalCPUs"))
                print "    |- Free CPUs            : %s" \
                  % (data.get_attribute("GlueCEStateFreeCPUs"))
                print "    '- CPUs per Node        : %s" \
                  % (data.get_attribute("GlueHostArchitectureSMPSize"))

    except saga.exception, ex:
        print "Oh, snap! An error occured: %s" % (str(ex))
Пример #3
0
def main():
    
    try:
        # set up a security context (optional)
        # if no security context is defined, the PBS
        # plugin will pick up the default set of ssh 
        # credentials of the user, i.e., ~/.ssh/id_rsa
        ctx = saga.context()
        ctx.type = saga.context.SSH
        ctx.userid  = 'oweidner' # like 'ssh username@host ...'
        ctx.usercert = '/Users/oweidner/.ssh/id_rsa_fg' # like ssh -i ...'
 
        # create a job service for Futuregrid's 'india' PBS cluster
        # and attach the SSH security context to it
        js = saga.job.service("pbs+ssh://alamo.futuregrid.org")
        js.session.contexts.append(ctx)

        # describe our job
        jd = saga.job.description()
        # resource requirements
        jd.wall_time_limit  = "0:05:00"
        jd.total_cpu_count = 1     
        # environment, executable & arguments
        jd.environment = {'SLEEP_TIME':'10'}       
        jd.executable  = '/bin/sleep'
        jd.arguments   = ['$SLEEP_TIME']
        # output options
        jd.output = "bliss_pbssh_job.stdout"
        jd.error  = "bliss_pbssh_job.stderr"

        # create the job (state: New)
        myjob = js.create_job(jd)

        print "Job ID    : %s" % (myjob.jobid)
        print "Job State : %s" % (myjob.get_state())

        print "\n...starting job...\n"
        # run the job (submit the job to PBS)
        myjob.run()

        print "Job ID    : %s" % (myjob.jobid)
        print "Job State : %s" % (myjob.get_state())

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

        print "Job State : %s" % (myjob.get_state())
        print "Exitcode  : %s" % (myjob.exitcode)

    except saga.exception, ex:
        print "Oh, snap! An error occured: %s" % (str(ex))
Пример #4
0
def main():
    
    try:
        # set up a security context (optional)
        # if no security context is defined, the PBS
        # plugin will pick up the default set of ssh 
        # credentials of the user, i.e., ~/.ssh/id_rsa
        ctx = saga.context()
        ctx.type = saga.context.SSH
        ctx.userid  = 'oweidner' # like 'ssh username@host ...'
        ctx.usercert = '/Users/s1063117/.ssh/id_rsa' # like ssh -i ...'

        session = saga.session()
        session.contexts.append(ctx)
 
        mydir = saga.filesystem.directory("sftp://india.futuregrid.org/tmp", session=session)
        for entry in mydir.list():
            print entry

    except saga.exception, ex:
        print "Oh, snap! An error occured: %s" % (str(ex))
Пример #5
0
def main():

    try:
        # set up a security context (optional)
        # if no security context is defined, the PBS
        # plugin will pick up the default set of ssh
        # credentials of the user, i.e., ~/.ssh/id_rsa
        ctx = saga.context()
        ctx.type = saga.context.SSH
        ctx.userid = 'oweidner'  # like 'ssh username@host ...'
        ctx.usercert = '/Users/s1063117/.ssh/id_rsa'  # like ssh -i ...'

        session = saga.session()
        session.contexts.append(ctx)

        mydir = saga.filesystem.directory("sftp://india.futuregrid.org/tmp",
                                          session=session)
        for entry in mydir.list():
            print entry

    except saga.exception, ex:
        print "Oh, snap! An error occured: %s" % (str(ex))