Skip to content

Commit e7ecd0e

Browse files
authored
Merge pull request #328 from ASFHyP3/develop
Release V0.7.0
2 parents b45ee32 + 9c6cde3 commit e7ecd0e

12 files changed

Lines changed: 66 additions & 228 deletions

File tree

.github/actions/deploy/action.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,12 @@ inputs:
2424
required: true
2525
PUBLISH_BUCKET:
2626
required: true
27-
MATTERMOST_PAT:
28-
required: true
2927
ECR_IMAGE_URI:
3028
required: true
29+
STAC_ITEMS_ENDPOINT:
30+
required: true
31+
STAC_EXISTS_OK:
32+
required: true
3133

3234
runs:
3335
using: composite
@@ -54,8 +56,9 @@ runs:
5456
EarthdataUsername=${{ inputs.EARTHDATA_USERNAME }} \
5557
EarthdataPassword=${{ inputs.EARTHDATA_PASSWORD }} \
5658
PublishBucket=${{ inputs.PUBLISH_BUCKET }} \
57-
MattermostPAT=${{ inputs.MATTERMOST_PAT }} \
58-
EcrImageUri=${{ inputs.ECR_IMAGE_URI }}
59+
EcrImageUri=${{ inputs.ECR_IMAGE_URI }} \
60+
StacItemsEndpoint=${{ inputs.STAC_ITEMS_ENDPOINT }} \
61+
StacExistsOk=${{ inputs.STAC_EXISTS_OK }}
5962
6063
export CF_TEMPLATE_BUCKET=${{ inputs.CF_TEMPLATE_BUCKET }}
6164
export ITS_LIVE_MONITORING_QUEUE_ARN=$( \

.github/workflows/build-and-deploy.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ jobs:
5050
platforms: ${{ env.PLATFORMS }}
5151

5252
- uses: aws-actions/configure-aws-credentials@v5
53+
if: ${{ github.actor != 'dependabot[bot]' }}
5354
with:
5455
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
5556
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
@@ -122,5 +123,6 @@ jobs:
122123
HYP3_JOBS_TABLE: ${{ vars.HYP3_JOBS_TABLE }}
123124
LAMBDA_LOGGING_LEVEL: INFO
124125
PUBLISH_BUCKET: ${{ vars.PUBLISH_BUCKET }}
125-
MATTERMOST_PAT: ${{ secrets.MATTERMOST_PAT }}
126+
STAC_ITEMS_ENDPOINT: ${{ vars.STAC_ITEMS_ENDPOINT }}
127+
STAC_EXISTS_OK: ${{ vars.STAC_EXISTS_OK }}
126128
ECR_IMAGE_URI: ${{ needs.dockerize.outputs.image_uri }}

CHANGELOG.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,21 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## [0.7.0]
8+
## Added
9+
- `StacItemsEndpoint` and `StacExistsOk` cloudformation parameters to allow publishing STAC items directly to a STAC catalog. Accordingly:
10+
- `STAC_ITEMS_ENDPOINT` and `STAC_EXISTS_OK` environment variables are set for the monitoring lambda.
11+
- The cloud formation parameters are set in the build and deploy GitHub Actions workflow by the `STAC_ITEMS_ENDPOINT` and `STAC_EXISTS_OK` deploy environment variables.
12+
13+
## Changed
14+
- Updated the `AUTORIFT_JOB_TEMPLATE` for [HyP3 v10.13.0+](https://github.com/ASFHyP3/hyp3/pull/3003) to allow posting/putting STAC items in the catalog instead of writing them to an alternate ingest location.
15+
16+
### Removed
17+
- Support for dead-letter queue monitoring through Mattermost.
18+
719
## [0.6.1]
820
### Added
9-
- A check to ensure that an orbit file is availble for Sentinel-1 scenes
21+
- A check to ensure that an orbit file is available for Sentinel-1 scenes
1022

1123
### Changed
1224
- Sentinel-1 frame overlap has been removed such that bursts that could occur in multiple opera frames now only occur in one.

Dockerfile

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,5 @@ RUN pip install -r requirements-its_live_monitoring.txt
55

66
COPY its_live_monitoring/src ${LAMBDA_TASK_ROOT}
77

8-
COPY requirements-status-messages.txt ${LAMBDA_TASK_ROOT}
9-
RUN pip install -r requirements-status-messages.txt
10-
11-
COPY status-messages/src ${LAMBDA_TASK_ROOT}
12-
138
# NOTE: handler set as CMD by parameter override outside of the Dockerfile
149
# CMD [ "lambda_function.handler" ]

cloudformation.yml

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,17 @@ Parameters:
3434
- its-live-data
3535
- its-live-data-test
3636

37-
MattermostPAT:
37+
StacItemsEndpoint:
3838
Type: String
39-
NoEcho: true
39+
Default: "None"
40+
41+
StacExistsOk:
42+
Type: String
43+
Default: "false"
44+
AllowedValues:
45+
- "false"
46+
- "true"
47+
4048

4149
EcrImageUri:
4250
Description: ECR image URI
@@ -119,6 +127,8 @@ Resources:
119127
EARTHDATA_USERNAME: !Ref EarthdataUsername
120128
EARTHDATA_PASSWORD: !Ref EarthdataPassword
121129
PUBLISH_BUCKET: !Ref PublishBucket
130+
STAC_ITEMS_ENDPOINT: !Ref StacItemsEndpoint
131+
STAC_EXISTS_OK: !Ref StacExistsOk
122132

123133
LambdaEventSourceMapping:
124134
Type: AWS::Lambda::EventSourceMapping
@@ -186,17 +196,6 @@ Resources:
186196
- ecr:GetDownloadUrlForLayer
187197
Resource: !Sub "arn:aws:ecr:${AWS::Region}:${AWS::AccountId}:repository/*"
188198

189-
StatusMessages:
190-
Type: AWS::CloudFormation::Stack
191-
Properties:
192-
Parameters:
193-
QueueURL: !Ref DeadLetterQueue
194-
QueueName: !GetAtt DeadLetterQueue.QueueName
195-
MattermostPAT: !Ref MattermostPAT
196-
LambdaLoggingLevel: !Ref LambdaLoggingLevel
197-
EcrImageUri: !Ref EcrImageUri
198-
TemplateURL: status-messages/cloudformation.yml
199-
200199
Outputs:
201200
ItsLiveMonitoringQueueArn:
202201
Description: "The ARN for its-live-monitoring's SQS queue"

its_live_monitoring/src/main.py

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,10 @@
4141
# 'secondary': list[str],
4242
'parameter_file': '/vsicurl/https://its-live-data.s3.amazonaws.com/autorift_parameters/v001/autorift_landice_0120m.shp',
4343
# 'publish_bucket': str | None,
44-
'publish_stac_prefix': 'stac-ingest',
4544
'use_static_files': True,
4645
# 'frame_id' = str | None,
46+
# 'stac_items_endpoint': str | None,
47+
# 'stac_exists_ok': bool,
4748
},
4849
'job_type': 'AUTORIFT',
4950
# 'name': str | None,
@@ -97,7 +98,7 @@ def get_key(tile_prefixes: list[str], reference: str, secondary: str) -> str | N
9798
for tile_prefix in tile_prefixes:
9899
prefix = f'{tile_prefix}/{reference}_X_{secondary}'
99100
response = s3.list_objects_v2(
100-
Bucket=os.environ.get('PUBLISH_BUCKET', 'its-live-data'),
101+
Bucket=os.environ['PUBLISH_BUCKET'],
101102
Prefix=prefix,
102103
)
103104
for item in response.get('Contents', []):
@@ -233,6 +234,15 @@ def deduplicate_hyp3_pairs(pairs: gpd.GeoDataFrame) -> gpd.GeoDataFrame:
233234
return pairs.reset_index()
234235

235236

237+
def _nullable_str(s: str) -> str | None:
238+
s = s.replace('None', '').strip()
239+
return s if s else None
240+
241+
242+
def _string_is_true(s: str) -> bool:
243+
return s.lower() == 'true'
244+
245+
236246
def submit_pairs_for_processing(pairs: gpd.GeoDataFrame) -> sdk.Batch: # noqa: D103
237247
prepared_jobs = []
238248
for reference, secondary, name in pairs[['reference', 'secondary', 'job_name']].itertuples(index=False):
@@ -242,7 +252,11 @@ def submit_pairs_for_processing(pairs: gpd.GeoDataFrame) -> sdk.Batch: # noqa:
242252
prepared_job['job_parameters']['secondary'] = secondary
243253

244254
if publish_bucket := os.environ.get('PUBLISH_BUCKET', ''):
245-
prepared_job['job_parameters']['publish_bucket'] = publish_bucket
255+
prepared_job['job_parameters']['publish_bucket'] = _nullable_str(publish_bucket)
256+
257+
if stac_items_endpoints := os.environ.get('STAC_ITEMS_ENDPOINT', ''):
258+
prepared_job['job_parameters']['stac_items_endpoint'] = _nullable_str(stac_items_endpoints)
259+
prepared_job['job_parameters']['stac_exists_ok'] = _string_is_true(os.environ.get('STAC_EXISTS_OK', ''))
246260

247261
if name.startswith('OPERA'):
248262
prepared_job['job_parameters']['frame_id'] = name.split('_')[1]
@@ -311,12 +325,13 @@ def process_scene(
311325

312326
# FIXME: Sentinel-1's file name is not easily predictable from the burst acquisitions so we can't do this yet
313327
# TODO: Instead of looking in the bucket, we should look in the (pending) STAC ITS_LIVE catalog
314-
if len(pairs) > 0 and not scene.startswith('S1'):
315-
pairs = deduplicate_s3_pairs(pairs)
328+
if os.environ.get('PUBLISH_BUCKET', ''):
329+
if len(pairs) > 0 and not scene.startswith('S1'):
330+
pairs = deduplicate_s3_pairs(pairs)
316331

317-
log.info(f'Deduplicated already published pairs; {len(pairs)} remaining')
318-
with pd.option_context('display.max_rows', None, 'display.max_columns', None, 'display.width', None):
319-
log.debug(pairs.sort_values(by=['secondary'], ascending=False).loc[:, ['reference', 'secondary']])
332+
log.info(f'Deduplicated already published pairs; {len(pairs)} remaining')
333+
with pd.option_context('display.max_rows', None, 'display.max_columns', None, 'display.width', None):
334+
log.debug(pairs.sort_values(by=['secondary'], ascending=False).loc[:, ['reference', 'secondary']])
320335

321336
jobs = sdk.Batch()
322337
if submit:

requirements-all.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
-r requirements-its_live_monitoring.txt
2-
-r requirements-status-messages.txt
32
cfn-lint==1.42.0
43
ruff==0.14.7
54
moto==5.1.18

requirements-its_live_monitoring.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
geopandas==1.1.1
1+
geopandas==1.1.2
22
hyp3-sdk==7.7.5
33
pandas==2.3.3
44
pystac-client==0.9.0

requirements-status-messages.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

status-messages/cloudformation.yml

Lines changed: 0 additions & 99 deletions
This file was deleted.

0 commit comments

Comments
 (0)