#!/usr/local/bin/python """ Aanet scripts can submit themselves to the Lyon batch queue. The persistence is provided by the aa.Job class. All the fields of Job objects that exist when calling job.submit() will also be available in the batch job. This works via environment variables that are transferend to the batch job via 'qsub -V'. """ import os,sys, aa from ROOT import * # define what we want to do runs = [ 100, 101, 102, 103, 104 ] job = aa.Job("jobname") # jobname is what you see when doing qstat. if job.batch : # we are on the batch farm! print "hi this is batch job for run", job.runnumber else : # we either want to submit jobs... if 'submit' in sys.argv: # submit the jobs to the farm and exit for run in runs : job.runnumber = run job.nevents = 30 job.logfile = "/sps/km3net/users/heijboer/scratch/aa"+str(job.runnumber)+".log" job.submit() # this calls qsub sys.exit(); #...or we want to run our script interactively, # usually on a reduced dataset for testing job.runnumber = runs[0] job.nevents = 3 # What follows is the analysis code that is common to the test-jobs # that we run interactively at development and the jobs that run # on the farm. The only differnce is the state of the Job object. from time import sleep for i in range ( job.nevents ) : print " now processing run", job.runnumber," event",i sleep(1)