CwlInsightsMetricsFetcher
- class braket.jobs.metrics_data.cwl_insights_metrics_fetcher.CwlInsightsMetricsFetcher(aws_session, poll_timeout_seconds=10, poll_interval_seconds=1, logger=<Logger braket.jobs.metrics_data.cwl_insights_metrics_fetcher (WARNING)>)[source]
Bases:
objectInitializes a
CwlInsightsMetricsFetcher.- 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.poll_interval_seconds (
float) – The interval of time, in seconds, between polling for results. Default: 1 second.logger (
Logger) – Logger object with which to write logs, such as quantum task statuses while waiting for a quantum task to be in a terminal state. Default isgetLogger(__name__)
- LOG_GROUP_NAME = '/aws/braket/jobs'
- QUERY_DEFAULT_JOB_DURATION = 10800
- get_metrics_for_job(job_name, metric_type=MetricType.TIMESTAMP, statistic=MetricStatistic.MAX, job_start_time=None, job_end_time=None, stream_prefix=None)[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.job_start_time (
int|None) – The time when the hybrid job started. Default: 3 hours before job_end_time.job_end_time (
int|None) – If the hybrid job is complete, this should be the time at which the hybrid job finished. Default: current time.stream_prefix (
str|None) – If a logs prefix is provided, it will be used instead of the job name.
- Return type:
dict[str,list[str|float|int]]- Returns:
dict[str, list[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] } The values may be integers, floats, strings or None.