def create_run(self, experiment_id, user_id, run_name, source_type, source_name, entry_point_name, start_time, source_version, tags): """ Creates a run under the specified experiment ID, setting the run's status to "RUNNING" and the start time to the current time. :param experiment_id: ID of the experiment for this run :param user_id: ID of the user launching this run :param source_type: Enum (integer) describing the source of the run :return: The created Run object """ tag_protos = [tag.to_proto() for tag in tags] req_body = _message_to_json( CreateRun(experiment_id=experiment_id, user_id=user_id, run_name=run_name, source_type=source_type, source_name=source_name, entry_point_name=entry_point_name, start_time=start_time, source_version=source_version, tags=tag_protos)) response_proto = self._call_endpoint(CreateRun, req_body) return Run.from_proto(response_proto.run)
def get_run(self, run_uuid): """ Fetches the run from backend store :param run_uuid: Unique identifier for the run :return: A single Run object if it exists, otherwise raises an Exception """ req_body = _message_to_json(GetRun(run_uuid=run_uuid)) response_proto = self._call_endpoint(GetRun, req_body) return Run.from_proto(response_proto.run)
def search_runs(self, experiment_ids, search_expressions): """ Returns runs that match the given list of search expressions within the experiments. Given multiple search expressions, all these expressions are ANDed together for search. :param experiment_ids: List of experiment ids to scope the search :param search_expression: list of search expressions :return: A list of Run objects that satisfy the search expressions """ search_expressions_protos = [expr.to_proto() for expr in search_expressions] req_body = _message_to_json(SearchRuns(experiment_ids=experiment_ids, search_expressions=search_expressions_protos)) response_proto = self._call_endpoint(SearchRuns, req_body) return [Run.from_proto(proto_run) for proto_run in response_proto.runs]