擅长:python、mysql、java
<p>我在<code>safeABQrun</code>中引入了一个循环,它管理5个不同的“队列”。循环是必要的,以避免分析试图在节点中运行而另一个节点仍在运行。分析被预先配置为在开始任何实际分析之前在请求的节点之一中运行。在</p>
<pre class="lang-py prettyprint-override"><code>def safeABQrun(*list_args):
import os
inpFiles,paths,jobVars = list_args
nA = len(inpFiles)
for k in range(0,nA):
args = (inpFiles[k],paths[k],jobVars[k])
try:
runABQfile(*args) # Actual Run Function
except Exception as e:
print("Tread Error: %s runABQfile(*%r)" % (e, args))
def errFunction(ppos, *args):
with ProcessPoolExecutor(max_workers=nParallelLoops) as executor:
futures = dict((executor.submit(safeABQrun, inpF, aPth, jVrs), k) for inpF, aPth, jVrs, k in list_args) # 5Nodes
for f in as_completed(futures):
print("|=== Finish Process Train %d ===|" % futures[f])
if f.exception() is not None:
print('%r generated an exception: %s' % (futures[f], f.exception()))
</code></pre>