def run(self, args: argparse.Namespace) -> None: settings = Settings() if args.config_file is not None: settings.load(args.config_file) store_path = args.store or settings.logstore_storepath store = LogStore(store_path) runinfo = store.load_run(args.run) if args.force: choise = "y" else: choise = input(f"Do you delete this run: {runinfo.uuid} ? [y/N] ") if choise.strip().lower() == "y": store.delete_run(runinfo.uuid)
def run(self, args: argparse.Namespace) -> None: settings = Settings() if args.config_file is not None: settings.load(args.config_file) store_path = args.store or settings.logstore_storepath store = LogStore(store_path) runinfos = [ x for x in store.get_runs(args.experiment, args.worker) if x.status == Status.FAILED or x.status == Status.INTERRUPTED ] if args.force: choise = "y" else: print("Following runs will be removed:") for runinfo in runinfos: print(f" {runinfo.uuid}") choise = input("Are you sure you want to continue? [y/N] ") if choise.strip().lower() == "y": for runinfo in runinfos: store.delete_run(runinfo.uuid)
def test_delete_run(self): with tempfile.TemporaryDirectory() as tempdir: rootdir = Path(tempdir) store = LogStore(rootdir) experiment_id = store.create_experiment(self.experiment) run_id = store.create_run(experiment_id, self.worker_name) run_info = RunInfo( version=VERSION, uuid=run_id, name="test run", module="test_module", execution_path=Path("test/path"), experiment_id=experiment_id, experiment_name=self.experiment_name, worker_name=self.worker_name, status=Status.FINISHED, params=Params({"test": "params"}), report=Report({"test": "report"}), storage=store.get_storage(experiment_id, run_id), platform=get_platform_info(), git=get_git_info(), note="test note", stdout="test stdout", stderr="test stderr", start_time=datetime.datetime.now(), end_time=datetime.datetime.now(), ) store.save_run(run_info) assert (rootdir / str(experiment_id) / self.worker_name / run_id).exists() runinfos = store.delete_run(run_id) assert not (rootdir / str(experiment_id) / self.worker_name / run_id).exists()