PEATSA/WebApp/RemoteLaunch.py
def main(parser, options, job):

	'''Launches the job on a remote cluster'''
	
	#Get information for running the job remotely
	identityFile = options.get('CLUSTER', 'identityFile')
	user = options.get('CLUSTER', 'user')
	host = options.get('CLUSTER', 'host')
	webServerDirectory =  options.get('WEB APPLICATION', 'webServerDirectory')
	outputDirectory = parser.outputDirectory()	
		
	#Create PBS file
	pbsScript = PEATSAParallel.PBSScriptFromConfiguration(options, arguments=sys.argv[1:], 
					 runDirectory=outputDirectory, logDirectory=outputDirectory)
	
	#Write the PBS file to the web server directory for the job	
	filename = os.path.join(webServerDirectory, "%s.pbs" % parser.jobID())
	stream = open(filename, "w+")
	stream.write(pbsScript)
	stream.close()
	
	#Create the output directory for the job on the remote machine
	retval = Command(command="mkdir", 
			argumentString=outputDirectory, 
			identityFile=identityFile, 
			user=user, 
			host=host)
	
	if(retval != 0):
		job.setError(description="Error during remote launch",
			detailedDescription="Unable to create job output directory")
		sys.exit(retval)	
		
	#Copy the PBS script to the run dir
	Copy(source=filename, 
		destination=outputDirectory, 
		identityFile=identityFile, 
		user=user, 
		host=host) 
		
	if(retval != 0):
		job.setError(description="Error during remote launch",
			detailedDescription="Unable to copy PBS script to output directory")
		sys.exit(retval)	
	
	#Copy the pdb file to the run dir
	#Split because pdbFile is full file name
	#Note: A pdb file is not present if scan was selected
	if not parser.scan():
		pdbCode = os.path.split(parser.pdbFile())[1]
		localPdbFile = os.path.join(webServerDirectory, parser.jobID())
		localPdbFile = os.path.join(localPdbFile, pdbCode)
		Copy(source=localPdbFile, 
			destination=outputDirectory, 
			identityFile=identityFile, 
			user=user, 
			host=host) 
		
	if(retval != 0):
		job.setError(description="Error during remote launch",
			detailedDescription="Unable to copy pdb to output directory")
		sys.exit(retval)	
	
	#If there is a ligand copy it to the run dir
	if parser.ligandFile() is not None:
		localFile = os.path.join(webServerDirectory, parser.jobID())
		localFile = os.path.join(localFile, os.path.split(parser.ligandFile())[1])
		Copy(source=localFile, 
			destination=outputDirectory, 
			identityFile=identityFile, 
			user=user, 
			host=host)
			
		if(retval != 0):
			job.setError(description="Error during remote launch",
				detailedDescription="Unable to copy ligand to output directory")
			sys.exit(retval)	
			
	#If there is a mutation list copy it to the run dir
	if parser.mutationListFile() is not None:
		localFile = os.path.join(webServerDirectory, parser.jobID())
		localFile = os.path.join(localFile, os.path.split(parser.mutationListFile())[1])
		Copy(source=localFile, 
			destination=outputDirectory, 
			identityFile=identityFile, 
			user=user, 
			host=host)
			
		if(retval != 0):
			job.setError(description="Error during remote launch",
				detailedDescription="Unable to copy mutation file to output directory")
			sys.exit(retval)	

	#Submit the job
	Command(command="qsub", 
		argumentString=os.path.join(outputDirectory, "%s.pbs" % parser.jobID()), 
		identityFile=identityFile, 
		user=user, 
		host=host)
		
	if(retval != 0):
		job.setError(description="Error during remote launch",
			detailedDescription="Failed to submit job to queue")
		sys.exit(retval)
Launches the job on a remote cluster
Launches the job on a remote cluster
Launches the job on a remote cluster
def main(parser, options, job):
	identityFile = options.get('CLUSTER', 'identityFile')
	user = options.get('CLUSTER', 'user')
	host = options.get('CLUSTER', 'host')
	webServerDirectory =  options.get('WEB APPLICATION', 'webServerDirectory')
	outputDirectory = parser.outputDirectory()	
	pbsScript = PEATSAParallel.PBSScriptFromConfiguration(options, arguments=sys.argv[1:], 
					 runDirectory=outputDirectory, logDirectory=outputDirectory)
	filename = os.path.join(webServerDirectory, "%s.pbs" % parser.jobID())
	stream = open(filename, "w+")
	stream.write(pbsScript)
	stream.close()
	retval = Command(command="mkdir", 
			argumentString=outputDirectory, 
			identityFile=identityFile, 
			user=user, 
			host=host)
	if(retval != 0):
		job.setError(description="Error during remote launch",
			detailedDescription="Unable to create job output directory")
		sys.exit(retval)	
	Copy(source=filename, 
		destination=outputDirectory, 
		identityFile=identityFile, 
		user=user, 
		host=host) 
	if(retval != 0):
		job.setError(description="Error during remote launch",
			detailedDescription="Unable to copy PBS script to output directory")
		sys.exit(retval)	
	if not parser.scan():
		pdbCode = os.path.split(parser.pdbFile())[1]
		localPdbFile = os.path.join(webServerDirectory, parser.jobID())
		localPdbFile = os.path.join(localPdbFile, pdbCode)
		Copy(source=localPdbFile, 
			destination=outputDirectory, 
			identityFile=identityFile, 
			user=user, 
			host=host) 
	if(retval != 0):
		job.setError(description="Error during remote launch",
			detailedDescription="Unable to copy pdb to output directory")
		sys.exit(retval)	
	if parser.ligandFile() is not None:
		localFile = os.path.join(webServerDirectory, parser.jobID())
		localFile = os.path.join(localFile, os.path.split(parser.ligandFile())[1])
		Copy(source=localFile, 
			destination=outputDirectory, 
			identityFile=identityFile, 
			user=user, 
			host=host)
		if(retval != 0):
			job.setError(description="Error during remote launch",
				detailedDescription="Unable to copy ligand to output directory")
			sys.exit(retval)	
	if parser.mutationListFile() is not None:
		localFile = os.path.join(webServerDirectory, parser.jobID())
		localFile = os.path.join(localFile, os.path.split(parser.mutationListFile())[1])
		Copy(source=localFile, 
			destination=outputDirectory, 
			identityFile=identityFile, 
			user=user, 
			host=host)
		if(retval != 0):
			job.setError(description="Error during remote launch",
				detailedDescription="Unable to copy mutation file to output directory")
			sys.exit(retval)	
	Command(command="qsub", 
		argumentString=os.path.join(outputDirectory, "%s.pbs" % parser.jobID()), 
		identityFile=identityFile, 
		user=user, 
		host=host)
	if(retval != 0):
		job.setError(description="Error during remote launch",
			detailedDescription="Failed to submit job to queue")
		sys.exit(retval)
def main ( parser , options , job ) : identityFile = options . get ( 'CLUSTER' , 'identityFile' ) user = options . get ( 'CLUSTER' , 'user' ) host = options . get ( 'CLUSTER' , 'host' ) webServerDirectory = options . get ( 'WEB APPLICATION' , 'webServerDirectory' ) outputDirectory = parser . outputDirectory ( ) pbsScript = PEATSAParallel . PBSScriptFromConfiguration ( options , arguments = sys . argv [ 1 : ] , runDirectory = outputDirectory , logDirectory = outputDirectory ) filename = os . path . join ( webServerDirectory , "%s.pbs" % parser . jobID ( ) ) stream = open ( filename , "w+" ) stream . write ( pbsScript ) stream . close ( ) retval = Command ( command = "mkdir" , argumentString = outputDirectory , identityFile = identityFile , user = user , host = host ) if ( retval != 0 ) : job . setError ( description = "Error during remote launch" , detailedDescription = "Unable to create job output directory" ) sys . exit ( retval ) Copy ( source = filename , destination = outputDirectory , identityFile = identityFile , user = user , host = host ) if ( retval != 0 ) : job . setError ( description = "Error during remote launch" , detailedDescription = "Unable to copy PBS script to output directory" ) sys . exit ( retval ) if not parser . scan ( ) : pdbCode = os . path . split ( parser . pdbFile ( ) ) [ 1 ] localPdbFile = os . path . join ( webServerDirectory , parser . jobID ( ) ) localPdbFile = os . path . join ( localPdbFile , pdbCode ) Copy ( source = localPdbFile , destination = outputDirectory , identityFile = identityFile , user = user , host = host ) if ( retval != 0 ) : job . setError ( description = "Error during remote launch" , detailedDescription = "Unable to copy pdb to output directory" ) sys . exit ( retval ) if parser . ligandFile ( ) is not None : localFile = os . path . join ( webServerDirectory , parser . jobID ( ) ) localFile = os . path . join ( localFile , os . path . split ( parser . ligandFile ( ) ) [ 1 ] ) Copy ( source = localFile , destination = outputDirectory , identityFile = identityFile , user = user , host = host ) if ( retval != 0 ) : job . setError ( description = "Error during remote launch" , detailedDescription = "Unable to copy ligand to output directory" ) sys . exit ( retval ) if parser . mutationListFile ( ) is not None : localFile = os . path . join ( webServerDirectory , parser . jobID ( ) ) localFile = os . path . join ( localFile , os . path . split ( parser . mutationListFile ( ) ) [ 1 ] ) Copy ( source = localFile , destination = outputDirectory , identityFile = identityFile , user = user , host = host ) if ( retval != 0 ) : job . setError ( description = "Error during remote launch" , detailedDescription = "Unable to copy mutation file to output directory" ) sys . exit ( retval ) Command ( command = "qsub" , argumentString = os . path . join ( outputDirectory , "%s.pbs" % parser . jobID ( ) ) , identityFile = identityFile , user = user , host = host ) if ( retval != 0 ) : job . setError ( description = "Error during remote launch" , detailedDescription = "Failed to submit job to queue" ) sys . exit ( retval )
Launches the job on a remote cluster
Launches the job on a remote cluster
'''Launches the job on a remote cluster''' #Get information for running the job remotely #Create PBS file #Write the PBS file to the web server directory for the job	 #Create the output directory for the job on the remote machine #Copy the PBS script to the run dir #Copy the pdb file to the run dir #Split because pdbFile is full file name #Note: A pdb file is not present if scan was selected #If there is a ligand copy it to the run dir #If there is a mutation list copy it to the run dir #Submit the job
parser
options
job