def test_formatter2(self): fns = { "check": "{prefix}/runs/{run_id}/check/{hparams_id}/", } cli_args = { "prefix": "/data", "run_id": None, "model_type": "deep", "input_type": "full_emb", } f = fn_formatter(cli_args, fns, run_id="pipeline_run_id") assert f("check") == "/data/runs/pipeline_run_id/check/deep_full_emb/"
def ff(prefix): kw = {"prefix": str(prefix)} fns = { "tmp_loc": "{prefix}/tmp_loc.csv", "tmp_dir": "{prefix}/", "tmp_chunk": "{prefix}/*.json", "datasets": "{prefix}/datasets/", "dataset": "{prefix}/datasets/{ds}/", "ds_file": "{prefix}/datasets/{ds}/{split}/*.json", "es_dump": "{prefix}/es_dump/{idx}/", "es_dump_mapping": "{prefix}/es_dump/{idx}/mapping.json", "es_dump_data_file": "{prefix}/es_dump/{idx}/data.json", "es_dump_data_chunked": "{prefix}/es_dump/{idx}/data/*.json", } return fn_formatter(kw, fns)
def test_formatter1(self): fns = { "cats_mapping": "{prefix}/runs/{run_id}/categories/mapping.json", "check": "{prefix}/runs/{run_id}/check/{hparams_id}/", } cli_args = { "prefix": "/data", "run_id": None, } f = fn_formatter(cli_args, fns, run_id="pipeline_run_id") assert f("cats_mapping" ) == "/data/runs/pipeline_run_id/categories/mapping.json" assert f("cats_mapping", run_id="rid_override" ) == "/data/runs/rid_override/categories/mapping.json" with pytest.raises(Exception): f("check")
def func(key, val, cls=SequentialRunner): strategy = deepcopy(DEFAULT_STRATEGY) strategy[key] = val return cls({}, fn_formatter(kw, fns, run_id=RUN_ID), strategy=strategy)
def ff(self, kw, fns): return fn_formatter(kw, fns, run_id=RUN_ID)