mirror of
https://github.com/clearml/clearml
synced 2025-04-23 15:55:45 +00:00
Sphinx compatibility
This commit is contained in:
parent
2fb69ae951
commit
d0b1c6acb5
@ -493,6 +493,7 @@ class Task(IdObjectBase, AccessMixin, SetupUploadMixin):
|
|||||||
def set_input_model(self, model_id=None, model_name=None, update_task_design=True, update_task_labels=True):
|
def set_input_model(self, model_id=None, model_name=None, update_task_design=True, update_task_labels=True):
|
||||||
"""
|
"""
|
||||||
Set a new input model for this task. Model must be 'ready' in order to be used as the Task's input model.
|
Set a new input model for this task. Model must be 'ready' in order to be used as the Task's input model.
|
||||||
|
|
||||||
:param model_id: ID for a model that exists in the backend. Required if model_name is not provided.
|
:param model_id: ID for a model that exists in the backend. Required if model_name is not provided.
|
||||||
:param model_name: Model name. Required if model_id is not provided. If provided, this name will be used to
|
:param model_name: Model name. Required if model_id is not provided. If provided, this name will be used to
|
||||||
locate an existing model in the backend.
|
locate an existing model in the backend.
|
||||||
@ -543,8 +544,9 @@ class Task(IdObjectBase, AccessMixin, SetupUploadMixin):
|
|||||||
"""
|
"""
|
||||||
Set parameters for this task. This allows setting a complete set of key/value parameters, but does not support
|
Set parameters for this task. This allows setting a complete set of key/value parameters, but does not support
|
||||||
parameter descriptions (as the input is a dictionary or key/value pairs.
|
parameter descriptions (as the input is a dictionary or key/value pairs.
|
||||||
|
|
||||||
:param args: Positional arguments (one or more dictionary or (key, value) iterable). These will be merged into
|
:param args: Positional arguments (one or more dictionary or (key, value) iterable). These will be merged into
|
||||||
a single key/value dictionary.
|
a single key/value dictionary.
|
||||||
:param kwargs: Key/value pairs, merged into the parameters dictionary created from `args`.
|
:param kwargs: Key/value pairs, merged into the parameters dictionary created from `args`.
|
||||||
"""
|
"""
|
||||||
if not all(isinstance(x, (dict, collections.Iterable)) for x in args):
|
if not all(isinstance(x, (dict, collections.Iterable)) for x in args):
|
||||||
@ -581,6 +583,7 @@ class Task(IdObjectBase, AccessMixin, SetupUploadMixin):
|
|||||||
def set_parameter(self, name, value, description=None):
|
def set_parameter(self, name, value, description=None):
|
||||||
"""
|
"""
|
||||||
Set a single task parameter. This overrides any previous value for this parameter.
|
Set a single task parameter. This overrides any previous value for this parameter.
|
||||||
|
|
||||||
:param name: Parameter name
|
:param name: Parameter name
|
||||||
:param value: Parameter value
|
:param value: Parameter value
|
||||||
:param description: Parameter description (unused for now)
|
:param description: Parameter description (unused for now)
|
||||||
@ -592,6 +595,7 @@ class Task(IdObjectBase, AccessMixin, SetupUploadMixin):
|
|||||||
def get_parameter(self, name, default=None):
|
def get_parameter(self, name, default=None):
|
||||||
"""
|
"""
|
||||||
Get a value for a parameter.
|
Get a value for a parameter.
|
||||||
|
|
||||||
:param name: Parameter name
|
:param name: Parameter name
|
||||||
:param default: Default value
|
:param default: Default value
|
||||||
:return: Parameter value (or default value if parameter is not defined)
|
:return: Parameter value (or default value if parameter is not defined)
|
||||||
@ -607,12 +611,17 @@ class Task(IdObjectBase, AccessMixin, SetupUploadMixin):
|
|||||||
parameter descriptions (as the input is a dictionary or key/value pairs.
|
parameter descriptions (as the input is a dictionary or key/value pairs.
|
||||||
|
|
||||||
:param args: Positional arguments (one or more dictionary or (key, value) iterable). These will be merged into
|
:param args: Positional arguments (one or more dictionary or (key, value) iterable). These will be merged into
|
||||||
a single key/value dictionary.
|
a single key/value dictionary.
|
||||||
:param kwargs: Key/value pairs, merged into the parameters dictionary created from `args`.
|
:param kwargs: Key/value pairs, merged into the parameters dictionary created from `args`.
|
||||||
"""
|
"""
|
||||||
self.set_parameters(__update=True, *args, **kwargs)
|
self.set_parameters(__update=True, *args, **kwargs)
|
||||||
|
|
||||||
def set_model_label_enumeration(self, enumeration=None):
|
def set_model_label_enumeration(self, enumeration=None):
|
||||||
|
"""
|
||||||
|
Set a dictionary of labels (text) to ids (integers) {str(label): integer(id)}
|
||||||
|
|
||||||
|
:param dict enumeration: For example: {str(label): integer(id)}
|
||||||
|
"""
|
||||||
enumeration = enumeration or {}
|
enumeration = enumeration or {}
|
||||||
execution = self.data.execution
|
execution = self.data.execution
|
||||||
if enumeration is None:
|
if enumeration is None:
|
||||||
@ -633,7 +642,7 @@ class Task(IdObjectBase, AccessMixin, SetupUploadMixin):
|
|||||||
def get_labels_enumeration(self):
|
def get_labels_enumeration(self):
|
||||||
"""
|
"""
|
||||||
Return a dictionary of labels (text) to ids (integers) {str(label): integer(id)}
|
Return a dictionary of labels (text) to ids (integers) {str(label): integer(id)}
|
||||||
:return:
|
:return: dict
|
||||||
"""
|
"""
|
||||||
if not self.data or not self.data.execution:
|
if not self.data or not self.data.execution:
|
||||||
return {}
|
return {}
|
||||||
@ -728,6 +737,7 @@ class Task(IdObjectBase, AccessMixin, SetupUploadMixin):
|
|||||||
tags=None, parent=None, project=None, log=None, session=None):
|
tags=None, parent=None, project=None, log=None, session=None):
|
||||||
"""
|
"""
|
||||||
Clone a task
|
Clone a task
|
||||||
|
|
||||||
:param cloned_task_id: Task ID for the task to be cloned
|
:param cloned_task_id: Task ID for the task to be cloned
|
||||||
:type cloned_task_id: str
|
:type cloned_task_id: str
|
||||||
:param name: New for the new task
|
:param name: New for the new task
|
||||||
@ -779,12 +789,14 @@ class Task(IdObjectBase, AccessMixin, SetupUploadMixin):
|
|||||||
@classmethod
|
@classmethod
|
||||||
def get_all(cls, session=None, log=None, **kwargs):
|
def get_all(cls, session=None, log=None, **kwargs):
|
||||||
"""
|
"""
|
||||||
Get all tasks
|
List all tasks based on specific projection
|
||||||
|
|
||||||
:param session: Session object used for sending requests to the API
|
:param session: Session object used for sending requests to the API
|
||||||
:type session: Session
|
:type session: Session
|
||||||
:param log: Log object
|
:param log: Log object
|
||||||
:type log: logging.Logger
|
:type log: logging.Logger
|
||||||
:param kwargs: Keyword args passed to the GetAllRequest (see .backend_api.services.tasks.GetAllRequest)
|
:param kwargs: Keyword args passed to the GetAllRequest (see .backend_api.services.tasks.GetAllRequest)
|
||||||
|
Example: status='completed', 'search_text'='specific_word', 'user'='user_id', 'project'='project_id'
|
||||||
:type kwargs: dict
|
:type kwargs: dict
|
||||||
:return: API response
|
:return: API response
|
||||||
"""
|
"""
|
||||||
|
@ -6,6 +6,13 @@
|
|||||||
# Defaults to system temp folder / cache
|
# Defaults to system temp folder / cache
|
||||||
default_base_dir: "~/.trains/cache"
|
default_base_dir: "~/.trains/cache"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
direct_access: [
|
||||||
|
# Objects matching are considered to be available for direct access, i.e. they will not eb downloaded
|
||||||
|
# or cached, and any download request will return a direct reference.
|
||||||
|
# Objects are specified in glob format, available for url and content_type.
|
||||||
|
{ url: "file://*" } # file-urls are always directly referenced
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
metrics {
|
metrics {
|
||||||
|
@ -90,9 +90,8 @@ class Task(_Task):
|
|||||||
|
|
||||||
def __init__(self, private=None, **kwargs):
|
def __init__(self, private=None, **kwargs):
|
||||||
"""
|
"""
|
||||||
**Do not construct Task manually!**
|
Do not construct Task manually!
|
||||||
|
**Please use Task.init() or Task.get_task(id=, project=, name=)**
|
||||||
please use Task.current_task() or Task.get_task(id=, project=, name=)
|
|
||||||
"""
|
"""
|
||||||
if private is not Task.__create_protection:
|
if private is not Task.__create_protection:
|
||||||
raise UsageError(
|
raise UsageError(
|
||||||
@ -461,7 +460,7 @@ class Task(_Task):
|
|||||||
:param task_id: unique task id string (if exists other parameters are ignored)
|
:param task_id: unique task id string (if exists other parameters are ignored)
|
||||||
:param project_name: project name (str) the task belongs to
|
:param project_name: project name (str) the task belongs to
|
||||||
:param task_name: task name (str) in within the selected project
|
:param task_name: task name (str) in within the selected project
|
||||||
:return: Task object
|
:return: Task() object
|
||||||
"""
|
"""
|
||||||
return Task.__get_task(task_id=task_id, project_name=project_name, task_name=task_name)
|
return Task.__get_task(task_id=task_id, project_name=project_name, task_name=task_name)
|
||||||
|
|
||||||
@ -552,7 +551,7 @@ class Task(_Task):
|
|||||||
If a logger was created before, this will be the new period and
|
If a logger was created before, this will be the new period and
|
||||||
the old one will be discarded.
|
the old one will be discarded.
|
||||||
|
|
||||||
:return: .Logger object
|
:return: Logger object
|
||||||
"""
|
"""
|
||||||
if not self._logger:
|
if not self._logger:
|
||||||
# force update of base logger to this current task (this is the main logger task)
|
# force update of base logger to this current task (this is the main logger task)
|
||||||
@ -596,7 +595,6 @@ class Task(_Task):
|
|||||||
flush any outstanding reports or console logs
|
flush any outstanding reports or console logs
|
||||||
|
|
||||||
:param wait_for_uploads: if True the flush will exit only after all outstanding uploads are completed
|
:param wait_for_uploads: if True the flush will exit only after all outstanding uploads are completed
|
||||||
:return: True
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# make sure model upload is done
|
# make sure model upload is done
|
||||||
@ -639,6 +637,7 @@ class Task(_Task):
|
|||||||
"""
|
"""
|
||||||
Add artifact for the current Task, used mostly for Data Audition.
|
Add artifact for the current Task, used mostly for Data Audition.
|
||||||
Currently supported artifacts object types: pandas.DataFrame
|
Currently supported artifacts object types: pandas.DataFrame
|
||||||
|
|
||||||
:param name: name of the artifacts. can override previous artifacts if name already exists
|
:param name: name of the artifacts. can override previous artifacts if name already exists
|
||||||
:type name: str
|
:type name: str
|
||||||
:param artifact: artifact object, supported artifacts object types: pandas.DataFrame
|
:param artifact: artifact object, supported artifacts object types: pandas.DataFrame
|
||||||
@ -688,7 +687,7 @@ class Task(_Task):
|
|||||||
Get Task model configuration text (before creating an output model)
|
Get Task model configuration text (before creating an output model)
|
||||||
When an output model is created it will inherit these properties
|
When an output model is created it will inherit these properties
|
||||||
|
|
||||||
:return model config_text (unconstrained text string). usually the content of a configuration file.
|
:return: model config_text (unconstrained text string). usually the content of a configuration file.
|
||||||
If `config_text` is not None, `config_dict` must not be provided.
|
If `config_text` is not None, `config_dict` must not be provided.
|
||||||
"""
|
"""
|
||||||
return super(Task, self).get_model_design()
|
return super(Task, self).get_model_design()
|
||||||
@ -698,7 +697,7 @@ class Task(_Task):
|
|||||||
Get Task model configuration dictionary (before creating an output model)
|
Get Task model configuration dictionary (before creating an output model)
|
||||||
When an output model is created it will inherit these properties
|
When an output model is created it will inherit these properties
|
||||||
|
|
||||||
:return model config_text (unconstrained text string). usually the content of a configuration file.
|
:return: model config_text (unconstrained text string). usually the content of a configuration file.
|
||||||
If `config_text` is not None, `config_dict` must not be provided.
|
If `config_text` is not None, `config_dict` must not be provided.
|
||||||
"""
|
"""
|
||||||
config_text = self.get_model_config_text()
|
config_text = self.get_model_config_text()
|
||||||
@ -719,7 +718,7 @@ class Task(_Task):
|
|||||||
Return the last reported iteration (i.e. the maximum iteration the task reported a metric for)
|
Return the last reported iteration (i.e. the maximum iteration the task reported a metric for)
|
||||||
Notice, this is not a cached call, it will ask the backend for the answer (no local caching)
|
Notice, this is not a cached call, it will ask the backend for the answer (no local caching)
|
||||||
|
|
||||||
:return integer, last reported iteration number
|
:return: last reported iteration number (integer)
|
||||||
"""
|
"""
|
||||||
self.reload()
|
self.reload()
|
||||||
return self.data.last_iteration
|
return self.data.last_iteration
|
||||||
@ -740,7 +739,9 @@ class Task(_Task):
|
|||||||
"""
|
"""
|
||||||
Set new default TRAINS-server host and credentials
|
Set new default TRAINS-server host and credentials
|
||||||
These configurations will be overridden by wither OS environment variables or trains.conf configuration file
|
These configurations will be overridden by wither OS environment variables or trains.conf configuration file
|
||||||
Notice: credentials needs to be set prior to Task initialization
|
|
||||||
|
Notice! credentials needs to be set *prior* to Task initialization
|
||||||
|
|
||||||
:param host: host url, example: host='http://localhost:8008'
|
:param host: host url, example: host='http://localhost:8008'
|
||||||
:type host: str
|
:type host: str
|
||||||
:param key: user key/secret pair, example: key='thisisakey123'
|
:param key: user key/secret pair, example: key='thisisakey123'
|
||||||
|
Loading…
Reference in New Issue
Block a user