Skip to content

Commit

Permalink
CUMULUS 2670 - Update ingest module's tasks to allow configurable tim…
Browse files Browse the repository at this point in the history
…eouts (#2439)

* Update ingest module's tasks to allow configurable timeouts

* Update CHANGELOG

* Update CHANGELOG.md

Co-authored-by: Mark Boyd <[email protected]>

* Add user doc

Co-authored-by: Mark Boyd <[email protected]>
  • Loading branch information
Jkovarik and markdboyd authored Sep 7, 2021
1 parent 5ccc180 commit 1f1c173
Show file tree
Hide file tree
Showing 19 changed files with 83 additions and 13 deletions.
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,20 @@ of response and not the raw API endpoint response

### Added

- **CUMULUS-2670**
- Updated core `cumulus` module to take lambda_timeouts string map variable that allows timeouts of ingest tasks to be configurable. Allowed properties for the mapping include:
- discover_granules_task_timeout
- discover_pdrs_task_timeout
- hyrax_metadata_update_tasks_timeout
- lzards_backup_task_timeout
- move_granules_task_timeout
- parse_pdr_task_timeout
- pdr_status_check_task_timeout
- post_to_cmr_task_timeout
- queue_granules_task_timeout
- queue_pdrs_task_timeout
- queue_workflow_task_timeout
- sync_granule_task_timeout
- **CUMULUS-2575**
- Adds `POST /granules` API endpoint to create a granule
- Adds helper `createGranule` to `@cumulus/api-client`
Expand Down
37 changes: 37 additions & 0 deletions docs/configuration/ingest-task-configuration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
id: ingest-task-configuration
title: Configuration of Ingest Tasks
hide_title: false
---

The `cumulus` module exposes values for configuration of some of the provided ingest workflow tasks. Currently the following are available as configurable variables:

## lambda_timeouts

A configurable map of timeouts (in seconds) for cumulus ingest module task lambdas in the form:

```text
<lambda_identifier>_timeout: <timeout>"
type = map(string)
```

Currently the following values are supported:

- discover_granules_task_timeout
- discover_pdrs_task_timeout
- hyrax_metadata_update_tasks_timeout
- lzards_backup_task_timeout
- move_granules_task_timeout
- parse_pdr_task_timeout
- pdr_status_check_task_timeout
- post_to_cmr_task_timeout
- queue_granules_task_timeout
- queue_pdrs_task_timeout
- queue_workflow_task_timeout
- sync_granule_task_timeout

### Example

```tf
{ "discover_granules_task_timeout": 300 }
```
5 changes: 5 additions & 0 deletions example/cumulus-tf/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,11 @@ variable "ddl_dir" {
description = "The location of the ddl dir that contains the sql to create the application database."
}

variable "lambda_timeouts" {
type = map(string)
default = {}
}

variable "lambda_timeout" {
default = 300
type = number
Expand Down
1 change: 1 addition & 0 deletions tf-modules/cumulus/ingest.tf
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ module "ingest" {
cmr_page_size = var.cmr_page_size
cmr_custom_host = var.cmr_custom_host

lambda_timeouts = var.lambda_timeouts
# Launchpad config
launchpad_api = var.launchpad_api
launchpad_passphrase = var.launchpad_passphrase
Expand Down
6 changes: 6 additions & 0 deletions tf-modules/cumulus/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,12 @@ variable "elasticsearch_security_group_id" {
default = ""
}

variable "lambda_timeouts" {
description = "Configurable map of timeouts for ingest task lambdas in the form <lambda_identifier>_timeout: <timeout>"
type = map(string)
default = {}
}

variable "prefix" {
description = "The unique prefix for your deployment resources"
type = string
Expand Down
2 changes: 1 addition & 1 deletion tf-modules/ingest/discover-granules-task.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ resource "aws_lambda_function" "discover_granules_task" {
handler = "index.handler"
role = var.lambda_processing_role_arn
runtime = "nodejs12.x"
timeout = 300
timeout = lookup (var.lambda_timeouts, "discover_granules_task_timeout", 300)
memory_size = 512

layers = [var.cumulus_message_adapter_lambda_layer_version_arn]
Expand Down
2 changes: 1 addition & 1 deletion tf-modules/ingest/discover-pdrs-task.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ resource "aws_lambda_function" "discover_pdrs_task" {
handler = "index.handler"
role = var.lambda_processing_role_arn
runtime = "nodejs12.x"
timeout = 300
timeout = lookup (var.lambda_timeouts, "discover_pdrs_task_timeout", 300)
memory_size = 1024

layers = [var.cumulus_message_adapter_lambda_layer_version_arn]
Expand Down
2 changes: 1 addition & 1 deletion tf-modules/ingest/hyrax-metadata-updates-task.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ resource "aws_lambda_function" "hyrax_metadata_updates_task" {
handler = "index.handler"
role = var.lambda_processing_role_arn
runtime = "nodejs12.x"
timeout = 300
timeout = lookup (var.lambda_timeouts, "hyrax_metadata_updates_task_timeout", 300)
memory_size = 256

layers = [var.cumulus_message_adapter_lambda_layer_version_arn]
Expand Down
2 changes: 1 addition & 1 deletion tf-modules/ingest/lzards-backup-task.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ resource "aws_lambda_function" "lzards_backup_task" {
handler = "index.handler"
role = var.lambda_processing_role_arn
runtime = "nodejs12.x"
timeout = 900
timeout = lookup (var.lambda_timeouts, "lzards_backup_task_timeout", 900)
memory_size = 512

layers = [var.cumulus_message_adapter_lambda_layer_version_arn]
Expand Down
2 changes: 1 addition & 1 deletion tf-modules/ingest/move-granules-task.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ resource "aws_lambda_function" "move_granules_task" {
handler = "index.handler"
role = var.lambda_processing_role_arn
runtime = "nodejs12.x"
timeout = 300
timeout = lookup (var.lambda_timeouts, "move_granules_task_timeout", 300)
memory_size = 1024

layers = [var.cumulus_message_adapter_lambda_layer_version_arn]
Expand Down
2 changes: 1 addition & 1 deletion tf-modules/ingest/parse-pdr-task.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ resource "aws_lambda_function" "parse_pdr_task" {
handler = "index.handler"
role = var.lambda_processing_role_arn
runtime = "nodejs12.x"
timeout = 300
timeout = lookup (var.lambda_timeouts, "parse_pdr_task_timeout", 300)
memory_size = 1024

layers = [var.cumulus_message_adapter_lambda_layer_version_arn]
Expand Down
2 changes: 1 addition & 1 deletion tf-modules/ingest/pdr-status-check-task.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ resource "aws_lambda_function" "pdr_status_check_task" {
handler = "index.handler"
role = var.lambda_processing_role_arn
runtime = "nodejs12.x"
timeout = 300
timeout = lookup (var.lambda_timeouts, "pdr_status_check_task_timeout", 300)
memory_size = 1024

layers = [var.cumulus_message_adapter_lambda_layer_version_arn]
Expand Down
2 changes: 1 addition & 1 deletion tf-modules/ingest/post-to-cmr-task.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ resource "aws_lambda_function" "post_to_cmr_task" {
handler = "index.handler"
role = var.lambda_processing_role_arn
runtime = "nodejs12.x"
timeout = 300
timeout = lookup (var.lambda_timeouts, "post_to_cmr_task_timeout", 300)
memory_size = 256

layers = [var.cumulus_message_adapter_lambda_layer_version_arn]
Expand Down
2 changes: 1 addition & 1 deletion tf-modules/ingest/queue-granules-task.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ resource "aws_lambda_function" "queue_granules_task" {
handler = "index.handler"
role = var.lambda_processing_role_arn
runtime = "nodejs12.x"
timeout = 300
timeout = lookup (var.lambda_timeouts, "queue_granules_task_timeout", 300)
memory_size = 1024

layers = [var.cumulus_message_adapter_lambda_layer_version_arn]
Expand Down
2 changes: 1 addition & 1 deletion tf-modules/ingest/queue-pdrs-task.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ resource "aws_lambda_function" "queue_pdrs_task" {
handler = "index.handler"
role = var.lambda_processing_role_arn
runtime = "nodejs12.x"
timeout = 300
timeout = lookup(var.lambda_timeouts, "queue_pdrs_task_timeout", 300)
memory_size = 1024

layers = [var.cumulus_message_adapter_lambda_layer_version_arn]
Expand Down
2 changes: 1 addition & 1 deletion tf-modules/ingest/queue-workflow-task.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ resource "aws_lambda_function" "queue_workflow_task" {
handler = "index.handler"
role = var.lambda_processing_role_arn
runtime = "nodejs12.x"
timeout = 300
timeout = lookup(var.lambda_timeouts, "queue_workflow_task_timeout", 300)
memory_size = 1024

layers = [var.cumulus_message_adapter_lambda_layer_version_arn]
Expand Down
2 changes: 1 addition & 1 deletion tf-modules/ingest/sync-granule-task.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ resource "aws_lambda_function" "sync_granule_task" {
handler = "index.handler"
role = var.lambda_processing_role_arn
runtime = "nodejs12.x"
timeout = 300
timeout = lookup (var.lambda_timeouts, "sync_granule_task_timeout", 300)
memory_size = 1024

layers = [var.cumulus_message_adapter_lambda_layer_version_arn]
Expand Down
6 changes: 6 additions & 0 deletions tf-modules/ingest/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,12 @@ variable "tags" {
default = {}
}

variable "lambda_timeouts" {
description = "Configurable map of timeouts for ingest task lambdas in the form <lambda_identifier>_timeout: <timeout>"
type = map(string)
default = {}
}

variable "throttled_queues" {
description = "Array of configuration for custom queues with execution limits"
type = list(object({
Expand Down
3 changes: 2 additions & 1 deletion website/sidebars.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@
"configuration/server_access_logging",
"configuration/cloudwatch-retention",
"configuration/lifecycle-policies",
"configuration/collection-storage-best-practices"
"configuration/collection-storage-best-practices",
"configuration/ingest-task-configuration"
],
"Development": [
"workflows/developing-a-cumulus-workflow",
Expand Down

0 comments on commit 1f1c173

Please sign in to comment.