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}))
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")
def test_run_empty_plan(self): uberjob.run(uberjob.Plan())
def test_render(): plan = uberjob.Plan() plan.call(add, 2, 3) uberjob.render(plan, format="svg")
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")
def test_ipython_progress(): plan = uberjob.Plan() x = plan.call(add, 2, 3) uberjob.run(plan, output=x, progress=uberjob.progress.ipython_progress)
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)
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))
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))
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))
def main(): plan = uberjob.Plan() items = [plan.call(time.sleep, 1) for _ in range(1000)] uberjob.run(plan, output=items, max_workers=4)
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)
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)
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)