コード例 #1
0
 def from_proto(cls, proto):
     tags = [RunTag.from_proto(proto_tag) for proto_tag in proto.tags]
     return cls(proto.run_uuid, proto.experiment_id, proto.name,
                proto.source_type, proto.source_name,
                proto.entry_point_name, proto.user_id, proto.status,
                proto.start_time, proto.end_time, proto.source_version,
                tags, proto.artifact_uri)
コード例 #2
0
 def from_proto(cls, proto):
     run_data = cls()
     # iterate proto and add metrics, params, and tags
     for proto_metric in proto.metrics:
         run_data._add_metric(Metric.from_proto(proto_metric))
     for proto_param in proto.params:
         run_data._add_param(Param.from_proto(proto_param))
     for proto_tag in proto.tags:
         run_data._add_tag(RunTag.from_proto(proto_tag))
     return run_data
コード例 #3
0
def _create_run():
    request_message = _get_request_message(CreateRun())

    tags = [RunTag(tag.key, tag.value) for tag in request_message.tags]
    run = _get_store().create_run(
        experiment_id=request_message.experiment_id,
        user_id=request_message.user_id,
        run_name=request_message.run_name,
        source_type=request_message.source_type,
        source_name=request_message.source_name,
        entry_point_name=request_message.entry_point_name,
        start_time=request_message.start_time,
        source_version=request_message.source_version,
        tags=tags)

    response_message = CreateRun.Response()
    response_message.run.MergeFrom(run.to_proto())
    response = Response(mimetype='application/json')
    response.set_data(_message_to_json(response_message))
    return response
コード例 #4
0
    def create_and_save_comet_project(self, exp, tag_name):
        # Create a Comet project with the name and description
        project_name = get_comet_project_name(self.store, exp.name)

        # Check if the project exists already
        project = self.api_client.get_project(self.workspace, project_name)
        if not project:
            project = self.api_client.create_project(self.workspace,
                                                     project_name,
                                                     public=False)

            project_id = project["projectId"]
        else:
            project_id = project["projectId"]

        # Save the project id to the experiment tags
        self.store.set_experiment_tag(exp.experiment_id,
                                      RunTag(tag_name, project_id))

        return project_name
コード例 #5
0
ファイル: test_run_info.py プロジェクト: 15021687693/lbg
 def _create():
     run_uuid = str(uuid.uuid4())
     experiment_id = random_int(10, 2000)
     name = random_str(random_int(10, 40))
     source_type = random_int(1, 4)
     source_name = random_str(random_int(100, 300))
     entry_point_name = random_str(random_int(100, 300))
     user_id = random_str(random_int(10, 25))
     status = random_int(1, 5)
     start_time = random_int(1, 10)
     end_time = start_time + random_int(1, 10)
     source_version = random_str(random_int(10, 40))
     tags = [RunTag(key=random_str(random_int(1, 5)), value=random_str(random_int(1, 5)))
             for _ in range(2)]
     artifact_uri = random_str(random_int(10, 40))
     ri = RunInfo(run_uuid=run_uuid, experiment_id=experiment_id, name=name,
                  source_type=source_type, source_name=source_name,
                  entry_point_name=entry_point_name, user_id=user_id,
                  status=status, start_time=start_time, end_time=end_time,
                  source_version=source_version, tags=tags, artifact_uri=artifact_uri)
     return (ri, run_uuid, experiment_id, name, source_type, source_name, entry_point_name,
             user_id, status, start_time, end_time, source_version, tags, artifact_uri)
コード例 #6
0
 def _add_tag(self, tag):
     if isinstance(tag, dict):
         tag = RunTag(tag['key'], tag['value'])
     self._tags.append(tag)