當前位置: 首頁>>代碼示例>>Python>>正文


Python ProcessPool.processAllResults方法代碼示例

本文整理匯總了Python中DIRAC.Core.Utilities.ProcessPool.ProcessPool.processAllResults方法的典型用法代碼示例。如果您正苦於以下問題:Python ProcessPool.processAllResults方法的具體用法?Python ProcessPool.processAllResults怎麽用?Python ProcessPool.processAllResults使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在DIRAC.Core.Utilities.ProcessPool.ProcessPool的用法示例。


在下文中一共展示了ProcessPool.processAllResults方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: runTest

# 需要導入模塊: from DIRAC.Core.Utilities.ProcessPool import ProcessPool [as 別名]
# 或者: from DIRAC.Core.Utilities.ProcessPool.ProcessPool import processAllResults [as 別名]
def runTest():

  global nClients, nQueries, testType, resultTest, testDir, lfnListFile

  resultTest = []

  pp = ProcessPool(nClients)

  testFunction = eval(testType)

  for c in xrange(nClients):
    pp.createAndQueueTask(testFunction, [nQueries],
                          callback=finalize,
                          exceptionCallback=doException)

  pp.processAllResults(3600)
  pp.finalize(0)

  timeResult = []
  for testTime, success, failure in resultTest:
    # print testTime,success,failure
    timeResult += testTime

  averageTime, errorTime = doStats(timeResult)
  rateResult = [nClients / t for t in timeResult]
  averageRate, errorRate = doStats(rateResult)

  if testDir:
    print "\nTest results for clients %d, %s" % (nClients, testDir)
  else:
    print "\nTest results for clients %d, %s" % (nClients, lfnListFile)

  print "Query time: %.2f +/- %.2f" % (averageTime, errorTime)
  print "Query rate: %.2f +/- %.2f" % (averageRate, errorRate)

  return((averageTime, errorTime), (averageRate, errorRate))
開發者ID:DIRACGrid,項目名稱:DIRAC,代碼行數:38,代碼來源:FIXME_Test_FC_scaling.py

示例2: ProcessPool

# 需要導入模塊: from DIRAC.Core.Utilities.ProcessPool import ProcessPool [as 別名]
# 或者: from DIRAC.Core.Utilities.ProcessPool.ProcessPool import processAllResults [as 別名]
pPool = ProcessPool(10,50,50)
pPool.daemonize()

# dirlist = ['prod/ilc/mc-dbd/generated','prod/ilc/mc-dbd/ild']
# dirlist= ['prod/ilc/mc-dbd/generated/500-TDR_ws/higgs']
# dirlist= ['prod/ilc/mc-dbd/generated/250-TDR_ws/higgs','prod/ilc/mc-dbd/generated/350-TDR_ws/higgs']
#dirlist= ['prod/ilc/mc-dbd/generated/250-TDR_ws']
#dirlist= ['prod/ilc/mc-dbd/generated/250-TDR_ws/1f',
#          'prod/ilc/mc-dbd/generated/250-TDR_ws/3f',
#          'prod/ilc/mc-dbd/generated/250-TDR_ws/aa_lowpt',
#          'prod/ilc/mc-dbd/generated/250-TDR_ws/aa_minijet']
#dirlist= ['prod/ilc/mc-dbd/generated/250-TDR_ws/aa_2f',
#          'prod/ilc/mc-dbd/generated/350-TDR_ws/3f',
#          'prod/ilc/mc-dbd/generated/350-TDR_ws/1f',
#          'prod/ilc/mc-dbd/generated/350-TDR_ws/aa_minijet']

lfcHosts = ['grid-lfc.desy.de']

for dir in dirlist:
  path = "/ilc/%s" % (dir)
  print "Queueing user", dir, pPool.getFreeSlots(),pPool.getNumWorkingProcesses(),pPool.hasPendingTasks(),pPool.getNumIdleProcesses(), lfcHosts[0]
  result = pPool.createAndQueueTask( processDir,[path,True,lfcHosts[0]],callback=finalizeDirectory ) 
  if not result['OK']:
    print "Failed queueing", path

pPool.processAllResults()

print "LFC_to_DFC completed."


開發者ID:akiyamiyamoto,項目名稱:ildprod,代碼行數:30,代碼來源:LFC_to_DFC.py

示例3: Process

# 需要導入模塊: from DIRAC.Core.Utilities.ProcessPool import ProcessPool [as 別名]
# 或者: from DIRAC.Core.Utilities.ProcessPool.ProcessPool import processAllResults [as 別名]
#             'lfc-lhcb.grid.sara.nl',
#             'lfclhcb.pic.es',
#             'lhcb-lfc.gridpp.rl.ac.uk']
lfcHosts = ['prod-lfc-lhcb-ro.cern.ch']


# path = "/lhcb/LHCb"
path = '/lhcb/user/c/chaen'
print "Queueing task for directory", path, lfcHosts[0]


writerProc = Process( target = writer, args = ( 'lfc_dfc.out', writerQueue, stopFlag ) )

writerProc.start()


result = pPool.createAndQueueTask( processDir, [path , writerQueue, False, lfcHosts[0]], callback = finalizeDirectory )
if not result['OK']:
  print "Failed queueing", path

for i in range(20):
  pPool.processResults()
  time.sleep(1)

pPool.processAllResults( timeout = 300 )

stopFlag.value = 1
writerQueue.put( "Exit" )
writerProc.join()

開發者ID:DIRACGrid-test,項目名稱:DIRAC,代碼行數:31,代碼來源:lfc_dfc_copy.py


注:本文中的DIRAC.Core.Utilities.ProcessPool.ProcessPool.processAllResults方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。