def registry_tester(): # Call a wf result, pid = run(nested_tester, _return_pid=True) assert pid == result['pid'] assert pid == result['node_pk'] # Call a Process StackTester.run() return { 'pid': Int(ProcessStack.get_active_process_id()), 'node_pk': Int(ProcessStack.get_active_process_calc_node().pk) }
def registry_tester(): # Call a wf future = async (nested_tester) out = future.result() assert future.pid == out['pid'] assert future.pid == out['node_pk'] # Call a Process StackTester.run() return { 'pid': Int(ProcessStack.get_active_process_id()), 'node_pk': Int(ProcessStack.get_active_process_calc_node().pk) }
def calc_energies(codename, pseudo_family): print("Calculating energies, my pk is '{}'".format( ProcessStack.get_active_process_id())) futures = {} for element, scale in [("Si", 5.41)]: structure = create_diamond_fcc(Str(element), Float(1.)) structure = rescale(structure, Float(scale)) print("Running {} scf calculation.".format(element)) futures[element] = async(run_scf, structure, codename, pseudo_family) print("Waiting for calculations to finish.") outs = {element: Float(future.result()['output_parameters'].dict.energy) for element, future in futures.iteritems()} print("Calculations finished.") return outs
def nested_tester(): return { 'pid': Int(ProcessStack.get_active_process_id()), 'node_pk': Int(ProcessStack.get_active_process_calc_node().pk) }
def _run(self): assert ProcessStack.get_active_process_id() == self.pid assert ProcessStack.get_active_process_calc_node() is self.calc nested_tester()