PEATSA/Core/Programs.py
def _processTasks(self, taskArray, results, standardOut, scanLogStream, verbose, checkInterval, skewThreshold):
	
		'''Process the tasks in taskArray and accumulates the answers in results.
		
		Every checkInterval tasks this method checks if the loadSkew
		(the balance of tasks across nodes) is greater than skewThreshold.
		If it is, this method exits, returning an array containing the uncompleted tasks'''
	
		#Get the scan options from the configuration object
		#in the format used by Design_pKa.run_opt()
		#Add whats missing
		defaults = self.configuration.designPKAOptions()
		defaults['pdb'][0] = self.pdbName
		defaults['pKas'][0] = self.dummyPKAArg
	
		#Count how many mutations there are
		numberMutations = len(taskArray)
	
		#Variables for informing user of progress
		ten = int(numberMutations/10)
		if ten == 0:
			ten = 1
		completedTasks = 0

		start = datetime.datetime.now()
		checkTime = 600
	
		for element in taskArray:
		
			standardOut.flush()
			#On the first run there is a long wait while various files are read. 
			#The first mutation is then performed. 
			if completedTasks == 0:
				self.environment.output(
					'[SCAN] (%d on %s) Initialising ...\n' % (self.environment.rank(), self.environment.processorName()),
					stream=standardOut, 
					rootOnly=False)
		
			try:
				if verbose:	
					data = (self.environment.rank(), self.environment.processorName(), element.codeString(self.pdb))
					self.environment.output(
						'[SCAN] (%d on %s) Calculating for Mutation %s\n' % data,
						stream=standardOut,
						rootOnly=False)

				aList = self._singleScan(element, defaults, self.mutantCollection)
				if verbose: 
					remain = len(taskArray) - completedTasks
					self.environment.output(
						'[SCAN] (%d on %s) Done %d remaining\n' %  (self.environment.rank(), self.environment.processorName(), remain), 
						stream=standardOut, rootOnly=False)
			except BaseException, reason:
				self.environment.output('[SCAN] Caught exception - Data %s. Reraising' % reason, stream=standardOut)
				scanLogStream.close()
				sys.stdout = standardOut
				raise
				
			#Cheating slightly
			#This line simply informs the user the initialisation is over is starting.
			if completedTasks == 0:
				self.environment.output('[SCAN] Scanning ')
				
			results.append(aList)
			
			#Print some dots to show progress
			completedTasks = completedTasks + 1
			if not verbose:
				if completedTasks%ten == 0:
					standardOut.write(".")

			#Check if we require load balancing - we really need this to be asynchronous
			#As it is every node has to reach this point to calculate the skew
			#We wait to check if we have been running longer than the checkInterval
			#OR if the time to wait now is less than the time we estimate we will have
			#exceeded the checkInterval if we go ahead.
			#runningTime = datetime.datetime.now() - start
			#seconds = 86400*runningTime.days + runningTime.seconds
			#timePerStep = seconds/float(completedTasks)
			#timeToCheck = checkTime - seconds
			#estimatedNextTime = seconds + timePerStep
#
#			self.environment.output('[SCAN] (%d) Running for %s - %lf to check interval\n' % (self.environment.rank(), runningTime, timeToCheck), 
#				stream=standardOut,
#				rootOnly=False)
#
#			self.environment.output('[SCAN] (%d) Time per step %lf - Estimated next check %lf.\n' % (self.environment.rank(), timePerStep, estimatedNextTime), 
#				stream=standardOut,
#				rootOnly=False)
#
#			self.environment.output('[SCAN] (%d) Estimated next time to check interval %lf.\n' % (self.environment.rank(), checkTime - estimatedNextTime), 
#				stream=standardOut,
#				rootOnly=False)
#				
#			if seconds >= checkTime or (abs(timeToCheck) < abs(checkTime - estimatedNextTime)):
#				startWait = datetime.datetime.now()
#				self.environment.output('[SCAN] Checking skew\n', stream=standardOut, rootOnly=False)
#				skew = self.environment.loadSkew(len(taskArray) - completedTasks)
#				self.environment.output('[SCAN] Skew is %lf\n' % skew, stream=standardOut, rootOnly=False)
#				endWait = datetime.datetime.now()
#				self.environment.output('[SCAN] Waited for %s\n' % (endWait - startWait), stream=standardOut, rootOnly=False)
#				checkTime += 600
#				if  skew > skewThreshold:
#					break
#
		return taskArray[completedTasks:]
Process the tasks in taskArray and accumulates the answers in results.
		
		Every checkInterval tasks this method checks if the loadSkew
		(the balance of tasks across nodes) is greater than skewThreshold.
		If it is, this method exits, returning an array containing the uncompleted tasks
Process the tasks in taskArray and accumulates the answers in results.
Every checkInterval tasks this method checks if the loadSkew
(the balance of tasks across nodes) is greater than skewThreshold.
If it is, this method exits, returning an array containing the uncompleted tasks
Process the tasks in taskArray and accumulates the answers in results . Every checkInterval tasks this method checks if the loadSkew ( the balance of tasks across nodes ) is greater than skewThreshold . If it is this method exits returning an array containing the uncompleted tasks
def _processTasks(self, taskArray, results, standardOut, scanLogStream, verbose, checkInterval, skewThreshold):
		defaults = self.configuration.designPKAOptions()
		defaults['pdb'][0] = self.pdbName
		defaults['pKas'][0] = self.dummyPKAArg
		numberMutations = len(taskArray)
		ten = int(numberMutations/10)
		if ten == 0:
			ten = 1
		completedTasks = 0
		start = datetime.datetime.now()
		checkTime = 600
		for element in taskArray:
			standardOut.flush()
			if completedTasks == 0:
				self.environment.output(
					'[SCAN] (%d on %s) Initialising ...\n' % (self.environment.rank(), self.environment.processorName()),
					stream=standardOut, 
					rootOnly=False)
			try:
				if verbose:	
					data = (self.environment.rank(), self.environment.processorName(), element.codeString(self.pdb))
					self.environment.output(
						'[SCAN] (%d on %s) Calculating for Mutation %s\n' % data,
						stream=standardOut,
						rootOnly=False)
				aList = self._singleScan(element, defaults, self.mutantCollection)
				if verbose: 
					remain = len(taskArray) - completedTasks
					self.environment.output(
						'[SCAN] (%d on %s) Done %d remaining\n' %  (self.environment.rank(), self.environment.processorName(), remain), 
						stream=standardOut, rootOnly=False)
			except BaseException, reason:
				self.environment.output('[SCAN] Caught exception - Data %s. Reraising' % reason, stream=standardOut)
				scanLogStream.close()
				sys.stdout = standardOut
				raise
			if completedTasks == 0:
				self.environment.output('[SCAN] Scanning ')
			results.append(aList)
			completedTasks = completedTasks + 1
			if not verbose:
				if completedTasks%ten == 0:
					standardOut.write(".")
			self.environment.output('[SCAN] (%d) Running for %s - %lf to check interval\n' % (self.environment.rank(), runningTime, timeToCheck), 
				stream=standardOut,
				rootOnly=False)
			self.environment.output('[SCAN] (%d) Time per step %lf - Estimated next check %lf.\n' % (self.environment.rank(), timePerStep, estimatedNextTime), 
				stream=standardOut,
				rootOnly=False)
			self.environment.output('[SCAN] (%d) Estimated next time to check interval %lf.\n' % (self.environment.rank(), checkTime - estimatedNextTime), 
				stream=standardOut,
				rootOnly=False)
			if seconds >= checkTime or (abs(timeToCheck) < abs(checkTime - estimatedNextTime)):
				startWait = datetime.datetime.now()
				self.environment.output('[SCAN] Checking skew\n', stream=standardOut, rootOnly=False)
				skew = self.environment.loadSkew(len(taskArray) - completedTasks)
				self.environment.output('[SCAN] Skew is %lf\n' % skew, stream=standardOut, rootOnly=False)
				endWait = datetime.datetime.now()
				self.environment.output('[SCAN] Waited for %s\n' % (endWait - startWait), stream=standardOut, rootOnly=False)
				checkTime += 600
				if  skew > skewThreshold:
					break
		return taskArray[completedTasks:]
def _processTasks ( self , taskArray , results , standardOut , scanLogStream , verbose , checkInterval , skewThreshold ) : defaults = self . configuration . designPKAOptions ( ) defaults [ 'pdb' ] [ 0 ] = self . pdbName defaults [ 'pKas' ] [ 0 ] = self . dummyPKAArg numberMutations = len ( taskArray ) ten = int ( numberMutations / 10 ) if ten == 0 : ten = 1 completedTasks = 0 start = datetime . datetime . now ( ) checkTime = 600 for element in taskArray : standardOut . flush ( ) if completedTasks == 0 : self . environment . output ( '[SCAN] (%d on %s) Initialising ...\n' % ( self . environment . rank ( ) , self . environment . processorName ( ) ) , stream = standardOut , rootOnly = False ) try : if verbose : data = ( self . environment . rank ( ) , self . environment . processorName ( ) , element . codeString ( self . pdb ) ) self . environment . output ( '[SCAN] (%d on %s) Calculating for Mutation %s\n' % data , stream = standardOut , rootOnly = False ) aList = self . _singleScan ( element , defaults , self . mutantCollection ) if verbose : remain = len ( taskArray ) - completedTasks self . environment . output ( '[SCAN] (%d on %s) Done %d remaining\n' % ( self . environment . rank ( ) , self . environment . processorName ( ) , remain ) , stream = standardOut , rootOnly = False ) except BaseException , reason : self . environment . output ( '[SCAN] Caught exception - Data %s. Reraising' % reason , stream = standardOut ) scanLogStream . close ( ) sys . stdout = standardOut raise if completedTasks == 0 : self . environment . output ( '[SCAN] Scanning ' ) results . append ( aList ) completedTasks = completedTasks + 1 if not verbose : if completedTasks % ten == 0 : standardOut . write ( "." ) return taskArray [ completedTasks : ]
Process the tasks in taskArray and accumulates the answers in results.
Process the tasks in taskArray and accumulates the answers in results .
'''Process the tasks in taskArray and accumulates the answers in results.
		
		Every checkInterval tasks this method checks if the loadSkew
		(the balance of tasks across nodes) is greater than skewThreshold.
		If it is, this method exits, returning an array containing the uncompleted tasks''' #Get the scan options from the configuration object #in the format used by Design_pKa.run_opt() #Add whats missing #Count how many mutations there are #Variables for informing user of progress #On the first run there is a long wait while various files are read.  #The first mutation is then performed.  #Cheating slightly #This line simply informs the user the initialisation is over is starting. #Print some dots to show progress #Check if we require load balancing - we really need this to be asynchronous #As it is every node has to reach this point to calculate the skew #We wait to check if we have been running longer than the checkInterval #OR if the time to wait now is less than the time we estimate we will have #exceeded the checkInterval if we go ahead. #runningTime = datetime.datetime.now() - start #seconds = 86400*runningTime.days + runningTime.seconds #timePerStep = seconds/float(completedTasks) #timeToCheck = checkTime - seconds #estimatedNextTime = seconds + timePerStep # #			self.environment.output('[SCAN] (%d) Running for %s - %lf to check interval\n' % (self.environment.rank(), runningTime, timeToCheck),  #				stream=standardOut, #				rootOnly=False) # #			self.environment.output('[SCAN] (%d) Time per step %lf - Estimated next check %lf.\n' % (self.environment.rank(), timePerStep, estimatedNextTime),  #				stream=standardOut, #				rootOnly=False) # #			self.environment.output('[SCAN] (%d) Estimated next time to check interval %lf.\n' % (self.environment.rank(), checkTime - estimatedNextTime),  #				stream=standardOut, #				rootOnly=False) #				 #			if seconds >= checkTime or (abs(timeToCheck) < abs(checkTime - estimatedNextTime)): #				startWait = datetime.datetime.now() #				self.environment.output('[SCAN] Checking skew\n', stream=standardOut, rootOnly=False) #				skew = self.environment.loadSkew(len(taskArray) - completedTasks) #				self.environment.output('[SCAN] Skew is %lf\n' % skew, stream=standardOut, rootOnly=False) #				endWait = datetime.datetime.now() #				self.environment.output('[SCAN] Waited for %s\n' % (endWait - startWait), stream=standardOut, rootOnly=False) #				checkTime += 600 #				if  skew > skewThreshold: #					break #
self
taskArray
results
standardOut
scanLogStream
verbose
checkInterval
skewThreshold