Beispiel #1
0
def batched_zip_mapreduce(tmpdir, localfs_state_provider):
    """a workflow object with horizontally scalable map stage scheduling sub-workflows"""
    data = yadage.workflow_loader.workflow(
        "workflow.yml", "tests/testspecs/mapreduce_batched"
    )
    wflow = YadageWorkflow.createFromJSON(data, localfs_state_provider)
    return wflow
Beispiel #2
0
def local_helloworld_wflow_w_init(tmpdir, localfs_state_provider):
    '''a workflow object with horizontally scalable map stage scheduling sub-workflows'''
    data = yadage.workflow_loader.workflow('workflow.yml',
                                           'tests/testspecs/local-helloworld')
    wflow = YadageWorkflow.createFromJSON(data, localfs_state_provider)
    wflow.view().init({'par': 'hello'})
    return wflow
Beispiel #3
0
def value_registering_workflow(tmpdir, localfs_state_provider):
    """a workflow object with horizontally scalable map stage scheduling sub-workflows"""
    data = yadage.workflow_loader.workflow(
        "workflow.yml", "tests/testspecs/registering_values"
    )
    wflow = YadageWorkflow.createFromJSON(data, localfs_state_provider)
    return wflow
Beispiel #4
0
def singlestage_cases(tmpdir, localfs_state_provider):
    """a workflow object with horizontally scalable map stage scheduling sub-workflows"""
    data = yadage.workflow_loader.workflow(
        "workflow.yml", "tests/testspecs/casesflow/single"
    )
    wflow = YadageWorkflow.createFromJSON(data, localfs_state_provider)
    return wflow
Beispiel #5
0
def test_applicable():
    data = yadage.workflow_loader.workflow('workflow.yml',
                                           'tests/testspecs/local-helloworld')
    wflow = YadageWorkflow.createFromJSON(
        data, LocalFSProvider(LocalFSState(['/workdir']), ensure=False))
    wflow.view().init({'par': 'value'})
    assert wflow.rules[-1].applicable(wflow) == True
Beispiel #6
0
def test_getRule():
    data  = yadage.workflow_loader.workflow('workflow.yml','tests/testspecs/nestedmapreduce')
    wflow = YadageWorkflow.createFromJSON(data,LocalFSProvider(LocalFSState(['/workdir']), ensure = False))
    wflow.view().init({'input':[1,2,3]})

    assert wflow.view().getRule(identifier = wflow.rules[0].identifier) == wflow.rules[0]
    assert wflow.view().getRule(name = wflow.rules[0].rule.name, offset = '') == wflow.rules[0]
    assert wflow.view().getRule(name = 'nonexistent') == None
Beispiel #7
0
def test_serialize_offsetstage():
    data = yadage.workflow_loader.workflow("workflow.yml",
                                           "tests/testspecs/nestedmapreduce")
    wflow = YadageWorkflow.createFromJSON(
        data, LocalFSProvider(LocalFSState(["/workdir"]), ensure=False))
    wflow.view().init({"input": [1, 2, 3]})
    for x in wflow.rules:
        assert OffsetStage.fromJSON(x.json()).json() == x.json()
Beispiel #8
0
def local_helloworld_wflow_w_init(tmpdir, localfs_state_provider):
    """a workflow object with horizontally scalable map stage scheduling sub-workflows"""
    data = yadage.workflow_loader.workflow(
        "workflow.yml", "tests/testspecs/local-helloworld"
    )
    wflow = YadageWorkflow.createFromJSON(data, localfs_state_provider)
    wflow.view().init({"par": "hello"})
    return wflow
Beispiel #9
0
def test_serialize_deserialize():
    data  = yadage.workflow_loader.workflow('workflow.yml','tests/testspecs/local-helloworld')
    wflow = YadageWorkflow.createFromJSON(data,LocalFSProvider(LocalFSState(['/workdir']), ensure = False))
    wflow.view().init({'hello':'world'})
    assert wflow.rules[0].rule.json()
    assert wflow.rules[1].rule.json()

    assert JsonStage.fromJSON(wflow.rules[0].rule.json()).json() == wflow.rules[0].rule.json()
Beispiel #10
0
def test_apply():
    data  = yadage.workflow_loader.workflow('workflow.yml','tests/testspecs/local-helloworld')
    wflow = YadageWorkflow.createFromJSON(data,LocalFSProvider(LocalFSState(['/workdir']), ensure = False))
    wflow.view().init({'par': 'value'})
    assert wflow.rules[-1].applicable(wflow) == True
    wflow.rules[-1].apply(wflow)
    frommodel_controller('',{},wflow).sync_backend()
    assert wflow.rules[0].applicable(wflow) == True
    wflow.rules[0].apply(wflow)
Beispiel #11
0
def test_applicable():
    data = yadage.workflow_loader.workflow(
        "workflow.yml", "tests/testspecs/local-helloworld"
    )
    wflow = YadageWorkflow.createFromJSON(
        data, LocalFSProvider(LocalFSState(["/workdir"]), ensure=False)
    )
    wflow.view().init({"par": "value"})
    assert wflow.rules[-1].applicable(wflow) == True
Beispiel #12
0
def test_serialize_deserialize():
    data = yadage.workflow_loader.workflow('workflow.yml',
                                           'tests/testspecs/local-helloworld')
    wflow = YadageWorkflow.createFromJSON(
        data, LocalFSProvider(LocalFSState(['/workdir']), ensure=False))
    wflow.view().init({'hello': 'world'})
    assert wflow.rules[0].rule.json()
    assert wflow.rules[1].rule.json()

    assert JsonStage.fromJSON(
        wflow.rules[0].rule.json()).json() == wflow.rules[0].rule.json()
Beispiel #13
0
def test_getRule():
    data = yadage.workflow_loader.workflow("workflow.yml",
                                           "tests/testspecs/nestedmapreduce")
    wflow = YadageWorkflow.createFromJSON(
        data, LocalFSProvider(LocalFSState(["/workdir"]), ensure=False))
    wflow.view().init({"input": [1, 2, 3]})

    assert wflow.view().getRule(
        identifier=wflow.rules[0].identifier) == wflow.rules[0]
    assert (wflow.view().getRule(name=wflow.rules[0].rule.name,
                                 offset="") == wflow.rules[0])
    assert wflow.view().getRule(name="nonexistent") == None
Beispiel #14
0
def test_init():
    data  = yadage.workflow_loader.workflow('workflow.yml','tests/testspecs/nestedmapreduce')
    wflow = YadageWorkflow.createFromJSON(data,LocalFSProvider(LocalFSState(['/workdir']), ensure = False))
    view  = wflow.view()

    nrules_before = len(wflow.rules)
    view.init({'hello':'world'})
    nrules_after = len(wflow.rules)
    assert nrules_before + 1 == nrules_after
    view.rules[-1].apply(wflow)

    matches = view.query('init',view.steps)
    assert len(matches) == 1
Beispiel #15
0
def test_serialize_deserialize():
    data = yadage.workflow_loader.workflow(
        "workflow.yml", "tests/testspecs/local-helloworld"
    )
    wflow = YadageWorkflow.createFromJSON(
        data, LocalFSProvider(LocalFSState(["/workdir"]), ensure=False)
    )
    wflow.view().init({"hello": "world"})
    assert wflow.rules[0].rule.json()
    assert wflow.rules[1].rule.json()

    assert (
        JsonStage.fromJSON(wflow.rules[0].rule.json()).json()
        == wflow.rules[0].rule.json()
    )
Beispiel #16
0
def test_init():
    data = yadage.workflow_loader.workflow("workflow.yml",
                                           "tests/testspecs/nestedmapreduce")
    wflow = YadageWorkflow.createFromJSON(
        data, LocalFSProvider(LocalFSState(["/workdir"]), ensure=False))
    view = wflow.view()

    nrules_before = len(wflow.rules)
    view.init({"hello": "world"})
    nrules_after = len(wflow.rules)
    assert nrules_before + 1 == nrules_after
    view.rules[-1].apply(wflow)

    matches = view.query("init", view.steps)
    assert len(matches) == 1
Beispiel #17
0
def test_multistepstage_schedule_wflows(localfs_state_provider):
    data = yadage.workflow_loader.workflow('workflow.yml',
                                           'tests/testspecs/nestedmapreduce')
    wflow = YadageWorkflow.createFromJSON(data, localfs_state_provider)

    inputdata = [1, 2, 3]
    wflow.view().init({'input': inputdata})
    assert wflow.view().getRule(name='map').applicable(wflow) == False

    wflow.view().getRule(name='init').apply(wflow)
    assert len(wflow.dag.nodes()) == 1

    frommodel_controller('', {}, wflow).sync_backend()
    assert wflow.view().getRule(name='map').applicable(wflow) == True

    wflow.view().getRule(name='map').apply(wflow)
    assert wflow.view().getRule(name='reduce').applicable(wflow) == False
Beispiel #18
0
def test_multistepstage_schedule_wflows(localfs_state_provider):
    data  = yadage.workflow_loader.workflow('workflow.yml','tests/testspecs/nestedmapreduce')
    wflow = YadageWorkflow.createFromJSON(data,localfs_state_provider)


    inputdata = [1,2,3]
    wflow.view().init({'input':inputdata})
    assert wflow.view().getRule(name = 'map').applicable(wflow) == False

    wflow.view().getRule(name = 'init').apply(wflow)
    assert len(wflow.dag.nodes()) == 1

    frommodel_controller('',{},wflow).sync_backend()
    assert wflow.view().getRule(name = 'map').applicable(wflow) == True


    wflow.view().getRule(name = 'map').apply(wflow)
    assert wflow.view().getRule(name = 'reduce').applicable(wflow) == False
Beispiel #19
0
def test_serialize_offsetstage():
    data  = yadage.workflow_loader.workflow('workflow.yml','tests/testspecs/nestedmapreduce')
    wflow = YadageWorkflow.createFromJSON(data,LocalFSProvider(LocalFSState(['/workdir']), ensure = False))
    wflow.view().init({'input':[1,2,3]})
    for x in wflow.rules:
        assert OffsetStage.fromJSON(x.json()).json() == x.json()
Beispiel #20
0
def value_registering_workflow(tmpdir,localfs_state_provider):
    '''a workflow object with horizontally scalable map stage scheduling sub-workflows'''
    data  = yadage.workflow_loader.workflow('workflow.yml','tests/testspecs/registering_values')
    wflow = YadageWorkflow.createFromJSON(data,localfs_state_provider)
    return wflow
Beispiel #21
0
def singlestage_cases(tmpdir,localfs_state_provider):
    '''a workflow object with horizontally scalable map stage scheduling sub-workflows'''
    data  = yadage.workflow_loader.workflow('workflow.yml','tests/testspecs/casesflow/single')
    wflow = YadageWorkflow.createFromJSON(data,localfs_state_provider)
    return wflow
Beispiel #22
0
def batched_zip_mapreduce(tmpdir,localfs_state_provider):
    '''a workflow object with horizontally scalable map stage scheduling sub-workflows'''
    data  = yadage.workflow_loader.workflow('workflow.yml','tests/testspecs/mapreduce_batched')
    wflow = YadageWorkflow.createFromJSON(data,localfs_state_provider)
    return wflow
Beispiel #23
0
def local_helloworld_wflow_w_init(tmpdir,localfs_state_provider):
    '''a workflow object with horizontally scalable map stage scheduling sub-workflows'''
    data  = yadage.workflow_loader.workflow('workflow.yml','tests/testspecs/local-helloworld')
    wflow = YadageWorkflow.createFromJSON(data,localfs_state_provider)
    wflow.view().init({'par': 'hello'})
    return wflow
Beispiel #24
0
def jqnodestruct(tmpdir, localfs_state_provider):
    '''a workflow object with horizontally scalable map stage scheduling sub-workflows'''
    data = yadage.workflow_loader.workflow('workflow.yml',
                                           'tests/testspecs/jqnodestruct')
    wflow = YadageWorkflow.createFromJSON(data, localfs_state_provider)
    return wflow