def test_setup_filebacked(tmpdir, local_helloworld_wflow):
    thefile = tmpdir.join("state.json")
    thefile.write(json.dumps(local_helloworld_wflow.json()))
    model = load_model_fromstring("filebacked:" + str(thefile))
    assert type(model) == FileBackedModel
    ctrl = setup_controller(model)
    assert type(ctrl) == PersistentController
def test_setup_filebacked(tmpdir, local_helloworld_wflow):
	thefile = tmpdir.join('state.json')
	thefile.write(json.dumps(local_helloworld_wflow.json()))
	model = load_model_fromstring('filebacked:'+str(thefile))
	assert type(model) == FileBackedModel
	ctrl = setup_controller(model)
	assert type(ctrl) == PersistentController
def test_from_pythonctrl(tmpdir, local_helloworld_wflow):
	thefile = tmpdir.join('state.json')
	thefile.write(json.dumps(local_helloworld_wflow.json()))
	model = load_model_fromstring('filebacked:'+str(thefile))
	assert type(model) == FileBackedModel
	ctrl = setup_controller(model, controller = 'py:yadage.controllers:PersistentController', ctrlopts = {'pass_model': True})
	assert type(ctrl) == PersistentController
	assert ctrl.model is not None
def init_app(app, statetype, stateopts, backendstring, backendopts = None):
    from yadage.wflowstate import load_model_fromstring
    from yadage.utils import setupbackend_fromstring
    from yadage.controllers import PersistentController
    model      = load_model_fromstring(statetype,stateopts)
    backend    = setupbackend_fromstring(backendstring, backendopts)
    app.config['yadage_controller'] = PersistentController(model,backend)
    app.config['yadage_controller'].sync_backend()
    from yadageblueprint import blueprint

    app.register_blueprint(blueprint)
Exemple #5
0
def test_from_pythonctrl(tmpdir, local_helloworld_wflow):
    thefile = tmpdir.join('state.json')
    thefile.write(json.dumps(local_helloworld_wflow.json()))
    model = load_model_fromstring('filebacked:' + str(thefile))
    assert type(model) == FileBackedModel
    ctrl = setup_controller(
        model,
        controller='py:yadage.controllers:PersistentController',
        ctrlopts={'pass_model': True})
    assert type(ctrl) == PersistentController
    assert ctrl.model is not None
def test_setup_inmem(tmpdir, local_helloworld_wflow):
	model = load_model_fromstring('inmem', initmodel = local_helloworld_wflow)
	assert type(model) == YadageWorkflow
	ctrl = setup_controller(model)
	assert type(ctrl) == YadageController
def test_setup_inmem(tmpdir, local_helloworld_wflow):
    model = load_model_fromstring("inmem", initmodel=local_helloworld_wflow)
    assert type(model) == YadageWorkflow
    ctrl = setup_controller(model)
    assert type(ctrl) == YadageController