Esempio n. 1
0
def test_set_capture(repo):

    @p.provenance()
    def add(a, b):
       return a + b

    @p.provenance()
    def mult(x, y):
       return x * y

    with p.capture_set(name='first'):
        x1 = add(2, 2)
        z1 = mult(x1, 10)

    first_set = repo.get_set_by_name('first')
    assert first_set.artifact_ids == {x1.artifact.id, z1.artifact.id}


    with p.capture_set(name='second'):
        _x = add(2, 2)
        z2 = mult(_x, 20)

    second_set = repo.get_set_by_name('second')
    # note how we check to see if x1 is present!
    assert second_set.artifact_ids == {x1.artifact.id, z2.artifact.id}
Esempio n. 2
0
def test_set_capture_with_initial_artifacts(repo):
    @p.provenance()
    def add(a, b):
        return a + b

    @p.provenance()
    def mult(x, y):
        return x * y

    x = add(3, 33)

    with p.capture_set(initial_set={x.artifact.id}, labels='first'):
        z1 = mult(x, 10)

    first_set = repo.get_set_by_labels('first')
    assert first_set.artifact_ids == {x.artifact.id, z1.artifact.id}
Esempio n. 3
0
def test_set_capture_on_loads(repo):
    @p.provenance()
    def add(a, b):
        return a + b

    @p.provenance()
    def mult(x, y):
        return x * y

    x = add(3, 33)

    with p.capture_set(labels='first'):
        x = repo.get_by_id(x.artifact.id).proxy()
        z1 = mult(x, 10)

    first_set = repo.get_set_by_labels('first')
    assert first_set.artifact_ids == {x.artifact.id, z1.artifact.id}