Commit a0ace253 authored by Samuel GAIST's avatar Samuel GAIST

[experiments] Remove share-database option

This is now done at the Database declaration level.

Fixes #79
parent 7515a9f0
Pipeline #45624 passed with stage
in 8 minutes and 10 seconds
......@@ -75,14 +75,7 @@ logger = logging.getLogger(__name__)
def run_experiment(
configuration,
name,
force,
use_docker,
use_local,
run_environment_path,
quiet,
share_databases,
configuration, name, force, use_docker, use_local, run_environment_path, quiet
):
"""Run experiments locally"""
......@@ -234,12 +227,10 @@ def run_experiment(
python_path=run_environment_path,
)
elif use_docker:
exp_configuration = value["configuration"]
exp_configuration["share_databases"] = share_databases
executor = DockerExecutor(
host=host,
prefix=configuration.path,
data=exp_configuration,
data=value["configuration"],
cache=configuration.cache,
dataformat_cache=dataformat_cache,
database_cache=database_cache,
......@@ -783,20 +774,12 @@ commands.initialise_asset_commands(experiments, CMD_LIST, ExperimentCommand)
mutually_exclusive=["docker", "local"],
)
@click.option("--quiet", help="Be less verbose", is_flag=True)
@click.option(
"--share-databases",
help="Share the database files with the algorithm container",
is_flag=True,
default=False,
)
@click.pass_context
@raise_on_error
def run(ctx, name, force, docker, local, environment, quiet, share_databases):
def run(ctx, name, force, docker, local, environment, quiet):
""" Runs an experiment locally"""
config = ctx.meta.get("config")
return run_experiment(
config, name, force, docker, local, environment, quiet, share_databases
)
return run_experiment(config, name, force, docker, local, environment, quiet)
@experiments.command()
......
......@@ -227,30 +227,3 @@ class TestDockerExperimentRun(core.AssetBaseTest):
nose.tools.eq_(exit_code, 1, outputs)
exit_code, outputs = self.call("run", obj, "--docker", cache=tmp_prefix)
nose.tools.eq_(exit_code, 1, outputs)
def run_database_sharing(self, share_databases, expected_output):
"""Test that the database sharing works"""
db = Database(prefix, "integers_db/1")
nose.tools.assert_true(db.valid, db.errors)
data_sharing_path = db.data["root_folder"]
offset = 12
with open(os.path.join(data_sharing_path, "datafile.txt"), "wt") as data_file:
data_file.write("{}".format(offset))
obj = "user/user/integers_addition/1/shared_datasets"
args = ["run", obj, "--docker"]
if share_databases:
args.append("--share-databases")
exit_code, outputs = self.call(*args, cache=tmp_prefix)
nose.tools.eq_(exit_code, expected_output, outputs)
@slow
def test_run_database_sharing(self):
for share, result in [(False, 1), (True, 0)]:
yield self.run_database_sharing, share, result
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment