src.internal.experiment_connector.clearml_exp module#

ClearML experiment connector. A interface to interact with ClearML experiments.

class src.internal.experiment_connector.clearml_exp.ClearMLExperiment[source]#

Bases: ExperimentConnector

_abc_impl = <_abc._abc_data object>#
static _to_plotly_json(title: str, data: Dict) Dict[str, Dict][source]#

Convert ClearML metrics data to plotly json.

Parameters:
  • title (str) – Graph title

  • data (Dict) – ClearML metrics data

Returns:

Plotly compatible json

Return type:

Dict[str, Dict]

property artifacts: Dict[str, Artifact]#

Returns artifacts associated with experiment

Raises:
  • ValueError – If not currently connected to any experiments

  • NotImplementedError – If experiment connector does not implement this method.

Returns:

Mapping of artifact names to artifacts

Return type:

Dict[str, Artifact]

classmethod clone(exp_id: str, clone_name: Optional[str] = None) ClearMLExperiment[source]#

Clone an existing experiment.

Parameters:
  • exp_id (str) – Id of experiment to clone

  • clone_name (Optional[str], optional) – Name of cloned experiment. Defaults to None.

Raises:

NotImplementedError – If experiment connector does not implement this method.

Returns:

Cloned experiment connector

Return type:

ExperimentConnector

clone_self(clone_name: Optional[str] = None) ClearMLExperiment[source]#

Clone the current experiment.

Parameters:

clone_name (Optional[str], optional) – Name of cloned exp. Defaults to None.

Raises:

ValueError – If not currently connected to any experiments

Returns:

Cloned experiment

Return type:

ClearMLExperiment

close(delete_task: bool = False, delete_artifacts: bool = False) None[source]#

Close the experiment connector.

Raises:

NotImplementedError – If experiment connector does not implement this method.

property config: Dict#

Returns config associated with experiment

Raises:

NotImplementedError – If experiment connector does not implement this method.

Returns:

Configuration of experiment

Return type:

Dict

delete(delete_artifacts: bool = False) bool[source]#

Delete the current experiment.

Parameters:

delete_artifacts (bool, optional) – If artifacts associated should also be deleted. Defaults to False.

Raises:

ValueError – If not currently connected to any experiments

Returns:

If the experiment was successfully deleted

Return type:

bool

execute(queue_name: Optional[str] = 'default', queue_id: Optional[str] = None) Dict[source]#

Add current experiment to the ClearML task queue.

Parameters:
  • queue_name (Optional[str], optional) – Name of queue. Defaults to “default”.

  • queue_id (Optional[str], optional) – ID of queue (in place of name). Defaults to None.

Raises:

ValueError – If not currently connected to any experiments

Returns:

An enqueue JSON response

Return type:

Dict

classmethod get(exp_id: Optional[str] = None, project: Optional[str] = None, exp_name: Optional[str] = None) ClearMLExperiment[source]#

Get an existing experiment.

Raises:

NotImplementedError – If experiment connector does not implement this method.

Returns:

Experiment connector

Return type:

ExperimentConnector

get_metadata() Dict[source]#

Get metadata for the current experiment.

Raises:
  • ValueError – If not currently connected to any experiments

  • ValueError – If unable to find task

Returns:

Metadata for the current experiment

Return type:

Dict

static list_tasks(ids: Optional[List[str]] = None, project: Optional[str] = None, exp_name: Optional[str] = None, tags: Optional[List[str]] = None, task_filter: Optional[Dict] = None) List[Task][source]#

List all experiments.

Parameters:
  • ids (Optional[List[str]], optional) – Filter by list of exp ids. Defaults to None.

  • project (Optional[str], optional) – Filter by list of exp projects. Defaults to None.

  • exp_name (Optional[str], optional) – Filter by list of exp names. Defaults to None.

  • tags (Optional[List[str]], optional) – Filter by list of tags. Defaults to None.

  • task_filter (Optional[Dict], optional) – More filter and sort options. Defaults to None.

Returns:

List of experiments matching the filter

Return type:

List[Task]

property metrics: List[Dict]#
property models: Dict[str, Artifact]#

Returns models associated with experiment

Raises:
  • ValueError – If not currently connected to any experiments

  • NotImplementedError – If experiment connector does not implement this method.

Returns:

Mapping of model names to artifacts

Return type:

Dict[str, Artifact]

property plots: List[Dict]#

Get all plots from the current experiment.

Raises:

ValueError – If not currently connected to any experiments

Returns:

List of plotly json objects

Return type:

List[Dict]

property tags: List[str]#

Returns tags associated with experiment

Raises:

NotImplementedError – If experiment connector does not implement this method.

Returns:

List of tags associated with experiment

Return type:

List