示例#1
0
文件: show.py 项目: altescy/logexp
    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)
        print(json.dumps(runinfo.to_json(), indent=2))
示例#2
0
文件: rename.py 项目: altescy/logexp
    def run(self, args: argparse.Namespace) -> None:
        settings = Settings()
        if args.config_file is not None:
            settings.load(args.config_file)

        if args.store is None:
            store_path = settings.logstore_storepath
        else:
            store_path = Path(args.store)

        store = LogStore(store_path)
        runinfo = store.load_run(args.run)

        runinfo.name = args.name

        store.save_run(runinfo)
示例#3
0
文件: delete.py 项目: altescy/logexp
    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)
示例#4
0
    def run(self, args: argparse.Namespace) -> None:
        settings = Settings()
        if args.config_file is not None:
            settings.load(args.config_file)

        if args.store is None:
            store_path = settings.logstore_storepath
        else:
            store_path = Path(args.store)

        store = LogStore(store_path)
        runinfo = store.load_run(args.run)

        note = edit(
            editor=settings.logexp_editor,
            filename="note.txt",
            text=runinfo.note,
        )

        runinfo.note = note

        store.save_run(runinfo)
示例#5
0
    def test_save_and_load_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)

            run_info_ = store.load_run(run_id)

            assert run_info_.uuid == run_id
            assert run_info_.stdout == "test stdout"