def init(self, desc_name, expr_name, run_name, args=None, highlight_args=None, configs=None): init_project() desc, _ = Desc.get_or_create(desc_name=desc_name) expr, _ = Experiment.get_or_create(desc=desc, expr_name=expr_name) run = Run(expr=expr, run_name=run_name, command=' '.join(sys.argv)) run.args = '' run.highlight_args = '' if args is not None: run.args = io.dumps_json(args.__dict__) if highlight_args is not None and hasattr(highlight_args, 'highlight_args'): run.highlight_args = io.dumps_json(get_highlight_args(args, highlight_args)) run.configs = '' run.highlight_configs = '' if configs is not None: run.configs = io.dumps_json(configs) if getattr(args, 'configs', None) is not None: run.highlight_configs = io.dumps_json(args.configs.kvs) run.save() self.desc = desc self.expr = expr self.run = run
def main(): init_database('.') ProjectMetainfo.set_all({ 'title': 'Test', 'create_time': '2019-09-05 15:44:27', 'update_time': '2019-09-05 15:44:27' }) print(ProjectMetainfo.get_all()) print('Create the desc') desc, _ = Desc.get_or_create(desc_name='desc_xxx') print('Create the expr') expr, _ = Experiment.get_or_create(expr_name='expr1', desc=desc) print('Create the runs') train_run = Run(expr=expr, run_name='train1' + str(time.time()), command='jac-run xxx', args='{xxx}', configs='{xxx}', highlight_args='{yyy}', highlight_configs='{yyy}') test_run = Run(expr=expr, run_name='test1' + str(time.time()), command='jac-run xxx', args='{xxx}', configs='{xxx}', highlight_args='{yyy}', highlight_configs='{yyy}', refer=train_run) from IPython import embed embed() train_run.save() test_run.save()