def test_experiment_tracker(test_engine, project_path): with mock.patch("triage.util.conf.open", side_effect=open_side_effect) as mock_file: experiment = MultiCoreExperiment( config=sample_config(), db_engine=test_engine, project_path=project_path, n_processes=4, ) experiment_run = Session(bind=test_engine).query(TriageRun).get( experiment.run_id) assert experiment_run.current_status == TriageRunStatus.started assert experiment_run.run_hash == experiment.experiment_hash assert experiment_run.run_type == "experiment" assert (experiment_run.experiment_class_path == "triage.experiments.multicore.MultiCoreExperiment") assert experiment_run.platform assert experiment_run.os_user assert experiment_run.installed_libraries assert experiment_run.matrices_skipped == 0 assert experiment_run.matrices_errored == 0 assert experiment_run.matrices_made == 0 assert experiment_run.models_skipped == 0 assert experiment_run.models_errored == 0 assert experiment_run.models_made == 0 experiment.run() experiment_run = Session(bind=test_engine).query(TriageRun).get( experiment.run_id) assert experiment_run.start_method == "run" assert experiment_run.matrices_made == len(experiment.matrix_build_tasks) assert experiment_run.matrices_skipped == 0 assert experiment_run.matrices_errored == 0 assert experiment_run.models_skipped == 0 assert experiment_run.models_errored == 0 assert experiment_run.models_made == len( list(task["train_kwargs"]["model_hash"] for batch in experiment._all_train_test_batches() for task in batch.tasks)) assert isinstance(experiment_run.matrix_building_started, datetime.datetime) assert isinstance(experiment_run.model_building_started, datetime.datetime) assert isinstance(experiment_run.last_updated_time, datetime.datetime) assert not experiment_run.stacktrace assert experiment_run.current_status == TriageRunStatus.completed
def test_experiment_tracker(test_engine, project_path): experiment = MultiCoreExperiment( config=sample_config(), db_engine=test_engine, project_path=project_path, n_processes=4, ) experiment_run = Session(bind=test_engine).query(ExperimentRun).get( experiment.run_id) assert experiment_run.current_status == ExperimentRunStatus.started assert experiment_run.experiment_hash == experiment.experiment_hash assert experiment_run.experiment_class_path == 'triage.experiments.multicore.MultiCoreExperiment' assert experiment_run.platform assert experiment_run.os_user assert experiment_run.installed_libraries assert experiment_run.matrices_skipped == 0 assert experiment_run.matrices_errored == 0 assert experiment_run.matrices_made == 0 assert experiment_run.models_skipped == 0 assert experiment_run.models_errored == 0 assert experiment_run.models_made == 0 experiment.run() experiment_run = Session(bind=test_engine).query(ExperimentRun).get( experiment.run_id) assert experiment_run.start_method == "run" assert experiment_run.matrices_made == len(experiment.matrix_build_tasks) assert experiment_run.matrices_skipped == 0 assert experiment_run.matrices_errored == 0 assert experiment_run.models_skipped == 0 assert experiment_run.models_errored == 0 assert experiment_run.models_made == len( list(task['train_kwargs']['model_hash'] for batch in experiment._all_train_test_batches() for task in batch.tasks)) assert isinstance(experiment_run.matrix_building_started, datetime.datetime) assert isinstance(experiment_run.model_building_started, datetime.datetime) assert isinstance(experiment_run.last_updated_time, datetime.datetime) assert not experiment_run.stacktrace assert experiment_run.current_status == ExperimentRunStatus.completed