From a993330253263f44a06be49cd633f4e96ce4eb91 Mon Sep 17 00:00:00 2001 From: Colin Slater Date: Thu, 17 Oct 2024 14:16:54 -0700 Subject: [PATCH] Load metric thresholds from S3. --- python/lsst/production/tools/tractTable.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/python/lsst/production/tools/tractTable.py b/python/lsst/production/tools/tractTable.py index 19c760c..a3c6e73 100644 --- a/python/lsst/production/tools/tractTable.py +++ b/python/lsst/production/tools/tractTable.py @@ -189,8 +189,19 @@ def collection(collection_urlencoded): butler = Butler("/repo/main") dataId = {"skymap": "hsc_rings_v1", "instrument": "HSC"} t = butler.get("objectTableCore_metricsTable", collections=collection, dataId=dataId) - with open("../../metricThresholds/metricInformation.yaml", "r") as filename: - metricDefs = yaml.safe_load(filename) + + # with open("../../metricThresholds/metricInformation.yaml", "r") as filename: + # metricDefs = yaml.safe_load(filename) + + session = boto3.Session(profile_name='rubin-plot-navigator') + s3_client = session.client('s3', endpoint_url=os.getenv("S3_ENDPOINT_URL")) + + metric_threshold_filename = "metricInformation.yaml" + try: + response = s3_client.get_object('rubin-plot-navigator', metric_threshold_filename) + metricDefs = yaml.safe_load(response["Body"]) + except boto3.exceptions.ClientError as e: + print(e) headerDict, bands = mkTableHeaders(t)