Skip to main content

echofish-aws-raw-to-zarr-lambda

Setting up the Python Environment

MacOS

  1. Install pyenv (https://github.com/pyenv/pyenv#set-up-your-shell-environment-for-pyenv)
    1. brew update
    2. brew install pyenv
    3. In ~/.bashrc add
      1. export PYENV_ROOT="$HOME/.pyenv"
      2. export PATH="$PYENV_ROOT/bin:$PATH"
      3. eval "$(pyenv init -)"
    4. brew install openssl readline sqlite3 xz zlib tcl-tk
  2. Install pyenv-virtualenv (https://github.com/pyenv/pyenv-virtualenv)
    1. brew install pyenv-virtualenv
    2. In ~/.bashrc add
      1. eval "$(pyenv virtualenv-init -)"
  3. Open a new terminal
  4. Install Python version
    1. env PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install 3.9.16
    2. Optional: set global version of Python env PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv global 3.9.16
  5. Create virtual env
    1. pyenv virtualenv 3.9.16 echofish-aws-raw-to-zarr-lambda
  6. Set local version of python (if not done already)
    1. change directory to root of project
    2. pyenv local echofish-aws-raw-to-zarr-lambda

Other OS

  1. Get a Mac
  2. See Above MacOS

Setting up IntelliJ

  1. Install the IntelliJ Python plugin
  2. Set up pyenv
    1. File -> Project Structure or CMD + ;
    2. SDKs -> + -> Add Python SDK -> Virtual Environment
    3. Select Existing Environment
    4. Choose ~/.pyenv/versions/echofish-aws-raw-to-zarr-lambda/bin/python
  3. Set up Python Facet (not sure if this is required)
    1. File -> Project Structure or CMD + ;
    2. Facets -> + -> Python
    3. Set interpreter

Installing Dependencies

  1. Add dependencies with versions to requirements.txt
  2. pip install --upgrade pip && pip install -r requirements_dev.txt

Maven

This project can use Apache Maven to easily build this project. However, this is not required, but recommended. Maven can be easily installed by downloading it from the Maven site or using sdkman.

Build with Maven

After setting up your pyenv run: mvn clean install

DOTENV

export AWS_DEFAULT_PROFILE=echofish

Functional Testing

To run a functional test, developer will need to save the associated environment variables in .env for the lambda to use. The ACCESS_KEY and SECRET_ACCESS_KEY can be generated in IAM, users, rudy-dev, security credentials, access keys, create access key. Copy other values as needed from deployed CloudFormation Template.

export OUTPUT_BUCKET=rudy-dev-echofish-118234403147-echofish-dev-output
export TABLE_NAME=rudy-dev-echofish-EchoFish-File-Info
export OUTPUT_BUCKET_ACCESS_KEY="XXX"
export OUTPUT_BUCKET_SECRET_ACCESS_KEY="YYY"
export TOPIC_ARN="arn:aws:sns:us-west-2:118234403147:rudy-dev-echofish-processing-finished"

Deploying new CodePipeline via Cloudformation

Build project w 'mvn clean install', navigate to the 'target/codepipeline' directory. You will need to create a private ECR repo in us-east-1 w name of the project for builds to push to. Then:

aws --profile mggdev cloudformation create-stack --stack-name build-echofish-aws-raw-to-zarr-lambda-trunk --template-body file://codepipeline.yaml --capabilities CAPABILITY_IAM CAPABILITY_AUTO_EXPAND

Elastic Container Registry

Note that the main repository is built and curated in the mgg-dev account in us-west-2. The derived docker image is built and pushed to the echofish us-east-1 ECR. That image is then replicated to the echofish us-west-2 account. You will need to go to the echofish ECR -> Repositories -> [repo] -> Permissions and copy the values from an existing project (for both regions).

In the echofish aws account:

IAM -> Roles -> AWSServiceRoleForECRReplication

To Run Tests

python -m pytest

Release files for echofish-aws-raw-to-zarr-lambda 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for echofish-aws-raw-to-zarr-lambda 1.0.0
File Size Uploaded
echofish-aws-raw-to-zarr-lambda-1.0.0.tar.gz 12.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for echofish-aws-raw-to-zarr-lambda 1.0.0
File Interpreter ABI Platform
echofish_aws_raw_to_zarr_lambda-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 25.6 kB

Release files / echofish-aws-raw-to-zarr-lambda-1.0.0.tar.gz

Download URL echofish-aws-raw-to-zarr-lambda-1.0.0.tar.gz
Size 12.8 kB
Tags Source
SHA-256 checksum
How to use checksums
3790b7273987fd29bae6735ceff4ebda5d8c753899abeeaee5ccd73e497e6cb3
BLAKE2b-256 checksum
How to use checksums
4f5b26135fc1cc86bb303eb475465afa3ab52b11fd02efefeb4bba2ef4841898
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.16

Release files / echofish_aws_raw_to_zarr_lambda-1.0.0-py3-none-any.whl

Download URL echofish_aws_raw_to_zarr_lambda-1.0.0-py3-none-any.whl
Size 12.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e49d79551b1a423f71f7cae814826572fc8b24a5523a5007fcf863ab3fefd84c
BLAKE2b-256 checksum
How to use checksums
a13c83a6b9d5e56ae834dade4635be3d2c4c6204a23254893de2d9e5e3f474a9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.16
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page