##################################################################### # launchAppManRSL.py (Jython) # # Launches an Application Manager, uploads and runs printenv.py. # Version 2: uses appMan.sh ("batch-adapted"). # # Since we must pass parameters directly to the # appMan.AppManComponent call, we cannot use the cca module's # "createComponent" method, but must directly construct the # RSL and use it to invoke Gram.request. # # Given that this is simply for demonstration purposes, we # do not set any of the arguments necessary for a batch run, # and we submit the job interactively rather than through the # batch jobmanager. # # Arguments to appMan.AppManComponent: # # [1] = host # [2] = job id # [3] = path for python script # [4-n] = parameters for python script (here, none) # # Example code by Albert L. Rossi, IU Extreme! Computing # December 2001 ##################################################################### import sys from java.lang import * from org.globus.gram import * jobID = "appManBAdemo" dir = "/u/arossi/Extreme/docs/tutorials/xcat_tutorial/scripts" host = "k2.extreme.indiana.edu" launchScript = "appMan.sh" uploadScript = dir + "/printenv.py" ## construct RSL ... theRSL = "&(executable=\"appMan.sh\")" theRSL = theRSL + "(arguments=\"" + host + "\" " theRSL = theRSL + "\"" + jobID + "\" " theRSL = theRSL + "\"" + uploadScript + "\")" theRSL = theRSL + "(directory=\"" + dir + "\")" theRSL = theRSL + "(stdout=\"" + dir + "/" + jobID + ".out\")" theRSL = theRSL + "(stderr=\"" + dir + "/" + jobID + ".err\")" theJob = GramJob(theRSL) try: Gram.request(host, theJob, 0, 0) except Exception, e: System.err.println("Error submitting gram job: " + e) ## comment this out if you are running from a portal System.exit(0)