Skip to content

Commit

Permalink
Add support for API v2.23 and attaching plots and scalars to models
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-burlacu-clear-ml committed Mar 24, 2023
1 parent b34063d commit 309b09f
Show file tree
Hide file tree
Showing 16 changed files with 36,749 additions and 12 deletions.
Empty file.
764 changes: 764 additions & 0 deletions clearml/backend_api/services/v2_23/auth.py

Large diffs are not rendered by default.

5,969 changes: 5,969 additions & 0 deletions clearml/backend_api/services/v2_23/events.py

Large diffs are not rendered by default.

4,840 changes: 4,840 additions & 0 deletions clearml/backend_api/services/v2_23/models.py

Large diffs are not rendered by default.

166 changes: 166 additions & 0 deletions clearml/backend_api/services/v2_23/organization.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
"""
organization service
This service provides organization level operations
"""
import six

from clearml.backend_api.session import Request, Response, schema_property


class GetTagsRequest(Request):
"""
Get all the user and system tags used for the company tasks and models
:param include_system: If set to 'true' then the list of the system tags is
also returned. The default value is 'false'
:type include_system: bool
:param filter: Filter on entities to collect tags from
:type filter: dict
"""

_service = "organization"
_action = "get_tags"
_version = "2.23"
_schema = {
"definitions": {},
"properties": {
"filter": {
"description": "Filter on entities to collect tags from",
"properties": {
"system_tags": {
"description": (
"The list of system tag values to filter by. Use 'null' value to specify empty system tags."
" Use '__Snot' value to specify that the following value should be excluded"
),
"items": {"type": "string"},
"type": "array",
},
"tags": {
"description": (
"The list of tag values to filter by. Use 'null' value to specify empty tags. Use '__Snot'"
" value to specify that the following value should be excluded"
),
"items": {"type": "string"},
"type": "array",
},
},
"type": ["object", "null"],
},
"include_system": {
"default": False,
"description": (
"If set to 'true' then the list of the system tags is also returned. The default value is 'false'"
),
"type": ["boolean", "null"],
},
},
"type": "object",
}

def __init__(self, include_system=False, filter=None, **kwargs):
super(GetTagsRequest, self).__init__(**kwargs)
self.include_system = include_system
self.filter = filter

@schema_property("include_system")
def include_system(self):
return self._property_include_system

@include_system.setter
def include_system(self, value):
if value is None:
self._property_include_system = None
return

self.assert_isinstance(value, "include_system", (bool,))
self._property_include_system = value

@schema_property("filter")
def filter(self):
return self._property_filter

@filter.setter
def filter(self, value):
if value is None:
self._property_filter = None
return

self.assert_isinstance(value, "filter", (dict,))
self._property_filter = value


class GetTagsResponse(Response):
"""
Response of organization.get_tags endpoint.
:param tags: The list of unique tag values
:type tags: Sequence[str]
:param system_tags: The list of unique system tag values. Returned only if
'include_system' is set to 'true' in the request
:type system_tags: Sequence[str]
"""

_service = "organization"
_action = "get_tags"
_version = "2.23"

_schema = {
"definitions": {},
"properties": {
"system_tags": {
"description": (
"The list of unique system tag values. Returned only if 'include_system' is set to 'true' in the"
" request"
),
"items": {"type": "string"},
"type": ["array", "null"],
},
"tags": {
"description": "The list of unique tag values",
"items": {"type": "string"},
"type": ["array", "null"],
},
},
"type": "object",
}

def __init__(self, tags=None, system_tags=None, **kwargs):
super(GetTagsResponse, self).__init__(**kwargs)
self.tags = tags
self.system_tags = system_tags

@schema_property("tags")
def tags(self):
return self._property_tags

@tags.setter
def tags(self, value):
if value is None:
self._property_tags = None
return

self.assert_isinstance(value, "tags", (list, tuple))

self.assert_isinstance(value, "tags", six.string_types, is_array=True)
self._property_tags = value

@schema_property("system_tags")
def system_tags(self):
return self._property_system_tags

@system_tags.setter
def system_tags(self, value):
if value is None:
self._property_system_tags = None
return

self.assert_isinstance(value, "system_tags", (list, tuple))

self.assert_isinstance(value, "system_tags", six.string_types, is_array=True)
self._property_system_tags = value


response_mapping = {
GetTagsRequest: GetTagsResponse,
}
169 changes: 169 additions & 0 deletions clearml/backend_api/services/v2_23/pipelines.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
"""
pipelines service
Provides a management API for pipelines in the system.
"""
import six

from clearml.backend_api.session import (
Request,
Response,
schema_property,
)


class StartPipelineRequest(Request):
"""
Start a pipeline
:param task: ID of the task on which the pipeline will be based
:type task: str
:param queue: Queue ID in which the created pipeline task will be enqueued
:type queue: str
:param args: Task arguments, name/value to be placed in the hyperparameters
Args section
:type args: Sequence[dict]
"""

_service = "pipelines"
_action = "start_pipeline"
_version = "2.23"
_schema = {
"definitions": {},
"properties": {
"args": {
"description": "Task arguments, name/value to be placed in the hyperparameters Args section",
"items": {
"properties": {
"name": {"type": "string"},
"value": {"type": ["string", "null"]},
},
"type": "object",
},
"type": "array",
},
"queue": {
"description": "Queue ID in which the created pipeline task will be enqueued",
"type": "string",
},
"task": {
"description": "ID of the task on which the pipeline will be based",
"type": "string",
},
},
"required": ["task"],
"type": "object",
}

def __init__(self, task, queue=None, args=None, **kwargs):
super(StartPipelineRequest, self).__init__(**kwargs)
self.task = task
self.queue = queue
self.args = args

@schema_property("task")
def task(self):
return self._property_task

@task.setter
def task(self, value):
if value is None:
self._property_task = None
return

self.assert_isinstance(value, "task", six.string_types)
self._property_task = value

@schema_property("queue")
def queue(self):
return self._property_queue

@queue.setter
def queue(self, value):
if value is None:
self._property_queue = None
return

self.assert_isinstance(value, "queue", six.string_types)
self._property_queue = value

@schema_property("args")
def args(self):
return self._property_args

@args.setter
def args(self, value):
if value is None:
self._property_args = None
return

self.assert_isinstance(value, "args", (list, tuple))

self.assert_isinstance(value, "args", (dict,), is_array=True)
self._property_args = value


class StartPipelineResponse(Response):
"""
Response of pipelines.start_pipeline endpoint.
:param pipeline: ID of the new pipeline task
:type pipeline: str
:param enqueued: True if the task was successfully enqueued
:type enqueued: bool
"""

_service = "pipelines"
_action = "start_pipeline"
_version = "2.23"

_schema = {
"definitions": {},
"properties": {
"enqueued": {
"description": "True if the task was successfully enqueued",
"type": ["boolean", "null"],
},
"pipeline": {
"description": "ID of the new pipeline task",
"type": ["string", "null"],
},
},
"type": "object",
}

def __init__(self, pipeline=None, enqueued=None, **kwargs):
super(StartPipelineResponse, self).__init__(**kwargs)
self.pipeline = pipeline
self.enqueued = enqueued

@schema_property("pipeline")
def pipeline(self):
return self._property_pipeline

@pipeline.setter
def pipeline(self, value):
if value is None:
self._property_pipeline = None
return

self.assert_isinstance(value, "pipeline", six.string_types)
self._property_pipeline = value

@schema_property("enqueued")
def enqueued(self):
return self._property_enqueued

@enqueued.setter
def enqueued(self, value):
if value is None:
self._property_enqueued = None
return

self.assert_isinstance(value, "enqueued", (bool,))
self._property_enqueued = value


response_mapping = {
StartPipelineRequest: StartPipelineResponse,
}
Loading

0 comments on commit 309b09f

Please sign in to comment.