Skip to content

Commit

Permalink
Merge pull request #1088 from jdavies-st/cron-sync-allow-state-latest
Browse files Browse the repository at this point in the history
sync/allow-latest
  • Loading branch information
alphasentaurii authored Oct 11, 2024
2 parents 94138b4 + 0f0e46c commit 64a5cf9
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/contexts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
CRDS_SERVER_URL: https://jwst-crds.stsci.edu
run: >
echo "pmap=$(
curl -s -X POST -d '{"jsonrpc": "1.0", "method": "get_default_context", "params": ["${{ env.OBSERVATORY }}"], "id": 1}' ${{ env.CRDS_SERVER_URL }}/json/ --retry 8 --connect-timeout 10 |
curl -s -X POST -d '{"jsonrpc": "1.0", "method": "get_default_context", "params": ["${{ env.OBSERVATORY }}", null], "id": 1}' ${{ env.CRDS_SERVER_URL }}/json/ --retry 8 --connect-timeout 10 |
python -c "import sys, json; print(json.load(sys.stdin)['result'])"
)" >> $GITHUB_OUTPUT
- run: if [[ ! -z "${{ steps.jwst_crds_context.outputs.pmap }}" ]]; then echo ${{ steps.jwst_crds_context.outputs.pmap }}; else exit 1; fi
Expand Down
13 changes: 12 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
12.0.1 (unreleased)
12.0.2 (2024-10-07)
===================

Documentation
-------------

- Fixed changelog version [#1083]

- Updated image names [#1084]


12.0.1 (2024-10-07)
===================

Documentation
Expand Down
1 change: 1 addition & 0 deletions changes/1088.general.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
latest is a valid file state, context spec includes build and latest
3 changes: 1 addition & 2 deletions crds/core/cmdline.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,8 +343,7 @@ def bad_files(self):
@property
def default_context(self):
"""Return the default latest .pmap defined by the CRDS server or cache."""
default = self.server_info.get("latest_context", "operational_context")
return self.server_info[default]
return self.server_info.get("latest_context", self.server_info["operational_context"])

def get_words(self, word_list):
"""Process a file list, expanding @-files into corresponding lists of
Expand Down
4 changes: 3 additions & 1 deletion crds/core/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -661,7 +661,7 @@ def get_crds_env_context():
context = os.environ.get("CRDS_CONTEXT", None)
if context:
assert is_context_spec(context), \
"Only set CRDS_CONTEXT to a literal or symbolic context (.pmap), e.g. jwst_0042.pmap, jwst-2014-10-15T00:15:21, jwst-operational, not " + repr(context)
"Only set CRDS_CONTEXT to a literal or symbolic context (.pmap), e.g. jwst_0042.pmap, jwst-2014-10-15T00:15:21, jwst-latest, not " + repr(context)
return context

CRDS_IGNORE_MAPPING_CHECKSUM = BooleanConfigItem("CRDS_IGNORE_MAPPING_CHECKSUM", False,
Expand Down Expand Up @@ -1400,6 +1400,8 @@ def is_context_spec(mapping):
>>> is_context_spec("hst-acs-2040-01-29T12:00:00")
False
"""
if mapping in ["latest", "build"]:
return True
return is_context(mapping) or (isinstance(mapping, str) and bool(PIPELINE_CONTEXT_RE.match(mapping)))

def is_date_based_mapping_spec(mapping):
Expand Down
2 changes: 1 addition & 1 deletion crds/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -633,7 +633,7 @@ def verify_file(self, file, info, bytes_so_far, total_bytes, nth_file, total_fil
self.error_and_repair(path, "File", repr(base), "checksum mismatch CRDS=" + repr(info["sha1sum"]),
"LOCAL=" + repr(sha1sum))

if info["state"] not in ["archived", "operational", "delivered"]:
if info["state"] not in ["archived", "operational", "delivered", "latest"]:
log.warning("File", repr(base), "has an unusual CRDS file state", repr(info["state"]))

if info["rejected"] != "false":
Expand Down

0 comments on commit 64a5cf9

Please sign in to comment.