Skip to content

Commit

Permalink
Update to utilize new commons (#21)
Browse files Browse the repository at this point in the history
* Update terraform to make PCM release tags optional

* Update submit_to_sds to utilize new auto version selection

* Fix tests
  • Loading branch information
joshgarde committed Jun 13, 2024
1 parent 16aec20 commit fb78a77
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 7 deletions.
3 changes: 1 addition & 2 deletions podaac/swodlr_ingest_to_sds/submit_to_sds.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,13 @@
ACCEPTED_EXTS = ['nc']
INGEST_QUEUE_URL = utils.get_param('ingest_queue_url')
INGEST_TABLE_NAME = utils.get_param('ingest_table_name')
PCM_RELEASE_TAG = utils.get_param('sds_pcm_release_tag')

dynamodb = boto3.client('dynamodb')
sqs = boto3.client('sqs')

logger = utils.get_logger(__name__)
ingest_job_type = utils.mozart_client.get_job_type(
f'job-INGEST_STAGED:{PCM_RELEASE_TAG}'
utils.get_latest_job_version('job-INGEST_STAGED')
)
ingest_job_type.initialize()

Expand Down
1 change: 0 additions & 1 deletion terraform/bin/config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,5 @@ export TF_INPUT=false # https://www.terraform.io/cli/config/environment-variabl

export TF_VAR_region="$REGION"
export TF_VAR_stage="$VENUE"
export TF_VAR_sds_pcm_release_tag="$SWODLR_sds_pcm_release_tag"

terraform init -reconfigure -backend-config="bucket=$BUCKET" -backend-config="region=$REGION"
1 change: 0 additions & 1 deletion terraform/environments/ops.env
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
export REGION=us-west-2
export BUCKET=podaac-services-ops-terraform
export SWODLR_sds_pcm_release_tag=pcm-v5.0.0-pge-v5.0.4
1 change: 0 additions & 1 deletion terraform/environments/sit.env
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
export REGION=us-west-2
export BUCKET=podaac-services-sit-terraform
export SWODLR_sds_pcm_release_tag=pcm-v5.0.0-pge-v5.0.4
1 change: 0 additions & 1 deletion terraform/environments/uat.env
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
export REGION=us-west-2
export BUCKET=podaac-services-uat-terraform
export SWODLR_sds_pcm_release_tag=pcm-v5.0.0-pge-v5.0.4
3 changes: 3 additions & 0 deletions terraform/lambdas.tf
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ resource "aws_lambda_function" "bootstrap" {
resource "aws_lambda_function" "submit_to_sds" {
function_name = "${local.service_prefix}-submit_to_sds"
handler = "podaac.swodlr_ingest_to_sds.submit_to_sds.lambda_handler"
timeout = 300

role = aws_iam_role.lambda.arn
runtime = "python3.9"
Expand All @@ -29,6 +30,7 @@ resource "aws_lambda_function" "submit_to_sds" {
resource "aws_lambda_function" "poll_status" {
function_name = "${local.service_prefix}-poll_status"
handler = "podaac.swodlr_ingest_to_sds.poll_status.lambda_handler"
timeout = 300

role = aws_iam_role.lambda.arn
runtime = "python3.9"
Expand Down Expand Up @@ -186,6 +188,7 @@ resource "aws_iam_role" "lambda" {

# -- SSM Parameters --
resource "aws_ssm_parameter" "sds_pcm_release_tag" {
count = var.sds_pcm_release_tag == null ? 0 : 1
name = "${local.service_path}/sds_pcm_release_tag"
type = "String"
value = var.sds_pcm_release_tag
Expand Down
1 change: 1 addition & 0 deletions terraform/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ variable "region" {

variable "sds_pcm_release_tag" {
type = string
default = null
}

variable "sds_host" {
Expand Down
5 changes: 4 additions & 1 deletion tests/test_submit_to_sds.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,16 @@
with (
patch('boto3.client'),
patch('otello.mozart.Mozart.get_job_type'),
patch('podaac.swodlr_common.utilities.BaseUtilities.get_latest_job_version'), # pylint: disable-next=line-too-long # noqa: E501
patch('podaac.swodlr_ingest_to_sds.utilities.utils.get_grq_es_client') as mock_es_client, # pylint: disable-next=line-too-long # noqa: E501
patch.dict(environ, {
'SWODLR_ENV': 'dev',
'SWODLR_sds_username': 'test_username',
'SWODLR_sds_password': 'test_password',
'SWODLR_ingest_table_name': 'test_ingest_table_name',
'SWODLR_ingest_queue_url': 'test_ingest_queue_url',
'SWODLR_available_tiles_table': 'test_available_tiles_table'
'SWODLR_available_tiles_table': 'test_available_tiles_table',
'SWODLR_sds_host': 'http://sds-host.test/'
})
):
from podaac.swodlr_ingest_to_sds import submit_to_sds
Expand Down

0 comments on commit fb78a77

Please sign in to comment.