def test_parallel_workflow(self): args = ["--backend=multiprocessing", "--cpu-count=1", "test.config.workflow_config_parallel"] mgr = WorkflowManager(args) mgr.launch() assert ctx().valuesSum == 285
def _main(*argv): if (argv is None or len(argv) < 1): _usage() return argv = list(argv) mgr = WorkflowManager(argv) mgr.launch()
def _main(*argv): if(argv is None or len(argv)<1): _usage() return argv = list(argv) mgr = WorkflowManager(argv) mgr.launch()
def test_launch(self): args = ["test.config.workflow_config"] mgr = WorkflowManager(args) mgr.launch() assert ctx() is not None assert ctx().params is not None assert ctx().params.plugins is not None
def test_simple_launch(self): args = ["test.config.workflow_config_simple"] mgr = WorkflowManager(args) mgr.launch() assert ctx() is not None assert ctx().params is not None assert ctx().params.plugins is not None assert isinstance(ctx().params.plugins, Loop)
def test_cust_ctx_provider(self): context.global_ctx = None args = ["test.config.workflow_config_cust"] mgr = WorkflowManager(args) mgr.launch() assert ctx() is not None from ivy.context import getContextProvider assert getContextProvider() == PickleContextProvider
def execute(args): """ Runs a workflow for the given arguments. :param args: list of arguments which should be passed to ivy. The last argument has to be the config :returns: the global_ctx """ mgr = WorkflowManager(args) mgr.launch() return context.global_ctx
def test_missing_config(self): try: mgr = WorkflowManager(None) pytest.fail("missing config not allowed", True) except InvalidAttributeException: assert True try: mgr = WorkflowManager([]) pytest.fail("missing config not allowed", True) except InvalidAttributeException: assert True
def test_unknown_args(self): args = ["--a=1", "test.config.workflow_config_simple"] try: mgr = WorkflowManager(args) pytest.fail("wrong argument format", True) except GetoptError: assert True
def test_missing_plugins(self): args = ["ivy.config.base_config"] try: mgr = WorkflowManager(args) pytest.fail("config without plugins not allowed", True) except InvalidAttributeException: assert True
def test_invalid_config(self): args = [ "test.config.workflow_config_simple", "test.config.workflow_config_simple" ] try: mgr = WorkflowManager(args) pytest.fail("two configs not allowed", True) except InvalidAttributeException: assert True
def test_workflow_context_pickle(self): args = [ "--backend=multiprocessing", "--cpu-count=1", "test.config.workflow_config_parallel" ] mgr = WorkflowManager(args) lCtx = ctx() sLCtx = dumps(lCtx) lCtx2 = loads(sLCtx)
def test_create_from_dict(self): args = { "plugins": ["test.plugin.simple_plugin", "test.plugin.simple_plugin"], "a": 1 } mgr = WorkflowManager(args) assert ctx().params is not None assert ctx().params.a is 1 assert ctx().params.plugins is not None plugins = [p for p in ctx().params.plugins] assert len(plugins) is 2
def test_parseArgs(self): args = [ "--a=True", "--b=False", "--c=-1", "--d=0", "--e=1", "--f=-1.0", "--g=0.0", "--h=1.0", "--i=le_string", "--j=1,2,3,4", "--bool1=True", "--bool2=False", "--bool3=True", "--bool4=False", "test.config.workflow_config" ] mgr = WorkflowManager(args) assert ctx().params.a == True assert ctx().params.b == False assert ctx().params.c == -1 assert ctx().params.d == 0 assert ctx().params.e == 1 assert ctx().params.f == -1.0 assert ctx().params.g == 0.0 assert ctx().params.h == 1.0 assert ctx().params.i == "le_string" assert ctx().params.bool1 == True assert ctx().params.bool2 == False assert ctx().params.bool3 == True assert ctx().params.bool4 == False assert all(map(eq, ctx().params.j, [1, 2, 3, 4]))