Exemplo n.º 1
0
    def __init__(self, run):
        """Summary.

        Args:
            run (TYPE): Description
        """
        Run.__init__(self, run.info, run.data)
Exemplo n.º 2
0
    def get_run(self, run_id):
        """Fetch the run from backend store.

        :param run_id: 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_id, run_id=run_id))
        response_proto = self._call_endpoint(GetRun, req_body)
        return Run.from_proto(response_proto.run)
Exemplo n.º 3
0
    def _search_runs(self, experiment_ids, filter_string, run_view_type,
                     max_results, order_by, page_token):
        experiment_ids = [
            str(experiment_id) for experiment_id in experiment_ids
        ]
        sr = SearchRuns(experiment_ids=experiment_ids,
                        filter=filter_string,
                        run_view_type=ViewType.to_proto(run_view_type),
                        max_results=max_results,
                        order_by=order_by,
                        page_token=page_token)
        req_body = message_to_json(sr)
        response_proto = self._call_endpoint(SearchRuns, req_body)
        runs = [Run.from_proto(proto_run) for proto_run in response_proto.runs]

        next_page_token = None
        if response_proto.next_page_token:
            next_page_token = response_proto.next_page_token
        return runs, next_page_token
Exemplo n.º 4
0
    def create_run(self, experiment_id, start_time, tags):
        """Create 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 = [
            RunTag(key=tagkey, value=tagvalue)
            for tagkey, tagvalue in tags.items()
        ]
        req_body = message_to_json(
            CreateRun(experiment_id=str(experiment_id),
                      start_time=start_time,
                      tags=tag_protos))
        response_proto = self._call_endpoint(CreateRun, req_body)
        run = Run.from_proto(response_proto.run)
        return run