Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DM-39097: Start a ci_summit repo #50

Merged
merged 3 commits into from
Jun 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 7 additions & 8 deletions python/lsst/summit/utils/bestEffort.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
# TODO: add attempt for fringe once registry & templates are fixed

CURRENT_RUN = "LATISS/runs/quickLook/1"
ALLOWED_REPOS = ['/repo/main', '/repo/LATISS', '/readonly/repo/main']


class BestEffortIsr():
Expand All @@ -47,15 +46,12 @@ class BestEffortIsr():

This class uses the ``quickLookIsrTask``, see docs there for details.

Acceptable repodir values are currently listed in ALLOWED_REPOS. This will
be updated (removed) once DM-33849 is done.

defaultExtraIsrOptions is a dict of options applied to all images.

Parameters
----------
repoDir : `str`
The repo root. Will be removed after DM-33849.
repoString : `str`, optional
The Butler repo root.
extraCollections : `list` of `str`, optional
Extra collections to add to the butler init. Collections are prepended.
defaultExtraIsrOptions : `dict`, optional
Expand All @@ -79,14 +75,17 @@ def __init__(self, *,
defaultExtraIsrOptions={},
doRepairCosmics=True,
doWrite=True,
embargo=False):
embargo=False,
repoString=None):
self.log = logging.getLogger(__name__)

collections = getLatissDefaultCollections()
self.collections = extraCollections + collections
self.log.info(f'Instantiating butler with collections={self.collections}')
try:

if repoString is None:
repoString = "LATISS" if not embargo else "/repo/embargo"
try:
self.butler = dafButler.Butler(repoString, collections=self.collections,
instrument='LATISS',
run=CURRENT_RUN if doWrite else None)
Expand Down
6 changes: 3 additions & 3 deletions python/lsst/summit/utils/butlerUtils.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

__all__ = ["makeDefaultLatissButler",
"updateDataId",
"sanitize_day_obs",
"sanitizeDayObs",
"getMostRecentDayObs",
"getSeqNumsForDayObs",
"getMostRecentDataId",
Expand Down Expand Up @@ -196,7 +196,7 @@ def updateDataId(dataId, **kwargs):
raise ValueError(f"Unknown dataId type {type(dataId)}")


def sanitize_day_obs(day_obs):
def sanitizeDayObs(day_obs):
"""Take string or int day_obs and turn it into the int version.

Parameters
Expand Down Expand Up @@ -264,7 +264,7 @@ def getSeqNumsForDayObs(butler, day_obs, extraWhere=''):
The seq_nums taken on the corresponding day_obs in ascending numerical
order.
"""
day_obs = sanitize_day_obs(day_obs)
day_obs = sanitizeDayObs(day_obs)
where = "exposure.day_obs=day_obs"
if extraWhere:
extraWhere = extraWhere.replace('"', '\'')
Expand Down
12 changes: 6 additions & 6 deletions tests/test_butlerUtils.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import lsst.utils.tests
from lsst.summit.utils.butlerUtils import (makeDefaultLatissButler,
updateDataId,
sanitize_day_obs,
sanitizeDayObs,
getMostRecentDayObs,
getSeqNumsForDayObs,
getMostRecentDataId,
Expand Down Expand Up @@ -135,15 +135,15 @@ def test_RECENT_DAY(self):
print(f"RECENT_DAY is now {timeSinceUpdate.days} days in the past. "
"You might want to consider updating this to speed up butler queries.")

def test_sanitize_day_obs(self):
def test_sanitizeDayObs(self):
dayObs = '2020-01-02'
self.assertEqual(sanitize_day_obs(dayObs), 20200102)
self.assertEqual(sanitizeDayObs(dayObs), 20200102)
dayObs = 20210201
self.assertEqual(sanitize_day_obs(dayObs), dayObs)
self.assertEqual(sanitizeDayObs(dayObs), dayObs)

with self.assertRaises(ValueError):
sanitize_day_obs(1.234)
sanitize_day_obs('Febuary 29th, 1970')
sanitizeDayObs(1.234)
sanitizeDayObs('Febuary 29th, 1970')

def test_getMostRecentDayObs(self):
# just a basic sanity check here as we can't know the value,
Expand Down