Commit 562c7727 authored by Samuel GAIST's avatar Samuel GAIST

[experiments] Refactor plotting

The old implementation did too many things on behalf of
the user like calling the online plotform to download
the plotter requested if missing with no way to disable
that behaviour. This would block the development of new
plotters since they would not be found online and the
command would end early.

Fixes #38
parent c05bf38d
Pipeline #40135 passed with stage
in 9 minutes and 32 seconds
This diff is collapsed.
......@@ -36,23 +36,25 @@
# Basic tests for the command line beat program: experiments
import os
import logging
import nose.tools
import os
from beat.core.test.utils import slow
from beat.core.test.test_execution import create_conda_environment
from beat.core.test.test_execution import clear_conda_environment
import nose.tools
from beat.core.experiment import Storage, Experiment
from beat.core.toolchain import Storage as TCStorage
from beat.core.algorithm import Storage as AlgStorage
from beat.core.dataformat import Storage as DFStorage
from .utils import index_experiment_dbs, MockLoggingHandler
from beat.core.experiment import Experiment
from beat.core.experiment import Storage
from beat.core.test.test_execution import clear_conda_environment
from beat.core.test.test_execution import create_conda_environment
from beat.core.test.utils import slow
from beat.core.toolchain import Storage as TCStorage
from . import core
from . import prefix, tmp_prefix
from . import prefix
from . import tmp_prefix
from .utils import MockLoggingHandler
from .utils import index_experiment_dbs
def setup_experiments():
......@@ -180,6 +182,43 @@ class TestOnline(core.OnlineAssetTestCase):
exit_code, outputs = self.call("runstatus", obj)
nose.tools.eq_(exit_code, 0, outputs)
@slow
@core.skip_disconnected
def test_plot_local_results(self):
obj = "user/user/single/1/single"
cache_path = os.path.join(tmp_prefix, "cache")
self.test_pull_one(obj)
index_experiment_dbs(obj)
exit_code, outputs = self.call("run", obj, prefix=tmp_prefix, cache=cache_path)
nose.tools.eq_(exit_code, 0, outputs)
plotters = ["plot/scatter/1", "plot/bar/1", "plot/isoroc/1"]
for plotter in plotters:
exit_code, outputs = self.call(
"pull",
plotter,
prefix=tmp_prefix,
asset_type="plotter",
cache=cache_path,
)
nose.tools.eq_(exit_code, 0, outputs)
# now push the new object and then delete it remotely
exit_code, outputs = self.call(
"plot",
"--output-folder=%s" % tmp_prefix,
obj,
prefix=tmp_prefix,
cache=cache_path,
)
nose.tools.eq_(exit_code, 0, outputs)
generated_files = [
file_ for file_ in os.listdir(tmp_prefix) if file_.endswith(".png")
]
nose.tools.assert_true(generated_files)
class TestCache(core.AssetBaseTest):
asset_type = "experiment"
......
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