tlc.client.session#

Module Contents#

Classes#

Class

Description

Session

Session singleton for interacting with 3LC objects.

Functions#

Function

Description

init

Initialize a 3LC Run.

close

Close a run session

API#

class tlc.client.session.Session#

Session singleton for interacting with 3LC objects.

The session object is used to create and manage 3LC objects, such as Runs. The session holds the current active Run object and is managed by calls to tlc.init() and tlc.close().

static initialize_run(project_name: str, run_name: str, run_url: tlc.core.url.Url | None = None, description: str | None = None, parameters: dict[str, Any] | None = None, if_exists_option: tlc.core.url_adapter.IfExistsOption = IfExistsOption.RENAME) str#

Creates a new active Run object.

Parameters:
  • project_name – Name of the project.

  • run_name – Name of the Run.

  • run_url – Url to the run. If provided, project_name and run_name are ignored and the run will be created at the provided url. If the url already exists, the if_exists argument is used to determine how to proceed.

  • description – Description of the run.

  • parameters – Parameters of the run.

  • if_exists_option – How to deal with existing runs. Options are “reuse”, “overwrite”, “rename”, “raise”.

Returns:

Absolute URL to where the created Run object can be accessed.

close() None#

Closes the current session.

This method stops all background indexers and deletes the current session instance.

property run: tlc.core.objects.Run | None#

Returns the active run object, if a run is initialized.

set_active_run(run: tlc.core.objects.Run | tlc.core.url.Url | str) None#

Set the active Run.

Parameters:

run – The Run object or URL to set as the active run.

tlc.client.session.init(project_name: str | None = None, run_name: str | None = None, description: str | None = None, parameters: dict[str, typing.Any] | None = None, if_exists: typing.Literal[reuse, overwrite, rename, raise] = 'rename', *, run_url: tlc.core.url.Url | str | None = None) tlc.core.objects.Run#

Initialize a 3LC Run.

Initializes a 3LC Run object and sets it as the active run for the current session. Starts the 3LC indexing threads.

Parameters:
  • project_name – Name of the project. If empty, the run will be stored under a default project.

  • run_name – Name of the Run. If empty, a random name will be generated.

  • description – Description of the run.

  • parameters – Parameters of the run.

  • if_exists – How to deal with existing runs. Options are “reuse”, “overwrite”, “rename”, “raise”.

  • run_url – Url to the run. If provided, project_name and run_name are ignored and the run will be created at the provided url. If the url already exists, the if_exists argument is used to determine how to proceed.

Returns:

A Run object.

tlc.client.session.close() None#

Close a run session

Recommended to call at the end of training to make sure, all training data hook is saved. It blocks the running until all data hooks are saved.