Exemplo n.º 1
0
    def test_parallel_fibadder(self):
        # this is really testing to see if a Workflow can handle multiple FWs updating it at once
        parent = Firework(ScriptTask.from_str("python -c 'print(\"test1\")'", {'store_stdout': True}))
        fib1 = Firework(FibonacciAdderTask(), {'smaller': 0, 'larger': 1, 'stop_point': 30}, parents=[parent])
        fib2 = Firework(FibonacciAdderTask(), {'smaller': 0, 'larger': 1, 'stop_point': 30}, parents=[parent])
        fib3 = Firework(FibonacciAdderTask(), {'smaller': 0, 'larger': 1, 'stop_point': 30}, parents=[parent])
        fib4 = Firework(FibonacciAdderTask(), {'smaller': 0, 'larger': 1, 'stop_point': 30}, parents=[parent])
        wf = Workflow([parent, fib1, fib2, fib3, fib4])
        self.lp.add_wf(wf)

        p = Pool(NCORES_PARALLEL_TEST)

        creds_array = [self.lp.to_dict()] * NCORES_PARALLEL_TEST
        p.map(random_launch, creds_array)
Exemplo n.º 2
0
    def test_fibadder(self):
        fib = FibonacciAdderTask()
        fw = Firework(fib, {'smaller': 0, 'larger': 1, 'stop_point': 3})
        self.lp.add_wf(fw)
        rapidfire(self.lp, self.fworker, m_dir=MODULE_DIR)

        self.assertEqual(self.lp.get_launch_by_id(1).action.stored_data['next_fibnum'], 1)
        self.assertEqual(self.lp.get_launch_by_id(2).action.stored_data['next_fibnum'], 2)
        self.assertEqual(self.lp.get_launch_by_id(3).action.stored_data, {})
        self.assertFalse(self.lp.run_exists())
Exemplo n.º 3
0
    def test_fibadder(self):
        fib = FibonacciAdderTask()
        fw = FireWork(fib, {'smaller': 0, 'larger': 1, 'stop_point': 3})
        self.lp.add_wf(fw)
        rapidfire(self.lp,
                  m_dir=MODULE_DIR,
                  nlaunches=3,
                  sleep_time=5,
                  max_loops=30)
        time.sleep(5)
        self.assertEqual(
            self.lp.get_launch_by_id(1).action.stored_data['next_fibnum'], 1)
        self.assertEqual(
            self.lp.get_launch_by_id(2).action.stored_data['next_fibnum'], 2)
        try:
            self.assertEqual(
                self.lp.get_launch_by_id(3).action.stored_data, {})
        except:
            time.sleep(30)  # TODO: this is really ugly! but needed ... ugh
            self.assertEqual(
                self.lp.get_launch_by_id(3).action.stored_data, {})

        self.assertFalse(self.lp.run_exists())
Exemplo n.º 4
0
"""
This code is described in the Dynamic Workflow tutorial, http://pythonhosted.org/FireWorks/dynamic_wf_tutorial.html
"""

from fireworks import Firework, FWorker, LaunchPad
from fireworks.core.rocket_launcher import rapidfire
from fw_tutorials.dynamic_wf.fibadd_task import FibonacciAdderTask

if __name__ == "__main__":
    # set up the LaunchPad and reset it
    launchpad = LaunchPad()
    # launchpad.reset('', require_password=False)

    # create the Firework consisting of a custom "Fibonacci" task
    firework = Firework(FibonacciAdderTask(),
                        spec={
                            "smaller": 0,
                            "larger": 1,
                            "stop_point": 100
                        })

    # store workflow and launch it locally
    launchpad.add_wf(firework)
    rapidfire(launchpad, FWorker())
Exemplo n.º 5
0
"""
This code is described in the Dynamic Workflow tutorial, http://fireworks.readthedocs.io/en/latest/dynamic_wf_tutorial.html
"""

from fireworks import Firework, FWorker, LaunchPad
from fireworks.core.rocket_launcher import rapidfire
from fw_tutorials.dynamic_wf.fibadd_task import FibonacciAdderTask

if __name__ == "__main__":
    # set up the LaunchPad and reset it
    launchpad = LaunchPad()
    # launchpad.reset('', require_password=False)

    # create the Firework consisting of a custom "Fibonacci" task
    firework = Firework(FibonacciAdderTask(), spec={"smaller": 0, "larger": 1, "stop_point": 100})

    # store workflow and launch it locally
    launchpad.add_wf(firework)
    rapidfire(launchpad, FWorker())