You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+96-10Lines changed: 96 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -46,7 +46,7 @@ Trigger events by themselves don't automatically mean that SDS processing is rea
46
46
As described by [Hua et al. [2022]](#1):
47
47
> A fundamental capability of an SDS is to systematically process science data through a series of data transformations from raw instrument data to geophysical measurements. Data are first made available to the SDS from GDS to be processed to higher level data products. The data transformation steps may utilize ancillary and auxiliary files as well as production rules that stipulate conditions for when each step should be executed.
48
48
49
-
In an SDS, evaluators are functions (irrespective of how they are deployed and called) that perform adaptation-specific evaluation to determine if the next step in the processing pipeline is ready for execution.
49
+
In an SDS, evaluators are functions (irrespective of how they are deployed and called) that perform adaptation-specific evaluation to determine if the next step in the processing pipeline is ready for execution.
50
50
51
51
As an example, the following shows the input-output diagram for the NISAR L-SAR L0B PGE (a.k.a. science algorithm):
52
52
@@ -113,7 +113,7 @@ and a trigger event payload for a new file that was triggered:
113
113
114
114
The router will iterate over the set of url configs and attempt to match the URL against its set of regexes. If a match is successful, the router will iterate over the configured evaluators configs and perform the configured action to submit the URL payload to the evaluator interface (either SNS topic or DAG submission). In this case, the router sees that the action is `submit_to_sns_topic` and thus publishes the URL payload (and the regular expression captured groups as `payload_info`) to the SNS topic (`topic_arn`) configured in the action's parameters. In addition to the payload URL and the payload info, the router also includes the `on_success` parameters configured for the action. This will propagate pertinent info to the underlying evaluator code which would be used if evaluation is successful. In this case, if the evaulator successfully evaluates that everything is ready for this input file, it can proceed to submit a DAG run for the `submit_nisar_tlm_ingest` DAG in the underlying SPS.
115
115
116
-
Let's consider another example but this time the configured action is to submit a DAG run instead of publishing to an evaluator's SNS topic:
116
+
Let's consider another example but this time the configured action is to submit a DAG run instead of publishing to an evaluator's SNS topic:
117
117
```
118
118
initiator_config:
119
119
name: minimal config example
@@ -171,11 +171,13 @@ In this case, the router sees that the action is `submit_dag_by_id` and thus mak
171
171
*[Quick Start](#quick-start)
172
172
*[Setting Up the End-to-End Demo](#setting-up-the-end-to-end-demo)
173
173
*[Deploying the Inititator](#deploying-the-initiator)
174
-
*[Deploying an Example Evaluator](#deploying-an-example-evaluator-sns-topic-sqs-queue-lambda)
174
+
*[Deploying Example Evaluators](#deploying-example-evaluators-sns-topic-sqs-queue-lambda)
175
175
*[Deploying an S3 Event Notification Trigger](#deploying-an-s3-event-notification-trigger)
*[Setup Instructions for Development](#setup-instructions-for-development)
181
183
*[Build Instructions](#build-instructions)
@@ -212,13 +214,14 @@ This guide provides a quick way to get started with our project. Please see our
212
214
```
213
215
cd unity-initiator/terraform-unity/initiator/
214
216
```
215
-
1. Copy a sample router configuration YAML file to use for deployment and update the AWS region and AWS account ID to match your AWS environment. We will be using the NISAR TLM test case for this demo so we also rename the SNS topic ARN for it accordingly:
217
+
1. Copy a sample router configuration YAML file to use for deployment and update the AWS region and AWS account ID to match your AWS environment. We will be using the NISAR TLM and AIRS RetStd test cases for this demo so we also rename the SNS topic ARNs for them accordingly:
216
218
```
217
219
cp ../../tests/resources/test_router.yaml .
218
220
export AWS_ACCOUNT_ID=$(aws sts get-caller-identity --output text | awk '{print $1}')
219
221
export AWS_REGION=$(aws configure get region)
220
222
sed -i "s/hilo-hawaii-1/${AWS_REGION}/g" test_router.yaml
221
223
sed -i "s/123456789012:eval_nisar_ingest/${AWS_ACCOUNT_ID}:uod-dev-eval_nisar_ingest-evaluator_topic/g" test_router.yaml
224
+
sed -i "s/123456789012:eval_airs_ingest/${AWS_ACCOUNT_ID}:uod-dev-eval_airs_ingest-evaluator_topic/g" test_router.yaml
222
225
```
223
226
1. You will need an S3 bucket for terraform to stage the router Lambda zip file during deployment. Create one or reuse an existing one and set an environment variable for it:
224
227
```
@@ -247,10 +250,19 @@ This guide provides a quick way to get started with our project. Please see our
247
250
```
248
251
**Take note of the `initiator_topic_arn` that is output by terraform. It will be used when setting up any triggers.**
249
252
250
-
#### Deploying an Example Evaluator (SNS topic->SQS queue->Lambda)
251
-
1. Change directory to the location of the sns_sqs_lambda evaluator terraform:
253
+
#### Deploying Example Evaluators (SNS topic->SQS queue->Lambda)
254
+
##### Evaluator Deployment for NISAR TLM (via staged data to the ISL)
255
+
1. Change directory to the location of the evaluators terraform:
252
256
```
253
-
cd ../evaluators/sns_sqs_lambda/
257
+
cd ../evaluators
258
+
```
259
+
1. Make a copy of the `sns_sqs_lambda` directory for the NISAR TLM evaluator:
260
+
```
261
+
cp -rp sns_sqs_lambda sns_sqs_lambda-nisar_tlm
262
+
```
263
+
1. Change directory into the NISAR TLM evaluator terraform:
264
+
```
265
+
cd sns_sqs_lambda-nisar_tlm/
254
266
```
255
267
1. Set the name of the evaluator to our NISAR example:
256
268
```
@@ -270,8 +282,41 @@ This guide provides a quick way to get started with our project. Please see our
270
282
--var evaluator_name=${EVALUATOR_NAME} \
271
283
-auto-approve
272
284
```
273
-
**Take note of the `evaluator_topic_arn` that is output by terraform. It should match the topic ARN in the test_router.yaml file you used during the initiator deployment. If they match then the router Lambda is now able to submit payloads to this evaluator SNS topic.**
274
-
285
+
**Take note of the `evaluator_topic_arn` that is output by terraform. It should match the respective topic ARN in the test_router.yaml file you used during the initiator deployment. If they match then the router Lambda is now able to submit payloads to this evaluator SNS topic.**
286
+
287
+
##### Evaluator Deployment for AIRS RetStd (via scheduled CMR query)
288
+
1. Change directory to the location of the evaluators terraform:
289
+
```
290
+
cd ..
291
+
```
292
+
1. Make a copy of the `sns_sqs_lambda` directory for the AIRS RetStd evaluator:
293
+
```
294
+
cp -rp sns_sqs_lambda sns_sqs_lambda-airs_retstd
295
+
```
296
+
1. Change directory into the AIRS RetStd evaluator terraform:
297
+
```
298
+
cd sns_sqs_lambda-airs_retstd/
299
+
```
300
+
1. Set the name of the evaluator to our AIRS example:
301
+
```
302
+
export EVALUATOR_NAME=eval_airs_ingest
303
+
```
304
+
1. Note the implementation of the evaluator code. It currently doesn't do any real evaluation but simply returns that evaluation was successful:
305
+
```
306
+
cat data.tf
307
+
```
308
+
1. Initialize terraform:
309
+
```
310
+
terraform init
311
+
```
312
+
1. Run terraform apply:
313
+
```
314
+
terraform apply \
315
+
--var evaluator_name=${EVALUATOR_NAME} \
316
+
-auto-approve
317
+
```
318
+
**Take note of the `evaluator_topic_arn` that is output by terraform. It should match the respective topic ARN in the test_router.yaml file you used during the initiator deployment. If they match then the router Lambda is now able to submit payloads to this evaluator SNS topic.**
319
+
275
320
#### Deploying an S3 Event Notification Trigger
276
321
1. Change directory to the location of the s3_bucket_notification trigger terraform:
277
322
```
@@ -341,9 +386,50 @@ This guide provides a quick way to get started with our project. Please see our
341
386
1. The deployed EventBridge scheduler runs the trigger Lambda function with schedule expression of `rate(1 minute)`. After a minute, verify that the `eval_nisar_ingest` evaluator Lambda function was called successfully for each of those scheduled invocations by looking at its CloudWatch logs for entries similar to this:
#### Deploying an EventBridge Scheduler Trigger for Periodic CMR Queries
390
+
1. Change directory to the location of the s3_bucket_notification trigger terraform:
391
+
```
392
+
cd ../cmr_query/
393
+
```
394
+
1. Note the implementation of the trigger lambda code. It will query CMR for granules for a particular collection within a timeframe, query its dynamodb table if they already exist, and if not, submit them as payload URLs to the initiator SNS topic and save them into the dynamodb table:
395
+
```
396
+
cat lambda_handler.py
397
+
```
398
+
1. Set the CMR provider ID for the AIRS RetStd collection:
399
+
```
400
+
export PROVIDER_ID=GES_DISC
401
+
```
402
+
1. Set the CMR concept ID for the AIRS RetStd collection:
403
+
```
404
+
export CONCEPT_ID=C1701805619-GES_DISC
405
+
```
406
+
1. Set the amount of seconds to look back from the current epoch for granules in the collection. For example, we will set this value to 2 days (172800 seconds) so that when the CMR query lambda kicks off, it will query for all AIRS RetStd granules using a temporal search of `now - 172800 seconds` to `now`:
407
+
```
408
+
export SECONDS_BACK=172800
409
+
```
410
+
1. Initialize terraform:
411
+
```
412
+
terraform init
413
+
```
414
+
1. Run terraform apply. Note the DEPLOYMENT_NAME, CODE_BUCKET and INITIATOR_TOPIC_ARN environment variables should have been set in the previous steps. If not set them again:
1. The deployed EventBridge scheduler runs the trigger CMR query Lambda function with schedule expression of `rate(1 minute)`. After a minute, verify that the `eval_airs_ingest` evaluator Lambda function was called successfully for each of those scheduled invocations by looking at its CloudWatch logs for entries similar to this:
0 commit comments