braket.jobs.metrics_data.cwl_metrics_fetcher module
- class braket.jobs.metrics_data.cwl_metrics_fetcher.CwlMetricsFetcher(aws_session: ~braket.aws.aws_session.AwsSession, poll_timeout_seconds: float = 10, logger: ~logging.Logger = <Logger braket.jobs.metrics_data.cwl_metrics_fetcher (WARNING)>)[source]
Bases:
object
Initializes a
CwlMetricsFetcher
.- Parameters:
aws_session (AwsSession) – AwsSession to connect to AWS with.
poll_timeout_seconds (float) – The polling timeout for retrieving the metrics, in seconds. Default: 10 seconds.
logger (Logger) – Logger object with which to write logs, such as quantum task statuses while waiting for quantum task to be in a terminal state. Default is
getLogger(__name__)
- LOG_GROUP_NAME = '/aws/braket/jobs'
- get_metrics_for_job(job_name: str, metric_type: MetricType = MetricType.TIMESTAMP, statistic: MetricStatistic = MetricStatistic.MAX) dict[str, list[str | float | int]] [source]
Synchronously retrieves all the algorithm metrics logged by a given Hybrid Job.
- Parameters:
job_name (str) – The name of the Hybrid Job. The name must be exact to ensure only the relevant metrics are retrieved.
metric_type (MetricType) – The type of metrics to get. Default is MetricType.TIMESTAMP.
statistic (MetricStatistic) – The statistic to determine which metric value to use when there is a conflict. Default is MetricStatistic.MAX.
- Returns:
dict[str, list[Union[str, float, int]]] – The metrics data, where the keys are the column names and the values are a list containing the values in each row.
Example
timestamp energy 0 0.1 1 0.2 would be represented as: { “timestamp” : [0, 1], “energy” : [0.1, 0.2] } values may be integers, floats, strings or None.