import arc
import sys
import os
def example():
uc = arc.UserConfig()
uc.ProxyPath("/tmp/x509up_u%s" % os.getuid())
uc.CACertificatesDirectory("/etc/grid-security/certificates")
job = arc.Job()
job.JobID = "https://piff.hep.lu.se:443/arex/hYDLDmyxvUfn5h5iWqkutBwoABFKDmABFKDmIpHKDmYBFKDmtRy9En"
job.IDFromEndpoint = "hYDLDmyxvUfn5h5iWqkutBwoABFKDmABFKDmIpHKDmYBFKDmtRy9En"
job.ServiceInformationURL = job.JobStatusURL = job.JobManagementURL = arc.URL("https://piff.hep.lu.se:443/arex")
job.JobStatusInterfaceName = 'org.ogf.glue.emies.activitymanagement'
job.JobManagementInterfaceName = 'org.ogf.glue.emies.activitymanagement'
sys.stdout.write("Get job information from the computing element...\n")
job_supervisor = arc.JobSupervisor(uc, [job])
job_supervisor.Update()
sys.stdout.write("Downloading results...\n")
downloadeddirectories = arc.StringList()
success = job_supervisor.Retrieve("/tmp", False, False, downloadeddirectories)
if not success:
sys.stdout.write("Downloading results failed.\n")
for downloadeddirectory in downloadeddirectories:
sys.stdout.write("Job results were downloaded to %s\n"%str(downloadeddirectory))
sys.stdout.write("Contents of the directory:\n")
for filename in os.listdir(downloadeddirectory):
sys.stdout.write(" %s\n"%filename)
import atexit
@atexit.register
def wait_exit():
arc.ThreadInitializer().waitExit()
example()