Example #1
0
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)
    }
Example #2
0
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)
    }
Example #3
0
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
Example #4
0
 def tearDown(self):
     super(TestProcessRegistry, self).tearDown()
     self.assertEquals(len(ProcessStack.stack()), 0)
Example #5
0
 def setUp(self):
     super(TestProcessRegistry, self).setUp()
     self.assertEquals(len(ProcessStack.stack()), 0)
Example #6
0
def nested_tester():
    return {
        'pid': Int(ProcessStack.get_active_process_id()),
        'node_pk': Int(ProcessStack.get_active_process_calc_node().pk)
    }
Example #7
0
 def _run(self):
     assert ProcessStack.get_active_process_id() == self.pid
     assert ProcessStack.get_active_process_calc_node() is self.calc
     nested_tester()
Example #8
0
 def current_calc_node(self):
     return ProcessStack.top().calc
Example #9
0
 def current_pid(self):
     return ProcessStack.top().pid