ARC SDK
Job Status
1 #! /usr/bin/env python
2 import arc
3 import sys
4 import os
5 
6 def example():
7  # Creating a UserConfig object with the user's proxy
8  # and the path of the trusted CA certificates
9  uc = arc.UserConfig()
10  uc.ProxyPath("/tmp/x509up_u%s" % os.getuid())
11  uc.CACertificatesDirectory("/etc/grid-security/certificates")
12 
13  # Create a new job object with a given JobID
14  job = arc.Job()
15  job.JobID = "https://piff.hep.lu.se:443/arex/1QuMDmRwvUfn5h5iWqkutBwoABFKDmABFKDmIpHKDmXBFKDmIuAean"
16  job.Flavour = "ARC1"
17  job.JobManagementURL = arc.URL("https://piff.hep.lu.se:443/arex")
18  job.JobStatusURL = arc.URL("https://piff.hep.lu.se:443/arex")
19 
20  print "Job object before update:"
21  job.SaveToStream(arc.CPyOstream(sys.stdout), True)
22 
23  job_supervisor = arc.JobSupervisor(uc, [job])
24 
25  # Update the states of jobs within this JobSupervisor
26  job_supervisor.Update()
27 
28  # Get our updated job from the JobSupervisor
29  jobs = job_supervisor.GetAllJobs()
30  job = jobs[0]
31 
32  print "Job object after update:"
33  job.SaveToStream(arc.CPyOstream(sys.stdout), True)
34 
35 # wait for all the background threads to finish before we destroy the objects they may use
36 import atexit
37 @atexit.register
38 def wait_exit():
39  arc.ThreadInitializer().waitExit()
40 
41 # arc.Logger.getRootLogger().addDestination(arc.LogStream(sys.stderr))
42 # arc.Logger.getRootLogger().setThreshold(arc.DEBUG)
43 
44 # run the example
45 example()