def run(self, sinkSymbol): contentProvider = DBContentsProvider() modelCreator = DataFlowModelCreator(contentProvider) modelCreator.setSourceDistInCluster(0.2) modelCreator.setInvocDistInCluster(3) modelCreator.setMinNumMemersInInvocCluster(4) modelCreator.setTopnInvocClusters(10000) modelCreator.createDataFlowModels(sinkSymbol) models = modelCreator.getModels() overlayCreator = CheckOverlayCreator(contentProvider) overlayCreator.setMinCondObserved(3) # <- changed from 4 overlayCreator.setMinFracChecks(10) # <- changed from 10 # NOT USED! overlayCreator.setTopnCheckHist(10) # <- changed from 10 overlayCreator.createForModels(models) models = overlayCreator.getModels() modelPrinter = ModelPrinter() # modelPrinter.printSummary(models) # modelPrinter.printAll(models) converter = ModelToQuery() for model in models: query = converter.convert(model) # print 'ClusterId: ' + str(model.clusterId) print query
def run(self, checkId): contentProvider = DBContentsProvider() check2SubChecks = CheckToSubChecks(contentProvider) subChecks = check2SubChecks.checkToSubChecks(checkId) check2Sinks = CheckToSinks(contentProvider) sinks = check2Sinks.checkToSink(checkId) print sinks if not sinks: print 'No sinks.' sys.exit() modelCreator = DataFlowModelCreator(contentProvider) overlayCreator = CheckOverlayCreator(contentProvider) for sink in sinks: sinkSymbol, callSiteId = sink if 'log' in sinkSymbol: continue print sinkSymbol modelCreator.createDataFlowModels(sinkSymbol, callSiteId) models = modelCreator.getModels() overlayCreator.createForModels(models, subChecks) models = overlayCreator.getModels() converter = ModelToQuery() for query in [converter.convert(model) for model in models]: print query