Skip to content

comet_ml.end ¶

end() -> None

If there is a running experiment, finalize it and flush all pending data to the Comet server. See end for more details. If no experiment was running, this does nothing.

comet_ml.error_mode ¶

error_mode() -> None

Enables the printing of error tracebacks to the console logger for debugging purposes.

comet_ml.flush ¶

flush() -> Optional[bool]

If there is a running experiment, flush all pending data to the Comet server. See flush for more details. If no experiment was running, this does nothing.

Returns:

  • Optional[bool] –

    If there is a running experiment, returns a Boolean True or False indicating whether the flush was successful or not. If no experiment was running, returns None.

comet_ml.get_experiment_key ¶

get_experiment_key(user_input: Optional[Union[AnyStr, Dict[str, Any]]]) -> str

Generates a unique experiment key based on the provided user input. The same input consistently produces the same experiment key. If the user input is None, a unique random key is generated each time using the UUID algorithm.

Parameters:

  • user_input ((str, bytes, dict)) –

    the user input as str, bytes or dict.

comet_ml.get_running_experiment ¶

get_running_experiment() -> Optional[CometExperiment]

Returns a currently running experiment or None if there is no such.

Returns:

  • Optional[CometExperiment] –

    Returns the running experiment or None.

Example
1
2
3
import comet_ml

experiment = comet_ml.get_running_experiment()

comet_ml.get_s3_uploader ¶

get_s3_uploader(
    bucket: str, key: Optional[str] = None, **kwargs
) -> UploadCallback

Return an upload callback that can be used to upload offline archive when an online Experiment has fallback to offline.

See also: comet_ml.Experiment.set_offline_zip_uploader

The AWS credentials must be present either via environment variables or in the user home directory in format supported by boto3 client as described at: https://boto3.amazonaws.com/v1/documentation/api/latest/guide/credentials.html

Parameters:

Returns:

  • UploadCallback –

    A callback to be used to upload offline experiment data to S3.

For example:

from comet_ml import start, get_s3_uploader

upload_callback = get_s3_uploader(bucket="my_bucket")
experiment = start()
experiment.set_offline_zip_uploader(upload_callback)
Feb. 19, 2025