rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
selectFields = [ "SUM(`%s`)" % f for f in fields2Get ]
selectFields = [ "SUM(`%s`)/COUNT(`%s`)" % ( f, f ) for f in fields2Get ]
def getGroupedInstanceHistory( self, groupField = False, selDict = {}, fields2Get = False ): validDataFields = [ 'Load', 'Jobs', 'TransferredFiles', 'TransferredBytes' ] validGroupFields = [ 'VMInstanceID', 'Status' ] allValidFields = VirtualMachineDB.tablesDesc[ 'vm_History' ][ 'Fields' ] if not fields2Get: fields2Get...
groupField = "FROM_UNIXTIME(UNIX_TIMESTAMP( `Update` ) - UNIX_TIMESTAMP( `Update` ) mod %d)" % bucketSize selectFields.insert( 0, groupField )
sqlGroup = "FROM_UNIXTIME(UNIX_TIMESTAMP( `Update` ) - UNIX_TIMESTAMP( `Update` ) mod %d)" % bucketSize selectFields.insert( 0, sqlGroup ) groupField = "%s, VMInstanceID" % sqlGroup
def getGroupedInstanceHistory( self, groupField = False, selDict = {}, fields2Get = False ): validDataFields = [ 'Load', 'Jobs', 'TransferredFiles', 'TransferredBytes' ] validGroupFields = [ 'VMInstanceID', 'Status' ] allValidFields = VirtualMachineDB.tablesDesc[ 'vm_History' ][ 'Fields' ] if not fields2Get: fields2Get...
'Records' : convertedData } )
'Records' : finalData } )
def getGroupedInstanceHistory( self, groupField = False, selDict = {}, fields2Get = False ): validDataFields = [ 'Load', 'Jobs', 'TransferredFiles', 'TransferredBytes' ] validGroupFields = [ 'VMInstanceID', 'Status' ] allValidFields = VirtualMachineDB.tablesDesc[ 'vm_History' ][ 'Fields' ] if not fields2Get: fields2Get...
self.log.verbose( "Transfer file %s is already registered in %s SE" % ( file, transferDict[ 'OutputSE' ] ) )
self.log.verbose( "Transfer file %s is already registered in %s SE" % ( file, seName ) )
def isRegisteredInOutputCatalog( self, file, transferDict ): fc = FileCatalog( [ transferDict[ 'OutputFC' ] ] ) lfn = os.path.join( transferDict['OutputPath'], os.path.basename( file ) ) result = fc.getReplicas( lfn ) if not result[ 'OK' ]: return result if lfn not in result[ 'Value' ][ 'Successful' ]: return S_OK( Fal...
gConfig.getValue( "%s/MaxTransfers" % self.__transfersCSPath, 20 ),
gConfig.getValue( "%s/MaxTransfers" % self.__transfersCSPath, 4 ),
def __init__( self, csPath = "" ): self.log = gLogger.getSubLogger( "OutputDataExecutor" ) if not csPath: vo = gConfig.getValue( "/DIRAC/VirtualOrganization", "" ) self.__transfersCSPath = '/Operations/%s/OutputData' % vo else: self.__transfersCSPath = csPath self.__requiredCSOptions = ['InputPath', 'InputFC', 'OutputP...
res = pythonCall( 0, inputSE.getFile, inFile )
res = pythonCall( 2 * 3600, inputSE.getFile, inFile )
def __retrieveAndUploadFile( self, file, outputDict ): """ Retrieve, Upload, and remove """ fileName = file inputPath = outputDict['InputPath'] inputFCName = outputDict['InputFC'] inBytes = 0 if inputFCName == 'LocalDisk': inFile = file file = os.path.join( inputPath, file ) else: inputFC = FileCatalog( [inputFCName] )
res = pythonCall( 0, replicaManager.putAndRegister, outFile, os.path.realpath( file ), outputSE.name, catalog = outputFCName )
res = pythonCall( 2 * 3600, replicaManager.putAndRegister, outFile, os.path.realpath( file ), outputSE.name, catalog = outputFCName )
def __retrieveAndUploadFile( self, file, outputDict ): """ Retrieve, Upload, and remove """ fileName = file inputPath = outputDict['InputPath'] inputFCName = outputDict['InputFC'] inBytes = 0 if inputFCName == 'LocalDisk': inFile = file file = os.path.join( inputPath, file ) else: inputFC = FileCatalog( [inputFCName] )
os.unlink( file )
os.unlink( os.path.join( transferDict[ 'InputPath' ], file ) )
def __transferIfNotRegistered( self, file, transferDict ): result = self.isRegisteredInOutputCatalog( file, transferDict ) if not result[ 'OK' ]: self.log.error( result[ 'Message' ] ) return result #Already registered. Need to delete if result[ 'Value' ]: #Delete if transferDict[ 'InputFC' ] == 'LocalDisk': os.unlink( ...
return S_OK( file )
self.log.info( "File %s deleted from %s" % ( file, transferDict[ 'InputSE' ] ) ) self.__processingFiles.discard( file ) return S_OK( file )
def __transferIfNotRegistered( self, file, transferDict ): result = self.isRegisteredInOutputCatalog( file, transferDict ) if not result[ 'OK' ]: self.log.error( result[ 'Message' ] ) return result #Already registered. Need to delete if result[ 'Value' ]: #Delete if transferDict[ 'InputFC' ] == 'LocalDisk': os.unlink( ...
return S_OK( False ) def __retrieveFile( self, fileName, outputDict ): inputPath = outputDict['InputPath'] inputFCName = outputDict['InputFC'] filePath = os.path.join( inputPath, file ) if inputFCName == 'LocalDisk': return S_OK( filePath ) inputFC = FileCatalog( [inputFCName] ) replicaDict = inputFC.getReplicas( file...
return S_OK( False )
def isRegisteredInOutputCatalog( self, file, transferDict ): fc = FileCatalog( [ transferDict[ 'OutputFC' ] ] ) lfn = os.path.join( transferDict['OutputPath'], os.path.basename( file ) ) result = fc.getReplicas( lfn ) if not result[ 'OK' ]: return result if lfn not in result[ 'Value' ][ 'Successful' ]: return S_OK( Fal...
stopDir = os.path.join( rootPath, 'control', ad )
stopDir = os.path.join( gConfig.getValue( '/LocalSite/InstancePath', rootPath ), 'control', ad )
def __processHeartBeatMessage( self, hbMsg ): if 'stop' in hbMsg and hbMsg[ 'stop' ]: #Write stop file for jobAgent gLogger.info( "Received STOP signal. Writing stop files..." ) for agentName in [ "WorkloadManagement/JobAgent" ]: ad = os.path.join( *agentName.split( "/" ) ) stopDir = os.path.join( rootPath, 'control', ...
ret = result[ 'Value' ]
break
def __retrieveAndUploadFile( self, file, outputDict ): """ Retrieve, Upload, and remove """ fileName = file inputPath = outputDict['InputPath'] inputFCName = outputDict['InputFC'] inBytes = 0 if inputFCName == 'LocalDisk': inFile = file file = os.path.join( inputPath, file ) else: inputFC = FileCatalog( [inputFCName] )
if ret['OK'] or not inputFCName == 'LocalDisk':
if result['OK'] or not inputFCName == 'LocalDisk':
def __retrieveAndUploadFile( self, file, outputDict ): """ Retrieve, Upload, and remove """ fileName = file inputPath = outputDict['InputPath'] inputFCName = outputDict['InputFC'] inBytes = 0 if inputFCName == 'LocalDisk': inFile = file file = os.path.join( inputPath, file ) else: inputFC = FileCatalog( [inputFCName] )
self.pool.processAllResults()
self.__threadPool.processAllResults()
def processAllPendingTransfers( self ): self.pool.processAllResults()
ret = self.pool.generateJobAndQueueIt( self.__retrieveAndUploadFile,
ret = self.__threadPool.generateJobAndQueueIt( self.__retrieveAndUploadFile,
def __addFilesToThreadPool( self, files, outputDict ): for file in files: file = os.path.basename( file ) if file in self.__processingFiles: continue self.__processingFiles.add( file ) ret = self.pool.generateJobAndQueueIt( self.__retrieveAndUploadFile, args = ( file, outputDict ), oCallback = self.transferCallback, bl...
inBytes = os.stat( inFile )[6]
if os.path.isfile( file ): inBytes = os.stat( file )[6]
def __retrieveAndUploadFile( self, file, outputDict ): """ Retrieve, Upload, and remove """ fileName = file inputPath = outputDict['InputPath'] inputFCName = outputDict['InputFC'] inBytes = 0 if inputFCName == 'LocalDisk': inFile = file file = os.path.join( inputPath, file ) else: inputFC = FileCatalog( [inputFCName] )
firstValues = sumData[ sorted( sumData )[0] ] for date in sorted( sumData ): finalData.append( [ date ] ) values = sumData[ date ] for i in range( len( values ) ): if i in requireExtension: finalData[-1].append( max( 0, values[i] - firstValues[i] ) ) else: finalData[-1].append( values[i] )
if len( sumData ) > 0: firstValues = sumData[ sorted( sumData )[0] ] for date in sorted( sumData ): finalData.append( [ date ] ) values = sumData[ date ] for i in range( len( values ) ): if i in requireExtension: finalData[-1].append( max( 0, values[i] - firstValues[i] ) ) else: finalData[-1].append( values[i] )
def getHistoryValues( self, averageBucket, selDict = {}, fields2Get = False, timespan = 0 ): try: timespan = max( 0, int( timespan ) ) except: return S_ERROR( "Timespan has to be an integer" )
for csOption, csDefault, varName in ( ( "Type", "", "vmType" ), ( "HaltPeriod", 3600, "haltPeriod" ),
for csOption, csDefault, varName in ( ( "HaltPeriod", 3600, "haltPeriod" ),
def __getCSConfig( self ): self.vmName = gConfig.getValue( "/LocalSite/VirtualMachineName", "" ) if not self.vmName: return S_ERROR( "/LocalSite/VirtualMachineName is not defined" ) #Variables coming from the vm imgPath = "/Resources/VirtualMachines/Images/%s" % self.vmName for csOption, csDefault, varName in ( ( "Flav...
self.haltBeforeMargin = 1800 self.vmLoadAvgTimespan = 2
def __getCSConfig( self ): self.vmName = gConfig.getValue( "/LocalSite/VirtualMachineName", "" ) if not self.vmName: return S_ERROR( "/LocalSite/VirtualMachineName is not defined" ) #Variables coming from the vm imgPath = "/Resources/VirtualMachines/Images/%s" % self.vmName for csOption, csDefault, varName in ( ( "Flav...
gLogger.info( "Type : %s" % self.vmType )
def __getCSConfig( self ): self.vmName = gConfig.getValue( "/LocalSite/VirtualMachineName", "" ) if not self.vmName: return S_ERROR( "/LocalSite/VirtualMachineName is not defined" ) #Variables coming from the vm imgPath = "/Resources/VirtualMachines/Images/%s" % self.vmName for csOption, csDefault, varName in ( ( "Flav...
type = self.vmType.lower() if type == 'generic':
flavor = self.vmFlavor.lower() if flavor == 'generic':
def initialize( self ): self.__loadHistory = [] self.vmId = "" result = self.__getCSConfig() if not result[ 'OK' ]: return result type = self.vmType.lower() if type == 'generic': result = self.getGenericVMId() elif type == 'amazon': resuld = self.getAmazonVMId() else: return S_ERROR( "Unknown VM Type (%s)" % self.vmTyp...
elif type == 'amazon': resuld = self.getAmazonVMId()
elif flavor == 'amazon': result = self.getAmazonVMId()
def initialize( self ): self.__loadHistory = [] self.vmId = "" result = self.__getCSConfig() if not result[ 'OK' ]: return result type = self.vmType.lower() if type == 'generic': result = self.getGenericVMId() elif type == 'amazon': resuld = self.getAmazonVMId() else: return S_ERROR( "Unknown VM Type (%s)" % self.vmTyp...
return S_ERROR( "Unknown VM Type (%s)" % self.vmType )
return S_ERROR( "Unknown VM Flavor (%s)" % self.vmFlavor )
def initialize( self ): self.__loadHistory = [] self.vmId = "" result = self.__getCSConfig() if not result[ 'OK' ]: return result type = self.vmType.lower() if type == 'generic': result = self.getGenericVMId() elif type == 'amazon': resuld = self.getAmazonVMId() else: return S_ERROR( "Unknown VM Type (%s)" % self.vmTyp...
transferOK = True break
if outFile in result['Value']['Successful']: transferOK = True break else: self.log.error( result['Value']['Failed'][outFile] )
def __retrieveAndUploadFile( self, file, outputDict ): """ Retrieve, Upload, and remove """ fileName = file inputPath = outputDict['InputPath'] inputFCName = outputDict['InputFC'] inBytes = 0 if inputFCName == 'LocalDisk': inFile = file file = os.path.join( inputPath, file ) else: inputFC = FileCatalog( [inputFCName] )
filePath = os.path.join( transferDict[ 'InputPath' ], file )
def __transferIfNotRegistered( self, file, transferDict ): result = self.isRegisteredInOutputCatalog( file, transferDict ) if not result[ 'OK' ]: self.log.error( result[ 'Message' ] ) return result #Already registered. Need to delete if result[ 'Value' ]: self.log.info( "Transfer file %s is already registered in the ou...
os.unlink( os.path.join( transferDict[ 'InputPath' ], file ) )
os.unlink( filePath )
def __transferIfNotRegistered( self, file, transferDict ): result = self.isRegisteredInOutputCatalog( file, transferDict ) if not result[ 'OK' ]: self.log.error( result[ 'Message' ] ) return result #Already registered. Need to delete if result[ 'Value' ]: self.log.info( "Transfer file %s is already registered in the ou...
inputSE = StorageElement( transferDict[ 'InputSE' ] ) inputSE.removeFile( file )
def __transferIfNotRegistered( self, file, transferDict ): result = self.isRegisteredInOutputCatalog( file, transferDict ) if not result[ 'OK' ]: self.log.error( result[ 'Message' ] ) return result #Already registered. Need to delete if result[ 'Value' ]: self.log.info( "Transfer file %s is already registered in the ou...
inputFC.removeFile( file ) self.log.info( "File %s deleted from %s" % ( file, transferDict[ 'InputSE' ] ) )
replicaDict = inputFC.getReplicas( filePath ) if not replicaDict['OK']: self.log.error( "Error deleting file", replicaDict['Message'] ) elif not inFile in replicaDict['Value']['Successful']: self.log.error( "Error deleting file", replicaDict['Value']['Failed'][inFile] ) else: seList = replicaDict['Value']['Successful']...
def __transferIfNotRegistered( self, file, transferDict ): result = self.isRegisteredInOutputCatalog( file, transferDict ) if not result[ 'OK' ]: self.log.error( result[ 'Message' ] ) return result #Already registered. Need to delete if result[ 'Value' ]: self.log.info( "Transfer file %s is already registered in the ou...
self.log.info( 'Removing from %s:' % inputSE.name, inFile ) inputSE.removeFile( inFile ) for se in seList[1:]:
for se in seList:
def __retrieveAndUploadFile( self, file, outputDict ): """ Retrieve, Upload, and remove """ fileName = file inputPath = outputDict['InputPath'] inputFCName = outputDict['InputFC'] inBytes = 0 if inputFCName == 'LocalDisk': inFile = file file = os.path.join( inputPath, file ) else: inputFC = FileCatalog( [inputFCName] )
sqlQuery = "SELECT VMInstanceID, SUM(`Load`)/COUNT(`Load`) from `vm_History` WHERE VMInstanceID in ( SELECT VMInstanceID from `vm_Instances` WHERE `Status` = 'Running' ) AND `Status` = 'Running' GROUP BY VMInstanceID ORDER BY `Update` DESC limit 1, %d" % ( running * 2 )
sqlQuery = 'SELECT `VMInstanceID`, SUM(`Load`)/COUNT(`Load`) from (SELECT `VMInstanceID`, `Load` from `vm_History` WHERE Status="Running" order by `Update` DESC limit %d) as a GROUP BY `VMInstanceID`' % ( running * 2 )
def getInstancesContent( self, selDict, sortList, start = 0, limit = 0 ): """ Function to get the contents of the db parameters are a filter to the db """ #Main fields tables = ( "`vm_Images` AS img", "`vm_Instances` AS inst" ) imageFields = ( 'VMImageID', 'Name', 'Flavor' ) instanceFields = ( 'VMInstanceID', 'Name', '...
return S_ERROR( inFile )
return S_ERROR( fileName )
def __retrieveAndUploadFile( self, file, outputDict ): """ Retrieve, Upload, and remove """ inputPath = outputDict['InputPath'] inputFCName = outputDict['InputFC'] if inputFCName == 'LocalDisk': inFile = file file = os.path.join( inputPath, file ) else: inputFC = FileCatalog( [inputFCName] )
return S_OK( inFile )
return S_OK( fileName )
def __retrieveAndUploadFile( self, file, outputDict ): """ Retrieve, Upload, and remove """ inputPath = outputDict['InputPath'] inputFCName = outputDict['InputFC'] if inputFCName == 'LocalDisk': inFile = file file = os.path.join( inputPath, file ) else: inputFC = FileCatalog( [inputFCName] )
info = self.__getInfo( 'Instance', id )
info = self.__getInfo( 'Instance', instanceID )
def __getImageForRunningInstance( self, instanceID ): """ Looks for imageID for a given instanceID. Check image Transition to Running is allowed Returns: S_OK( imageID ) S_ERROR( Reason ) """ info = self.__getInfo( 'Instance', id ) if not info['OK']: return info ( tableName, validStates, idName ) = self.__getTypeTuple(...
fields = self.__tablesDesc[ tableName ]['Fields']
fields = self.tablesDesc[ tableName ]['Fields']
def __getInfo( self, object, id ): """ Return dictionary with info for Images and Instances by ID """ ( tableName, validStates, idName ) = self.__getTypeTuple( object ) if not tableName: return DIRAC.S_ERROR( 'Unknown DB object: %s' % object ) fields = self.__tablesDesc[ tableName ]['Fields'] ret = self._getFields( tab...
self.log = DIRAC.gLogger.getSubLogger( '%sPilotDirector' % self.Flavor )
self.log = DIRAC.gLogger.getSubLogger( '%sDirector' % self.Flavor )
def __init__( self, submitPool ):
self.log = DIRAC.gLogger.getSubLogger( '%sPilotDirector/%s' % ( self.Flavor, submitPool ) )
self.log = DIRAC.gLogger.getSubLogger( '%sDirector/%s' % ( self.Flavor, submitPool ) )
def __init__( self, submitPool ):
if result['OK']: if outFile in result['Value']['Successful']:
if result['OK'] and result['Value']['OK']: if outFile in result['Value']['Value']['Successful']:
def __retrieveAndUploadFile( self, file, outputDict ): """ Retrieve, Upload, and remove """ fileName = file inputPath = outputDict['InputPath'] inputFCName = outputDict['InputFC'] inBytes = 0 if inputFCName == 'LocalDisk': inFile = file file = os.path.join( inputPath, file ) else: inputFC = FileCatalog( [inputFCName] )
self.log.error( result['Value']['Failed'][outFile] )
self.log.error( result['Value']['Value']['Failed'][outFile] )
def __retrieveAndUploadFile( self, file, outputDict ): """ Retrieve, Upload, and remove """ fileName = file inputPath = outputDict['InputPath'] inputFCName = outputDict['InputFC'] inBytes = 0 if inputFCName == 'LocalDisk': inFile = file file = os.path.join( inputPath, file ) else: inputFC = FileCatalog( [inputFCName] )
self.log.error( result['Message'] )
if result['OK']: self.log.error( result['Value']['Message'] ) else: self.log.error( result['Message'] )
def __retrieveAndUploadFile( self, file, outputDict ): """ Retrieve, Upload, and remove """ fileName = file inputPath = outputDict['InputPath'] inputFCName = outputDict['InputFC'] inBytes = 0 if inputFCName == 'LocalDisk': inFile = file file = os.path.join( inputPath, file ) else: inputFC = FileCatalog( [inputFCName] )
( tableName, validStates, idName ) = self.__getTypeTuple( object )
def __setState( self, object, id, state ): """ Attempt to set object in state, checking if transition is allowed """ knownStates = self.allowedTransitions[object].keys() if not state in knownStates: return DIRAC.S_ERROR( 'Transition to %s not possible' % state )
return S_ERROR( "Instance Id has to be a number!" )
return DIRAC.S_ERROR( "Instance Id has to be a number!" )
def getHistoryForInstance( self, instanceId ): try: instanceId = int( instanceId ) except: return S_ERROR( "Instance Id has to be a number!" ) fields = ( 'Status', 'Load', 'Update' ) sqlQuery = "SELECT %s FROM `vm_History` WHERE VMInstanceId=%d" % ( ", ".join( fields ), instanceId ) retVal = self._query( sqlQuery ) if ...
result = virtualMachineDB.instanceIDHeartBeat( self.vmId, avgLoad, self.__getNumJobWrappers,
result = virtualMachineDB.instanceIDHeartBeat( self.vmId, avgLoad, self.__getNumJobWrappers(),
def execute( self ): #Process transfers self.__outDataExecutor.checkForTransfers() #Get load avgLoad, avgRequiredSamples = self.__getLoadAvg() gLogger.info( "Load Average is %.2f" % avgLoad ) if not avgRequiredSamples: gLogger.info( " Not all required samples yet there" ) #Do we need to send heartbeat? uptime = self.ge...
if not ret['OK']:
if not result['OK']:
def __retrieveAndUploadFile( self, file, outputDict ): """ Retrieve, Upload, and remove """ fileName = file inputPath = outputDict['InputPath'] inputFCName = outputDict['InputFC'] inBytes = 0 if inputFCName == 'LocalDisk': inFile = file file = os.path.join( inputPath, file ) else: inputFC = FileCatalog( [inputFCName] )
"""
def to_rdf(self): rdf = self.__head__() rdf += "\n%s\n" % self.to_uri(self.get_uri()) # rdf += "\ta %s" % self.object_to_string(self.get_rdf_types()) # # -- for each defined property -- rdfMeta = self.rdfMeta() for prop in rdfMeta: """ condition = True if "condition" in rdfMeta[prop]: ctuple = rdfMeta[prop]["condition"...
cvalue = self.get_value(ctuple[0], """ property_uri, rval = self.get_property_uris(prop, rdfMeta) if rval: for puri in property_uri: rdf += ";\n\t%s %s" % (self.to_uri(puri), rval)
cvalue = self.get_value(ctuple[0]) condition = cvalue == ctuple[1] if condition: property_uri, rval = self.get_property_uris(prop, rdfMeta) if rval: for puri in property_uri: rdf += ";\n\t%s %s" % (self.to_uri(puri), rval)
def to_rdf(self): rdf = self.__head__() rdf += "\n%s\n" % self.to_uri(self.get_uri()) # rdf += "\ta %s" % self.object_to_string(self.get_rdf_types()) # # -- for each defined property -- rdfMeta = self.rdfMeta() for prop in rdfMeta: """ condition = True if "condition" in rdfMeta[prop]: ctuple = rdfMeta[prop]["condition"...
def get_value(self, prop, rdfMeta=None): if not rdfMeta: rdfMeta = self.rdfMeta() rdfprops = rdfMeta[prop]
def get_property_value(self, prop, rdfprops):
def get_value(self, prop, rdfMeta=None): if not rdfMeta: rdfMeta = self.rdfMeta() rdfprops = rdfMeta[prop] if "property" in rdfprops and hasattr(self, rdfprops["property"]): if callable(eval("self."+rdfprops["property"])): dbval = eval("self."+rdfprops["property"]+"()") else: dbval = getattr(self, rdfprops["property"])...
dbval = self.get_value(prop, rdfMeta)
dbval = self.get_property_value(prop, rdfprops)
def property_to_string(self, prop): if prop is None: return prop rdfMeta = self.rdfMeta() rdfprops = rdfMeta[prop] dbval = self.get_value(prop, rdfMeta) #-- check if if conversion for value is given if 'value' in rdfprops: if 'dict' in rdfprops: dbval = rdfprops['dict'][dbval] dbval = eval(rdfprops["value"] % dbval) e...
file = codecs.open(file_name, encoding='ascii')
file = codecs.open(file_name, encoding='utf-8', mode="r")
def read(self, file_name): file = codecs.open(file_name, encoding='ascii') i = 0 size = 10000 date = time.mktime(datetime.datetime.utcnow().timetuple()) for line in file: self.process_line(line) i += 1 if not i%size: now_date = time.mktime(datetime.datetime.utcnow().timetuple()) db.reset_queries() gc.collect() print "[...
self.process_line(line)
self.process_line(line.rstrip())
def read(self, file_name): file = codecs.open(file_name, encoding='ascii') i = 0 size = 10000 date = time.mktime(datetime.datetime.utcnow().timetuple()) for line in file: self.process_line(line) i += 1 if not i%size: now_date = time.mktime(datetime.datetime.utcnow().timetuple()) db.reset_queries() gc.collect() print "[...
print "[ERROR] could not parse line: |%s|" % line.encode("utf-8")
def process_line(self, line): m = self._triple.match(line) if not m:
val = self.toBigInt(raw) sign = (val & 0x80000000) >> 31 exp = (val & 0x7f8000) >> 23 mant = val & 0x7fffff if sign <> 0: mant = -(~(mant - 1) & 0x7fffff) self.debug("DPT14: value: %d sign: %d exp: %d mant: %f" % (val, sign,exp,mant)) return (1 << exp) * 0.01 * mant
if len(raw)==4: ret = struct.unpack(">f","".join([chr(i) for i in raw])) if type(ret) == tuple: ret = ret[0] return ret
def decodeDPT14(self,raw): ## 4 Byte Float ## SEEEEEEE EFFFFFFF FFFFFFFF FFFFFFFF ## S (Sign) = {0,1} ## Exponent = [0 ... 255] ## Fraction = [0 .. 8 388 607] val = self.toBigInt(raw) sign = (val & 0x80000000) >> 31 exp = (val & 0x7f8000) >> 23 mant = val & 0x7fffff if sign <> 0: mant = -(~(mant - 1) & 0x7fffff) self.d...
sign = 0 exp = 0 if val < 0: sign = 0x80000000 mant = val * 100 while mant > 0x7fffff: mant = mant >> 1 exp +=1 data = sign | (exp << 23) | (int(mant) & 0x07ff) self.debug("DPT14: value: %d sign: %d exp: %d mant: %r" % (val, sign,exp,mant)) return self.toByteArray(data,4)
return [ord(i) for i in struct.pack(">f",float(val))]
def encodeDPT14(self,val): sign = 0 exp = 0 if val < 0: sign = 0x80000000 mant = val * 100 while mant > 0x7fffff: mant = mant >> 1 exp +=1 data = sign | (exp << 23) | (int(mant) & 0x07ff) self.debug("DPT14: value: %d sign: %d exp: %d mant: %r" % (val, sign,exp,mant)) ## change to 4Byte bytearray return self.toByteArray...
print dpttypes.decode([24,88],dptid=9) print dpttypes.decode([1],dptid=1) print dpttypes.decode([35,76,58],dptid=16) print dpttypes.encode("Das ist",dptid=16)
print dpttypes.encode(15.5,dptid=14) print dpttypes.decode([0, 0, 6, 14],dptid=14) print dpttypes.decode([65, 120, 0, 0],dptid=14)
def guessDPT(self,raw): if type(raw) == int: if raw < 256: return 5 elif raw < 655535: return 7 elif type(raw) == float: if raw > -671088.64 and raw < 670760.96: return 9 else: return 14 elif type(raw) == str or type(raw) == unicode: return 16 return 0
print self.supportedsensors[sensor]['interfaces'][interface]
self.debug("Interface %s-%s config: %r" % (sensor,interface,self.supportedsensors[sensor]['interfaces'][interface]['config']))
def __init__(self,parent, instanceName): self._parent = parent self.WG = parent.WG self.instanceName = instanceName self.mutex = threading.RLock() defaultconfig = { 'cycletime' : 600, 'server' : '127.0.0.1', 'port' : 4304 } self.WG.checkconfig(self.instanceName,defaultconfig) self.config = self.WG.config[instanceName...
self.checkBusCycleTime(bus)
def findbusmaster(self,path=""): ## search for active busses childs = False uncachedpath = "/uncached%s" % path for bus in self.owfs.dir(uncachedpath): bus = bus[9:] if self.isbus.search(bus): childs = True ## get the bus ID busname = self.isbus.search(bus) if busname: try: if not self.findbusmaster(bus): ## if this ha...
if sensor[:2] == "81": self.busmaster[path]['busmaster'] = sensor
def findsensors(self,path=""): uncachedpath = "/uncached%s" % path mincycle = 600 for sensor in self.owfs.dir(uncachedpath): ## remove /uncached/bus.x from sensorname sensor = sensor.split("/")[-1] ## check if it is really a sensor if self.issensor.match(sensor): self.debug("found Sensor %s at Bus %r" % (sensor,path))...
sensorlist = "sensors"
def findsensors(self,path=""): uncachedpath = "/uncached%s" % path mincycle = 600 for sensor in self.owfs.dir(uncachedpath): ## remove /uncached/bus.x from sensorname sensor = sensor.split("/")[-1] ## check if it is really a sensor if self.issensor.match(sensor): self.debug("found Sensor %s at Bus %r" % (sensor,path))...
print "Sensortype: %s config: %r" % (sensortype,self.supportedsensors[sensortype]['interfaces'])
self.debug("Sensortype: %s config: %r" % (sensortype,self.supportedsensors[sensortype]['interfaces']))
def findsensors(self,path=""): uncachedpath = "/uncached%s" % path mincycle = 600 for sensor in self.owfs.dir(uncachedpath): ## remove /uncached/bus.x from sensorname sensor = sensor.split("/")[-1] ## check if it is really a sensor if self.issensor.match(sensor): self.debug("found Sensor %s at Bus %r" % (sensor,path))...
'present': True,
'present': self.busmaster[path].get('busmaster',True),
def findsensors(self,path=""): uncachedpath = "/uncached%s" % path mincycle = 600 for sensor in self.owfs.dir(uncachedpath): ## remove /uncached/bus.x from sensorname sensor = sensor.split("/")[-1] ## check if it is really a sensor if self.issensor.match(sensor): self.debug("found Sensor %s at Bus %r" % (sensor,path))...
if iface == "present" and str(data) <> "1": self.sensors[sensor]['present'] = False
def _read(self,busname,sensor): for iface in self.sensors[sensor]['interfaces'].keys(): if not self.sensors[sensor]['present'] and iface <> "present": ## if not present check only for present continue ## make an id for the sensor (OW:28.043242a32_temperature id = "%s:%s_%s" % (self.instanceName,sensor,iface) ## get the...
'parser' : 'groupsocket'
'parser' : 'groupsocket', 'checktime' : 300
def __init__(self,parent, instanceName): self._parent = parent self.WG = parent.WG self.instanceName = instanceName
KNX = EIBConnection.EIBConnection() try: KNX.EIBSocketURL(self.config['url'])
try:
def _sendloop(self): addr = 0 msg = [] KNX = EIBConnection.EIBConnection() try: KNX.EIBSocketURL(self.config['url']) while self.isrunning: try: (addr,msg) = self.sendQueue.get(timeout=1) KNX.EIBSendGroup(addr,msg) except Empty: pass except: self.WG.errorlog("Failed send %r %r" % (addr,msg)) finally: self._sendThread = ...
KNX.EIBSendGroup(addr,msg)
self.KNX.EIBSendGroup(addr,msg)
def _sendloop(self): addr = 0 msg = [] KNX = EIBConnection.EIBConnection() try: KNX.EIBSocketURL(self.config['url']) while self.isrunning: try: (addr,msg) = self.sendQueue.get(timeout=1) KNX.EIBSendGroup(addr,msg) except Empty: pass except: self.WG.errorlog("Failed send %r %r" % (addr,msg)) finally: self._sendThread = ...
KNX.EIBClose()
def _sendloop(self): addr = 0 msg = [] KNX = EIBConnection.EIBConnection() try: KNX.EIBSocketURL(self.config['url']) while self.isrunning: try: (addr,msg) = self.sendQueue.get(timeout=1) KNX.EIBSendGroup(addr,msg) except Empty: pass except: self.WG.errorlog("Failed send %r %r" % (addr,msg)) finally: self._sendThread = ...
self.idle(300)
self.idle(self.config['checktime'])
def _healthCheck(self): ebuf = EIBConnection.EIBBuffer() KNX = EIBConnection.EIBConnection() self.debug("Starting HealthCheck") try: KNX.EIBSocketURL(self.config['url']) while self.isrunning: self.idle(30) for physaddr, device in self.DeviceList.items(): if not self.isrunning: break if physaddr < 4352: continue id = "%...
self.apcicodes = [ 'A_GroupValue_Read', 'A_GroupValue_Response', 'A_GroupValue_Write', 'A_PhysicalAddress_Write', 'A_PhysicalAddress_Read', 'A_PhysicalAddress_Response', 'A_ADC_Read', 'A_ADC_Response', 'A_Memory_Read', 'A_Memory_Response', 'A_Memory_Write', 'A_UserMemory', 'A_DeviceDescriptor_Read', 'A_DeviceDescriptor...
self.apcicodes = { 0:'A_GroupValue_Read', 64:'A_GroupValue_Response', 128:'A_GroupValue_Write', 192:'A_PhysicalAddress_Write', 256:'A_PhysicalAddress_Read', 320:'A_PhysicalAddress_Response', 4:'A_ADC_Read', 5:'A_ADC_Response', 6:'A_Memory_Read', 7:'A_Memory_Response', 8:'A_Memory_Write', 9:'A_UserMemory', 10:'A_DeviceD...
def __init__(self, WireGateInstance): self.WG = WireGateInstance self.nicehex=lambda x: " ".join(map(lambda y:"%.2x" % y,x)) self.tobinstr=lambda n,b=8: "".join([str((n >> y) & 1) for y in range(b-1, -1, -1)]) self.dpt = DPT_Types.dpt_type()
self.tpducodes = [ 'T_DATA_XXX_REQ', 'T_DATA_CONNECTED_REQ', 'T_DISCONNECT_REQ', 'T_ACK' ]
self.tpducodes = { 0:'T_DATA_XXX_REQ', 16:'T_DATA_CONNECTED_REQ', 2:'T_DISCONNECT_REQ', 3:'T_ACK' }
def __init__(self, WireGateInstance): self.WG = WireGateInstance self.nicehex=lambda x: " ".join(map(lambda y:"%.2x" % y,x)) self.tobinstr=lambda n,b=8: "".join([str((n >> y) & 1) for y in range(b-1, -1, -1)]) self.dpt = DPT_Types.dpt_type()
if msg['ctrl2']['DestAddrType'] == 0:
if msg['ctrl2']['DestAddrType'] == 0 and msg['apdu']['tpdu'] == "T_DATA_XXX_REQ":
def decode(self,buf): ###################################################################################### ## 11111111 22222222 SSSSSSSS SSSSSSSS DDDDDDDD DDDDDDDD LLLLLLLL AAAAAAAA AAAAAAAA ## 1 Control Field 1 ## 2 Control Field 2 ## S Source Address ## D Destination Address ## L Data Len ## A APDU ################...
print "%s (%s): %r" % (name, msg['dstaddr'], msg['value'])
print "%s (%s): %r (%r)" % (name, msg['dstaddr'], msg['value'],msg['apdu'])
def decode(self,buf): ###################################################################################### ## 11111111 22222222 SSSSSSSS SSSSSSSS DDDDDDDD DDDDDDDD LLLLLLLL AAAAAAAA AAAAAAAA ## 1 Control Field 1 ## 2 Control Field 2 ## S Source Address ## D Destination Address ## L Data Len ## A APDU ################...
val = (raw[0] << 8) + raw[1] tcf = val >> 10 tpdu,sequence = self._decodeTransportCtrl(tcf,addresstype) apci = (val & 0x3c0) if tpdu =="T_DATA_XXX_REQ" and datalength==1: self.debug("DEBUG:6BIT") apci = apci >> 6 data = [val & 0x3f]
tpdu,sequence = self._decodeTransportCtrl(raw,addresstype) if tpdu == "T_DATA_XXX_REQ": if datalength == 1: self.debug("DEBUG:6BIT %s" % self.tobinstr(raw[1])) apci = (raw[1] & 0x80) data = [raw[1] & 0x3f] else: val = (raw[0] << 8) + raw[1] apci = (val & 0x3c0) data = raw[2:]
def _decodeAPDU(self,raw, addresstype, datalength): ############################ ## TPDU Bytes 7 and 8 ## TTTTTTAA AAMMMMMM ## T Transport Control Field ## A APCI ## M APCI/data val = (raw[0] << 8) + raw[1] tcf = val >> 10 tpdu,sequence = self._decodeTransportCtrl(tcf,addresstype) apci = (val & 0x3c0) if tpdu =="T_DATA...
data = raw[2:]
self.debug("FIXME: data = "" apci = 13
def _decodeAPDU(self,raw, addresstype, datalength): ############################ ## TPDU Bytes 7 and 8 ## TTTTTTAA AAMMMMMM ## T Transport Control Field ## A APCI ## M APCI/data val = (raw[0] << 8) + raw[1] tcf = val >> 10 tpdu,sequence = self._decodeTransportCtrl(tcf,addresstype) apci = (val & 0x3c0) if tpdu =="T_DATA...
'apci':apci }, data def _decodeTransportCtrl(self,tcf,adresstype):
'apci':self._decodeAPCI(apci) }, data def _decodeTransportCtrl(self,raw,adresstype):
def _decodeAPDU(self,raw, addresstype, datalength): ############################ ## TPDU Bytes 7 and 8 ## TTTTTTAA AAMMMMMM ## T Transport Control Field ## A APCI ## M APCI/data val = (raw[0] << 8) + raw[1] tcf = val >> 10 tpdu,sequence = self._decodeTransportCtrl(tcf,addresstype) apci = (val & 0x3c0) if tpdu =="T_DATA...
tpdu = self.tpducodes[(tcf & 0xc0) >> 6]
tpdu = self.tpducodes[tcf]
def _decodeTransportCtrl(self,tcf,adresstype): ## Transport Control Field ## 1 0 0 0 0 0 0 T_Data_Broadcast-PDU (destination_address = 0) ## 1 0 0 0 0 0 0 T_Data_Group-PDU (destination_address <> 0) ## 1 0 0 0 0 0 1 T_Data_Tag_Group-PDU ## 0 0 0 0 0 0 0 T_Data_Individual-PDU ## 0 0 1 S S S S T_Data_...
busmon.decode([176, 17, 4, 17, 110, 80, 128, 245])
print busmon.decode([176,176, 17, 4, 17, 110, 80, 128, 245])
def debug(self,msg): #print "DEBUG: BUSMON: "+ repr(msg) pass
weekday = now[6]
weekday = now[6]+1
def encodeDPT10(self,val): ## checktype default unix timestamp ## except standard timestring 20:15 or 20:15:34 or Mo 20:14:55 weekday = 0 hour = 0 min = 0 sec = 0 if type(val) == str: ## check for weekday if val[0].isalpha(): ## extract Weekday day,val = val.split(" ",1) ## Fixme: I18N day = day.lower() weekdays = ["",...
print "NO Connection"
self.debug("Connection Reset")
def run(self): while self.isrunning: ## Create Socket try: self._socket = socket.socket(socket.AF_INET,socket.SOCK_STREAM) try: self._socket.connect((self.config['server'],self.config['port'])) self._sockfile = self._socket.makefile() self._run() except socket.error ,e: if e[0] == 111: print "NO Connection" finally: t...
now = time.localtime(val)
if val == 0: now = time.localtime() else: now = time.localtime(val)
def encodeDPT10(self,val): ## checktype default unix timestamp ## except standard timestring 20:15 or 20:15:34 or Mo 20:14:55 weekday = 0 hour = 0 min = 0 sec = 0 if type(val) == str: ## check for weekday if val[0].isalpha(): ## extract Weekday day,val = val.split(" ",1) ## Fixme: I18N day = day.lower() weekdays = ["",...
tval = val
utime = [v for v in time.localtime(tval)]
def encodeDPT11(self,val): if type(val) in [float, int]: tval = val else: tval =0 ## make time struct accesible utime = [v for v in time.localtime(tval)] if type(val) == str: datestr = val.split(".") if len(datestr) == 2: # day utime[2] = val[0] # month utime[1] = val[1] ##year if val[2]<90: utime[2] = 2000 + val[2] el...
tval =0 utime = [v for v in time.localtime(tval)]
utime = [v for v in time.localtime()]
def encodeDPT11(self,val): if type(val) in [float, int]: tval = val else: tval =0 ## make time struct accesible utime = [v for v in time.localtime(tval)] if type(val) == str: datestr = val.split(".") if len(datestr) == 2: # day utime[2] = val[0] # month utime[1] = val[1] ##year if val[2]<90: utime[2] = 2000 + val[2] el...
while mant > 0x07ff:
while (mant > 2047) or (mant < -2048):
def encodeDPT9(self,val): sign = 0 exp = 0 if val < 0: sign = 0x8000 mant = val * 100 while mant > 0x07ff: mant = mant >> 1 exp +=1 data = sign | (exp << 11) | (int(mant) & 0x07ff) self.debug("DPT9: value: %d sign: %d exp: %d mant: %r" % (val, sign,exp,mant)) ## change to 2Byte bytearray return self.toByteArray(data,2)...
self.debug("Reading from path %s failed" % owfspath)
self.WG.errorlog("Reading from path %s failed" % owfspath)
def _read(self,busname): ## loop through all sensors in lokal busmaster list self.debug("Thread running for %s" % busname) readtime = time.time() for sensor in self.busmaster[busname]['sensors'].keys(): #self.sensors[sensor]['power'] = self.owfs.read("/"+sensor+"/power") ## loop through their interfaces for get in sel...
return "%s %d:%d:%d" % (weekdays[weekday], hour,min,sec)
return u"%s %d:%d:%d" % (weekdays[weekday], hour,min,sec)
def decodeDPT10(self,raw): ## 3 Byte Time ## DDDHHHHH RRMMMMMM RRSSSSSS ## R Reserved ## D Weekday ## H Hour ## M Minutes ## S Seconds weekday = (raw[0] & 0xe0) >> 5 ## Fixme: I18N weekdays = ["","Mo","Di","Mi","Do","Fr","Sa","So"] hour = raw[0] & 0x1f min = raw[1] & 0x3f sec = raw[2] & 0x3f ## Fixme: eigentlich sollt...
return "%02d.%02d.%04d" % (day,mon,year)
return u"%02d.%02d.%04d" % (day,mon,year)
def decodeDPT11(self,raw): ## 3 byte Date ## RRRDDDDD RRRRMMMM RYYYYYYY ## R Reserved ## D Day ## M Month ## Y Year day = raw[0] & 0x1f mon = raw[1] & 0xf year = raw[2] & 0x7f if year<90: year += 2000 else: year += 1900 return "%02d.%02d.%04d" % (day,mon,year)
self.WG.DATASTORE.dataobjects[attached].setValue(val,True,source=self)
self.WG.DATASTORE.get(attached).setValue(val,True,source=self)
def sendConnected(self): self.read_mutex.acquire() val = self.getValue() self.read_mutex.release() for attached in self.connected: try: self.WG.DATASTORE.dataobjects[attached].setValue(val,True,source=self) except: self.WG.log("sendconnected failed for %s" % attached,'error') __import__('traceback').print_exc(file=__im...
self.debug(self.sensors)
def run(self): cnt = 10 while self.isrunning: if cnt == 10: cnt = 0 self.findsensors() self.read() self.debug(self.sensors) self.idle(self.config['cycletime']) cnt += 1
self.session['message'] = '<div style="float: right;"><a href="http://' + site_domain + '/' + article.title_url + '" target="_blank" class="super normal button">View Now</a></div>New article <a href="/writer/edit/' + key + '">' + article.title + '</a> has been created'
self.session['message'] = '<div style="float: right;"><a href="http://' + site_domain + '/' + article.title_url + '" target="_blank" class="super normal button">View Now</a></div>New article <a href="/writer/edit/' + str(article.key()) + '">' + article.title + '</a> has been created'
def post(self, key = ''): self.session = Session() if CheckAuth(self) is False: return DoAuth(self, '/writer') site_domain = Datum.get('site_domain') site_domain_sync = Datum.get('site_domain_sync') site_name = Datum.get('site_name') site_author = Datum.get('site_author') site_slogan = Datum.get('site_slogan') site_ana...
Datum.set('site_domain', self.request.get('site_domain')) Datum.set('site_name', self.request.get('site_name'))
site_domain = Datum.get('site_domain') site_name = Datum.get('site_name')
def get(self): Datum.set('site_domain', self.request.get('site_domain')) Datum.set('site_name', self.request.get('site_name')) try: google_ping = 'http://blogsearch.google.com/ping?name=' + urllib.quote(Datum.get('site_name')) + '&url=http://' + urllib.quote(Datum.get('site_domain')) + '/&changesURL=http://' + urllib.q...
for t in self._threads:
for t in self._threads[:]:
def shutdown(self): """shutdown all workers.""" self._lock.acquire() self._stop = True self._lock.notifyAll() self._lock.release()
dbparam['queryCookieMail']="SELECT email FROM plugin_defaultsession,users WHERE users.user_id=plugin_defaultsession.user_id AND session_hash = substring('%s','.*-%%2A-(.*)');" dbparam['queryCookieId']="SELECT user_id FROM plugin_defaultsession WHERE session_hash = substring('%s','.*-%%2A-(.*)');"
dbparam['queryCookieMail']="SELECT email FROM user_session,users WHERE users.user_id=user_session.user_id AND session_hash = substring('%s','.*-%%2A-(.*)');" dbparam['queryCookieId']="SELECT user_id FROM user_session WHERE session_hash = substring('%s','.*-%%2A-(.*)');"
def extendMemberAdaptor(list): sys.path.append('/etc/gforge') import database dbparam={} #Config to connect to database dbparam['dbhost'] = database.sys_dbhost dbparam['dbuser']= database.sys_dbuser dbparam['dbpassword'] = database.sys_dbpasswd dbparam['database'] = database.sys_dbname dbparam['refresh'] = 360 dbpar...
v['cxxshlib_PATTERN_cxxshlib'] = 'lib%s.so'
v['cxxshlib_PATTERN'] = 'lib%s.so'
def gxx_common_flags(conf): v = conf.env v['CXX_SRC_F'] = '' v['CXX_TGT_F'] = ['-c', '-o', ''] # shell hack for -MD # linker if not v['LINK_CXX']: v['LINK_CXX'] = v['CXX'] v['CXXLNK_SRC_F'] = '' v['CXXLNK_TGT_F'] = ['-o', ''] # shell hack for -MD v['CPPPATH_ST'] = '-I%s' v['DEFINES_S...
appname = getattr(Context.g_module, Context.APPNAME, 'noname') version = getattr(Context.g_module, Context.VERSION, '1.0') tmp_folder = appname + '-' + version try: self.arch_name except: self.arch_name = tmp_folder + '.' + self.ext_algo.get(self.algo, self.algo)
arch_name = self.get_arch_name()
def archive(self): """ Create the archive (override or subclass) """ import tarfile
node = self.base_path.make_node(self.arch_name)
node = self.base_path.make_node(arch_name)
def archive(self): """ Create the archive (override or subclass) """ import tarfile
tar = tarfile.open(self.arch_name, 'w:' + self.algo.replace('tar.', ''))
tar = tarfile.open(arch_name, 'w:' + self.algo.replace('tar.', ''))
def archive(self): """ Create the archive (override or subclass) """ import tarfile
tinfo = tar.gettarinfo(name=x.abspath(), arcname=x.path_from(self.base_path))
tinfo = tar.gettarinfo(name=x.abspath(), arcname=self.get_base_name() + '/' + x.path_from(self.base_path))
def archive(self): """ Create the archive (override or subclass) """ import tarfile
zip = zipfile.ZipFile(self.arch_name, 'w', compression=zipfile.ZIP_DEFLATED)
zip = zipfile.ZipFile(arch_name, 'w', compression=zipfile.ZIP_DEFLATED)
def archive(self): """ Create the archive (override or subclass) """ import tarfile
archive_name = x.path_from(self.base_path)
archive_name = self.get_base_name() + '/' + x.path_from(self.base_path)
def archive(self): """ Create the archive (override or subclass) """ import tarfile
import tempfile, tarfile appname = getattr(Context.g_module, Context.APPNAME, 'noname') version = getattr(Context.g_module, Context.VERSION, '1.0') waf = os.path.abspath(sys.argv[0]) tarball = Context.g_module.dist(ctx) t = tarfile.open(tarball) for x in t: t.extract(x) t.close() path = appname + '-' + version inst...
pass
def distcheck(ctx): '''checks if the project compiles (tarball from 'dist')''' import tempfile, tarfile appname = getattr(Context.g_module, Context.APPNAME, 'noname') version = getattr(Context.g_module, Context.VERSION, '1.0') waf = os.path.abspath(sys.argv[0]) tarball = Context.g_module.dist(ctx) t = tarfile.open(ta...
def get_fortran_tasks(bld):
def get_fortran_tasks(tsk): """ other fortran tasks from the same group """
def get_fortran_tasks(bld): tasks = [] for gp in bld.groups: # FIXME the current group only for tg in gp: try: tasks.extend(tg.tasks) except TypeError: tasks.append(tg.tasks) return [task for task in tasks if isinstance(task, fc) and not getattr(task, 'nomod', None)]
for gp in bld.groups: for tg in gp: try: tasks.extend(tg.tasks) except TypeError: tasks.append(tg.tasks)
bld = tsk.generator.bld gp = bld.groups[bld.get_group_idx(tsk.generator)] for tg in gp: try: tasks.extend(tg.tasks) except TypeError: tasks.append(tg)
def get_fortran_tasks(bld): tasks = [] for gp in bld.groups: # FIXME the current group only for tg in gp: try: tasks.extend(tg.tasks) except TypeError: tasks.append(tg.tasks) return [task for task in tasks if isinstance(task, fc) and not getattr(task, 'nomod', None)]
there are no concurrency issues since the method runnable_status is executed by the main thread
executed by the main thread so there are no concurrency issues
def runnable_status(self): """ set the mod file outputs and the dependencies on the mod files over all the fortran tasks there are no concurrency issues since the method runnable_status is executed by the main thread """ if getattr(self, 'mod_fortran_done', None): return super(fc, self).runnable_status()