本文整理汇总了Python中ZIBMolPy.pool.Pool.reload_nodes方法的典型用法代码示例。如果您正苦于以下问题:Python Pool.reload_nodes方法的具体用法?Python Pool.reload_nodes怎么用?Python Pool.reload_nodes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ZIBMolPy.pool.Pool
的用法示例。
在下文中一共展示了Pool.reload_nodes方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from ZIBMolPy.pool import Pool [as 别名]
# 或者: from ZIBMolPy.pool.Pool import reload_nodes [as 别名]
def main():
options = options_desc.parse_args(sys.argv)[0]
#TODO put somehow into Options, e.g. min_value=1 or required=True
if(not options.doomed_nodes):
sys.exit("Option --doomed_nodes is required.")
pool = Pool()
old_pool_size = len(pool)
old_alpha = pool.alpha
doomed_nodes = NodeList()
#TODO: maybe this code should go into ZIBMolPy.ui
for name in options.doomed_nodes.split(","):
found = [n for n in pool if n.name == name]
if(len(found) != 1):
sys.exit("Coult not find node '%s'"%(name))
doomed_nodes.append(found[0])
for n in doomed_nodes:
if(n == pool.root):
sys.exit("Node %s is the root. Removal not allowed."%(n.name))
#if(len(n.children) > 0):
# sys.exit("Node %s has children. Removal not allowed."%(n.name)) #TODO why should we forbid this?
if not(userinput("The selected node(s) will be removed permanently. Continue?", "bool")):
sys.exit("Quit by user.")
assert(len(doomed_nodes) == len(doomed_nodes.multilock()))
for n in doomed_nodes:
print("Removing directory: "+n.dir)
shutil.rmtree(n.dir)
pool.reload_nodes()
#TODO: this code-block also exists in zgf_create_node
if(len(pool.where("isa_partition")) < 2):
pool.alpha = None
elif(options.methodalphas == "theta"):
pool.alpha = zgf_create_nodes.calc_alpha_theta(pool)
elif(options.methodalphas == "user"):
pool.alpha = userinput("Please enter a value for alpha", "float")
else:
raise(Exception("Method unkown: "+options.methodalphas))
pool.history.append({'removed_nodes': [(n.name, n.state) for n in doomed_nodes], 'size':old_pool_size, 'alpha':old_alpha, 'timestamp':datetime.now()})
pool.save()
#TODO: deal with analysis dir and dependencies
zgf_cleanup.main()
示例2: main
# 需要导入模块: from ZIBMolPy.pool import Pool [as 别名]
# 或者: from ZIBMolPy.pool.Pool import reload_nodes [as 别名]
def main():
options = options_desc.parse_args(sys.argv)[0]
pool = Pool()
if(options.convtest):
for n in pool.where("state in ('converged', 'not-converged')"):
print("\n\nRunning Gelman-Rubin on %s"%n)
conv_check_gelman_rubin(n)
return # exit
auto_refines_counter = 0
while(True):
pool.reload()
pool.reload_nodes()
for n in pool:
n.reload()
active_node = None
for n in pool.where("state in ('em-mdrun-able', 'mdrun-able', 'rerun-able-converged', 'rerun-able-not-converged')"):
if(n.lock()):
active_node = n
break
if(active_node == None):
if(auto_refines_counter < options.auto_refines):
auto_refines_counter += 1
print("\n\nRunning 'zgf_refine --refine-all' for the %d time..."%auto_refines_counter)
zgf_refine.main(["--refine-all"])
continue
else:
break # we're done - exit
try:
process(active_node, options)
active_node.save()
active_node.unlock()
except:
print "MDRUN FAILED"
active_node.state = "mdrun-failed"
active_node.save()
active_node.unlock()
traceback.print_exc()
continue