Пример #1
0
    def __call__(self, progressReporter=None):
        n = random.randint(5, 1000000)
        taskid = uuid.uuid4()
        time.sleep(random.randint(0, 3))
        for i in xrange(n):
            time.sleep(0.0001)
            report = ProgressReport(name=self.name,
                                    done=i + 1,
                                    total=n,
                                    taskid=taskid)
            progressReporter.report(report)
        return None


##__________________________________________________________________||
progressBar = ProgressBar() if sys.stdout.isatty() else ProgressPrint()

##__________________________________________________________________||
progressMonitor = BProgressMonitor(presentation=progressBar)
channel = CommunicationChannel(nprocesses=10, progressMonitor=progressMonitor)
progressMonitor.begin()
channel.begin()
channel.put(Task("loop"))
channel.put(Task("another loop"))
channel.put(Task("more loop"))
channel.put(Task("loop loop loop"))
channel.put(Task("l"))
channel.put(Task("loop6"))
channel.put(Task("loop7"))
channel.put(Task("loop8"))
channel.put(Task("loop6"))
Пример #2
0
deliveryMethod2 = WriteListToFile(outPath2)
collector2 = Collector(resultsCombinationMethod2, deliveryMethod2)

outPath3 = os.path.join(args.outdir, 'tbl_njets_nbjets.txt')
binning31 = Echo()
binning32 = Echo()
keyComposer3 = GenericKeyComposer(('nJet40', 'nBJet40'),
                                  (binning31, binning32))
nextKeyComposer3 = NextKeyComposer((binning31, binning32))
resultsCombinationMethod3 = CombineIntoList(('njets', 'nbjets'))
deliveryMethod3 = WriteListToFile(outPath3)
collector3 = Collector(resultsCombinationMethod3, deliveryMethod3)

eventBuilder = EventBuilder(analyzerName, fileName, treeName, args.nevents)

progressBar = ProgressBar()
progressMonitor = ProgressMonitor(progressBar)
progressReporter = progressMonitor.createReporter()

heppyResult = HeppyResult(args.heppydir)
for component in heppyResult.components():

    counts1 = Counts()
    counter1 = Counter(keyComposer1, counts1, nextKeyComposer1)
    collector1.addReader(component.name, counter1)

    counts2 = Counts()
    counter2 = Counter(keyComposer2, counts2, nextKeyComposer2)
    collector2.addReader(component.name, counter2)

    counts3 = Counts()
Пример #3
0
resultsCombinationMethod2 = CombineIntoList(('jet_pt', ))
deliveryMethod2 = WriteListToFile(outPath2)
collector2 = Collector(resultsCombinationMethod2, deliveryMethod2)

outPath3 = os.path.join(args.outdir, 'tbl_njets_nbjets.txt')
binning31 = Echo()
binning32 = Echo()
keyComposer3 = GenericKeyComposer(('nJet40', 'nBJet40'),
                                  (binning31, binning32))
resultsCombinationMethod3 = CombineIntoList(('njets', 'nbjets'))
deliveryMethod3 = WriteListToFile(outPath3)
collector3 = Collector(resultsCombinationMethod3, deliveryMethod3)

eventBuilder = EventBuilder(analyzerName, fileName, treeName, args.nevents)

progressBar = ProgressBar()

heppyResult = HeppyResult(args.heppydir)
for component in heppyResult.components():

    counts1 = Counts()
    counter1 = Counter(keyComposer1, counts1)
    collector1.addReader(component.name, counter1)

    counts2 = Counts()
    counter2 = Counter(keyComposer2, counts2)
    collector2.addReader(component.name, counter2)

    counts3 = Counts()
    counter3 = Counter(keyComposer3, counts3)
    collector3.addReader(component.name, counter3)