Пример #1
0
 def test_multiple_dependencies_on_single_node(self):
     p = uberjob.Plan()
     x = p.call(lambda value: value, 1)
     y = p.call(lambda *args, **kwargs: (args, kwargs), x, x, a=x, b=x)
     p.add_dependency(x, y)
     self.assertEqual(uberjob.run(p, output=y), ((1, 1), {"a": 1, "b": 1}))
Пример #2
0
def test_render_level():
    plan = uberjob.Plan()
    with plan.scope("x"):
        x = plan.call(add, 2, 3)
    plan.call(add, x, 4)
    uberjob.render(plan, level=1, format="svg")
Пример #3
0
 def test_run_empty_plan(self):
     uberjob.run(uberjob.Plan())
Пример #4
0
def test_render():
    plan = uberjob.Plan()
    plan.call(add, 2, 3)
    uberjob.render(plan, format="svg")
Пример #5
0
def test_render_registry():
    plan = uberjob.Plan()
    registry = uberjob.Registry()
    x = plan.call(add, 2, 3)
    registry.add(x, TestStore())
    uberjob.render(plan, registry=registry, format="svg")
Пример #6
0
def test_ipython_progress():
    plan = uberjob.Plan()
    x = plan.call(add, 2, 3)
    uberjob.run(plan, output=x, progress=uberjob.progress.ipython_progress)
Пример #7
0
def test_ipython_progress_with_exception():
    plan = uberjob.Plan()
    x = plan.call(fail)
    with pytest.raises(uberjob.CallError):
        uberjob.run(plan, output=x, progress=uberjob.progress.ipython_progress)
Пример #8
0
 def test_basic(self):
     plan = uberjob.Plan()
     x = plan.lit(range(7, 11))
     a, b, c, d = plan.unpack(x, 4)
     self.assertEqual(uberjob.run(plan, output=(d, c, b, a)), (10, 9, 8, 7))
Пример #9
0
def test_html_progress():
    plan = uberjob.Plan()
    x = plan.call(add, 2, 3)
    with tempfile.TemporaryDirectory() as temp:
        path = os.path.join(temp, "uberjob.html")
        uberjob.run(plan, output=x, progress=uberjob.progress.html_progress(path))
Пример #10
0
 def test_run_error_infinite_iterable(self):
     plan = uberjob.Plan()
     a, b = plan.unpack(ones(), 2)
     with self.assert_call_exception(expected_exception=ValueError):
         uberjob.run(plan, output=(b, a))
Пример #11
0
def main():
    plan = uberjob.Plan()
    items = [plan.call(time.sleep, 1) for _ in range(1000)]
    uberjob.run(plan, output=items, max_workers=4)
Пример #12
0
 def test_forgot_registry_with_source(self):
     p = uberjob.Plan()
     r = uberjob.Registry()
     x = r.source(p, TestStore(5))
     with self.assert_forgotten_registry():
         uberjob.run(p, output=x)
Пример #13
0
 def test_failed_to_get_modified_time(self):
     p = uberjob.Plan()
     r = uberjob.Registry()
     x = r.source(p, TestStore(can_get_modified_time=False))
     with self.assert_call_exception():
         uberjob.run(p, registry=r, output=x, dry_run=True)
Пример #14
0
 def test_failed_to_read_from_empty_store_1(self):
     p = uberjob.Plan()
     r = uberjob.Registry()
     x = r.source(p, TestStore())
     with self.assert_failed_to_read_from_empty_store():
         uberjob.run(p, registry=r, output=x)