From ae422c8613dfc6ceacaac32ed7c05c21dd0c2ed8 Mon Sep 17 00:00:00 2001 From: Colin Slater Date: Thu, 21 Nov 2024 08:00:33 -0800 Subject: [PATCH] Add error reporting to tractTable. --- python/lsst/production/tools/tractTable.py | 18 ++++++++++++++---- static/custom.css | 1 + templates/metrics/tracts.html | 7 +++++++ 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/python/lsst/production/tools/tractTable.py b/python/lsst/production/tools/tractTable.py index 0310aff..5331f6a 100644 --- a/python/lsst/production/tools/tractTable.py +++ b/python/lsst/production/tools/tractTable.py @@ -27,7 +27,7 @@ import numpy as np import yaml from flask import Blueprint, Flask, render_template, url_for -from lsst.daf.butler import Butler +from lsst.daf.butler import Butler, DatasetNotFoundError, MissingDatasetTypeError from .htmlUtils import * @@ -137,9 +137,19 @@ def collection(repo, collection): else: dataId = {"skymap": "lsst_cells_v1", "instrument": "LSSTComCam"} - t = butler.get( - "objectTableCore_metricsTable", collections=collection, dataId=dataId - ) + try: + t = butler.get( + "objectTableCore_metricsTable", collections=collection, dataId=dataId + ) + except (DatasetNotFoundError, MissingDatasetTypeError): + return render_template( + "metrics/tracts.html", + header_dict={}, + content_dict={}, + collection=collection, + error="Collection does not have dataset objectTableCore_metricsTable" + ) + col_dict = { "table_cols": ["tract", "corners", "nPatches", "nInputs", "failed metrics"], diff --git a/static/custom.css b/static/custom.css index 078475e..9bc5416 100644 --- a/static/custom.css +++ b/static/custom.css @@ -74,6 +74,7 @@ TD { text-align: center; padding: 2pt; color: #909B9C; + padding-bottom: 0.5em; } TD.summary { diff --git a/templates/metrics/tracts.html b/templates/metrics/tracts.html index e928419..bbd04d6 100644 --- a/templates/metrics/tracts.html +++ b/templates/metrics/tracts.html @@ -8,9 +8,16 @@ {% block content %} + +

{{collection}}

<-- Back to collections + {% if error %} +

+

{{error}}

+ {% endif %} + {% for header in header_dict %}