def test_mark_run_complete(dataset): assert dataset.run_timestamp_raw is None assert dataset.completed_timestamp_raw is None time_now = time.time() mut_queries.set_run_timestamp(dataset.conn, dataset.run_id) time.sleep(1) # for slower test platforms mut_queries.mark_run_complete(dataset.conn, dataset.run_id) assert dataset.completed_timestamp_raw > time_now
def _perform_start_actions(self) -> None: """ Perform the actions that must take place once the run has been started """ paramspecs = new_to_old(self._interdeps).paramspecs for spec in paramspecs: add_parameter(self.conn, self.table_name, spec) update_run_description(self.conn, self.run_id, self.description.to_json()) set_run_timestamp(self.conn, self.run_id)
def _perform_start_actions(self) -> None: """ Perform the actions that must take place once the run has been started """ paramspecs = new_to_old(self._interdeps).paramspecs for spec in paramspecs: add_parameter(self.conn, self.table_name, spec) desc_str = serial.to_json_for_storage(self.description) update_run_description(self.conn, self.run_id, desc_str) set_run_timestamp(self.conn, self.run_id) pdl_str = links_to_str(self._parent_dataset_links) update_parent_datasets(self.conn, self.run_id, pdl_str)
def test_set_run_timestamp(dataset): assert dataset.run_timestamp_raw is None assert dataset.completed_timestamp_raw is None time_now = time.time() time.sleep(1) # for slower test platforms mut_queries.set_run_timestamp(dataset.conn, dataset.run_id) assert dataset.run_timestamp_raw > time_now assert dataset.completed_timestamp_raw is None with pytest.raises(RuntimeError, match="Rolling back due to unhandled " "exception") as ei: mut_queries.set_run_timestamp(dataset.conn, dataset.run_id) assert error_caused_by(ei, ("Can not set run_timestamp; it has already " "been set"))
def test_set_run_timestamp(experiment): ds = DataSet() assert ds.run_timestamp_raw is None time_now = time.time() time.sleep(1) # for slower test platforms mut_queries.set_run_timestamp(ds.conn, ds.run_id) assert ds.run_timestamp_raw > time_now with pytest.raises(RuntimeError, match="Rolling back due to unhandled " "exception") as ei: mut_queries.set_run_timestamp(ds.conn, ds.run_id) assert error_caused_by(ei, ("Can not set run_timestamp; it has already " "been set")) ds.conn.close()
def _perform_start_actions(self) -> None: """ Perform the actions that must take place once the run has been started """ with contextlib.closing( conn_from_dbpath_or_conn(conn=None, path_to_db=self._path_to_db)) as conn: paramspecs = new_to_old(self.description.interdeps).paramspecs for spec in paramspecs: add_parameter(spec, conn=conn, run_id=self.run_id, insert_into_results_table=False) desc_str = serial.to_json_for_storage(self.description) update_run_description(conn, self.run_id, desc_str) self._run_timestamp_raw = time.time() set_run_timestamp(conn, self.run_id, self._run_timestamp_raw) pdl_str = links_to_str(self._parent_dataset_links) update_parent_datasets(conn, self.run_id, pdl_str)