Пример #1
0
def get_example_graph():
    from recipe.task import test
    job1 = test.Test(text=Path("input_text1.gz"))
    job2 = test.Test(text=Path("input_text2.gz"))
    job_merge1 = test.MergeInputs([job1.out, job2.out])
    job_merge2 = test.MergeInputs([job2.out, job1.out])
    job_merge3 = test.MergeInputs([job1.out, job2.out, job_merge1.out, job_merge2.out])
    return SISGraph(output={'test': job_merge3.out})
Пример #2
0
 def test_f(self):
     from recipe.task import test
     t = test.Test('foo')
     Point = collections.namedtuple('Point', ['x', 'y'])
     for obj, ref, hash_ref in [
         (0, b'(int, 0)', '32c41e3ec33997dc8f7aa39d8c00317b'),
         ('0', b"(str, '0')", None),
         (b'0', b"(bytes, 0)", None),
         (b'\x00', b'(bytes, \x00)', None),
         ((8 + 6j), b"(complex, (8+6j))", None),
         (None, b"(NoneType)", None),
         ([1, 2, -1], b"(list, (int, 1), (int, 2), (int, -1))", None),
         ((1, 2, -1), b"(tuple, (int, 1), (int, 2), (int, -1))", None),
         ({1, 2, -1}, b"(set, (int, -1), (int, 1), (int, 2))", None),
         (frozenset({1, 2, -1}),
          b"(frozenset, (int, -1), (int, 1), (int, 2))", None),
         ({
             'foo': 1,
             'bar': -1
         },
          b"(dict, (tuple, (str, 'bar'), (int, -1)), (tuple, (str, 'foo'), (int, 1)))",
          None),
         (TestClass(1, 2),
          b"(TestClass, (dict, (tuple, (str, 'a'), (int, 1)), (tuple, (str, 'b'), (int, 2))))",
          None),
         (Point(3, 5),
          b'(Point, (tuple, (tuple, (int, 3), (int, 5)), (NoneType)))',
          None),
         (test.Test('foo'),
          b"task/test/Test.7be358a10ed713206e44d0ab965e8612", None),
         (job_path.Path('foo/bar'),
          b"(Path, (tuple, (NoneType), (str, 'foo/bar')))", None),
         (b'0' * 4087, b"(bytes, " + b'0' * 4087 + b")", None),
         (b'0' * 4088,
          b't\xe0\xf8\xbb\xfd\xe6\xfaN\xa6\xac`\x7f\xd3\xfeZ\xa3c6z\xe8\xc7\x869^\xa1\x011\x8e\xfcx\xa1V',
          None),
         ({
             TestClass(1, 2): 999,
             test.Test('foo'): 777,
             'foo': test.Test('bar'),
             'bar': job_path.Path('foo/bar'),
             job_path.Path('foo/bar'): 'bar'
         },
          b"(dict, (tuple, (Path, (tuple, (NoneType), (str, 'foo/bar'))), (str, 'bar')), "
          b"(tuple, (TestClass, (dict, (tuple, (str, 'a'), (int, 1)), (tuple, (str, 'b'), "
          b"(int, 2)))), (int, 999)), (tuple, (str, 'bar'), (Path, (tuple, (NoneType), "
          b"(str, 'foo/bar')))), (tuple, (str, 'foo'), task/test/Test.84bbb5730368c68c8151b56c3ede6c5e), "
          b"(tuple, task/test/Test.7be358a10ed713206e44d0ab965e8612, (int, 777)))",
          None),
     ]:
         res = sis_hash_helper(obj)
         self.assertEqual(res, ref)
         if hash_ref is None:
             hash_ref = hashlib.md5(ref).hexdigest()
         hash_res = sis_hash(obj)
         self.assertEqual(hash_res, hash_ref)
Пример #3
0
def get_example_graph():
    from recipe.task import test
    job1 = test.Test(text=Path("input_text1.gz"))
    job2 = test.Test(text=Path("input_text2.gz"))
    job_merge1 = test.MergeInputs([job1.out, job2.out])
    job_merge2 = test.MergeInputs([job2.out, job1.out])
    job_merge3 = test.MergeInputs([job1.out, job2.out, job_merge1.out, job_merge2.out])
    graph = SISGraph()
    graph.add_target(OutputPath('test', job_merge3.out))
    return graph
Пример #4
0
def test_jobs():
    import recipe.task.test as test_recipe
    job1 = test_recipe.Test(text=Path("input_text1.gz"))
    job2 = test_recipe.Test(text=Path("input_text2.gz"))
    job_merge1 = test_recipe.MergeInputs([job1.out, job2.out])
    job_merge2 = test_recipe.MergeInputs([job2.out, job1.out])
    job_merge3 = test_recipe.MergeInputs(
        [job1.out, job2.out, job_merge1.out, job_merge2.out])
    graph = SISGraph(output={'test': job_merge3.out})
    job_engine = engine.Engine()

    server = http_server.start(sis_graph=graph,
                               sis_engine=job_engine,
                               debug=True,
                               port=5001)