Skip to content

swxsoc/sdc_aws_artifacts_lambda

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Overview

build status testing status codestyle and linting code coverage

This repository defines the image to be used for the SWSOC file artifacts Lambda function container. This container will be built and and stored in an ECR Repo. The container will contain the latest release code as the production environment and the latest code on master as the development.

Running Unit Tests

pytest --pyargs lambda_function/tests --cov=lambda_function/src --cov-report=html

Testing Locally (Using own Test Data)

The container image can be built and run locally. You can specify the base image at runtime. At the time of writing, the base image defaults to padre-swsoc-docker-lambda-base:latest in AWS.

# Chose a Base Image for you desired mission
export BASE_IMAGE=public.ecr.aws/w5r9l1c8/padre-swsoc-docker-lambda-base:latest
export IMAGE_NAME=swxsoc_sdc_aws_artifacts_lambda
export VERSION=$(date -u +"%Y%m%d%H%M%S")

# Build the image
docker build --no-cache --build-arg BASE_IMAGE=$BASE_IMAGE -t $IMAGE_NAME:latest lambda_function/.

# Tag the image with a version
docker tag $IMAGE_NAME:latest $IMAGE_NAME:$VERSION

Run the lambda container image you've built (After using your mfa script), this will start the lambda runtime environment:

docker run -p 9000:8080 \
  -v ~/lambda_function/tests/test_data:/test_data \
  -e SDC_AWS_FILE_PATH=/test_data/hermes_EEA_l0_2023042-000000_v0.bin \
  artifacts_function:latest

From a separate terminal, make a curl request to the running lambda function:

curl -XPOST "http://localhost:9000/2015-03-31/functions/function/invocations" \
  -d @lambda_function/tests/test_data/test_eea_event.json

Testing Locally (Using own Instrument Package Test Data)

Run the lambda container image you've built (After using your mfa script), this will start the lambda runtime environment:

docker run -p 9000:8080 \
  -v ~/lambda_function/tests/test_data:/test_data \
  -e USE_INSTRUMENT_TEST_DATA=True \
  artifacts_function:latest

From a separate terminal, make a curl request to the running lambda function:

curl -XPOST "http://localhost:9000/2015-03-31/functions/function/invocations" \
  -d @lambda_function/tests/test_data/test_eea_event.json

Acknowledgements

The package template used by this package is based on the one developed by the NASA Space Weather Science Operations Center (SWxSOC) which is based on those provided by OpenAstronomy community and the SunPy Project.

This project makes use of the NASA Space Weather Science Operations Center (SWxSOC).

About

Repository for SDC Pipeline Artifacts Lambda Function

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors