core.contexts.common.picsellia_context¶
picsellia_context
¶
Classes:
Name | Description |
---|---|
PicselliaContext |
|
PicselliaContext(api_token=None, host=None, organization_id=None, organization_name=None, working_dir=None)
¶
Bases: ABC
This context manages authentication and client setup for interacting with Picsellia. It must be subclassed to define a specific working directory once an identifier (e.g., experiment ID or job ID) becomes available.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
Optional[str]
|
API token used to authenticate with the Picsellia API. If not provided, the value is read from the 'api_token' environment variable. |
None
|
|
Optional[str]
|
Host URL of the Picsellia server. Defaults to 'https://app.picsellia.com'. |
None
|
|
Optional[str]
|
ID of the Picsellia organization. Can also be set via the 'organization_id' env variable. |
None
|
|
Optional[str]
|
Name of the Picsellia organization. Can also be set via the 'organization_name' env variable. |
None
|
|
Optional[str]
|
Optional override for the working directory. |
None
|
Methods:
Name | Description |
---|---|
to_dict |
Converts the context to a dictionary representation. |
Attributes:
Name | Type | Description |
---|---|---|
api_token |
|
|
host |
|
|
organization_id |
|
|
organization_name |
|
|
client |
|
|
working_dir |
str
|
Abstract property to define the working directory path. |
api_token = api_token or os.getenv('api_token')
instance-attribute
¶
host = host or os.getenv('host', 'https://app.picsellia.com')
instance-attribute
¶
organization_id = organization_id or os.getenv('organization_id')
instance-attribute
¶
organization_name = organization_name or os.getenv('organization_name')
instance-attribute
¶
client = self._initialize_client()
instance-attribute
¶
working_dir
abstractmethod
property
¶
Abstract property to define the working directory path.
This should be implemented by subclasses to specify where files such as datasets, weights, and logs are stored locally.
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
Path to the working directory. |
to_dict()
abstractmethod
¶
Converts the context to a dictionary representation.
This method should be implemented by subclasses to expose their internal parameters and configuration for logging or serialization purposes.