Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ecarton/cumulus 3751 from 18.5.2 #3900

Open
wants to merge 257 commits into
base: release-18.5.x
Choose a base branch
from

Conversation

etcart
Copy link
Contributor

@etcart etcart commented Jan 10, 2025

Summary: task which takes granules and a target collection, updating granules to belong to that target collection in s3 and cumulus datastore, idempotently

Addresses CUMULUS-3751: Workflow task that updates a granule to a new collection

Changes

  • adds new task to update S3 and cumulus data stores moving granules across collections
  • adds integration tests and associated resources in the example project
  • re-distributes ecs cluster resources among ecs tasks in example project

PR Checklist

  • Update CHANGELOG
  • Unit tests
  • Ad-hoc testing - Deploy changes and test manually
  • Integration tests

paulpilone and others added 30 commits August 28, 2024 13:03
* Adds 18.3.4 to change log

* Adds 18.3.4 docs
* Release 19

* Release 19 commit after step 8
* imf retry for db/test-execution.js

* sync granule imfs

* mistake in sleep import

* some clearer debug information in syncgranules test

* sync_granules test is failed by running in a loop???

* why is this granuleId just wrong

* lint fixes

* ensure extraneous keys are bleedover from another test

* typo in debug printout

* typo in debug printout

* turn up timeout in aws-client

* json typo

* clean up granules and granuleExecutions after each serial test to prevent mis-grabs

* remove retry because there's something else going wrong

* getWorkflowNameIntersectFromGranuleIds gets unique names

* linter cleanups

* newline cleanup

* tests for get endpoint in separate file (serialized and cleaned up)

* cleanup from excising test-granules-get

* linter fixes

* put test accidentally removed

* need to check unreleased syntax

* changelog for unit tests

* bringing in changes from latest master

* pulling over tests from latest master

* bring granules tests inline with es removal changes

* remove uncertain test retry

* getWorfklowNameIntersectFromGranuleIds sorts in js to avoid timestamp batch

* testing consistency of behavior across time collisions and single/multi granule

* linter fixes

* remove onlys

* postgres returns timestamp as min

* min only on numberOfGranules === 1

* semicolon
)

* add missing quote update moment version

* Update changelog

* update pg version

* remove hoex
* Fix isThrottlingException function to check error name

* update changelog and add name/code check in errors

* linter fix

* changelog

* typo fix

---------

Co-authored-by: Hailiang Zhang <hailiang.zhang@nasa.gov>
Co-authored-by: etcart <amberhosen@gmail.com>
…s_table (#3805)

Co-authored-by: etcart <amberhosen@gmail.com>
* Update deployment templates for Aurora Serverless v2 (#3623)

* update CL

* update terraform templates to serverless v2

* add terraform variable validation

* remove upgrade variables

* add prevent_destroy = true

* add prevent_destroy = true

* CUMULUS-3670 Develop upgrade/migration process Aurora Serverless v1 to v2 (#3643)

* remove prevent_destroy to allow automated CI migrations

* set force_ssl = 0 (#3658)

Co-authored-by: Tim Clark <tim.clark@nasa.gov>

* [CUMULUS-3671]: Update docs for Serverless V2 (#3666)

* initial commit

* serverless v2 doc updates

* Update serverless V2 docs

* Fix lint issue

* set DISABLE_PG_SSL: true to support CI

* fix lint error

* set disableSSL = true

* remove DISABLE_PG_SSL

* set rejectUnauthorized: 'false'

* update CL for v2 changes

* fix changelog

* add migration notes to changelog, add v2 docs to sidebar

* fix changelog

---------

Co-authored-by: Tim Clark <tim.clark@nasa.gov>
Co-authored-by: Nate Pauzenga <npauzenga@gmail.com>
)

* Update AWS errors to use the V3 error classes

* Fix lint

* Import aws sdk directly to avoid circular dep

* Update CL

* Remove module in favor of aws imports directly

* Revert change to ThrottlingException error type

* Add comments

* Fix lint

* Remove unnecessary dependency

* add debug logging for CI

* update type and debug comment

* temporarily revert to name checks

* Remove logging and type check on conditional exception.

Instance of does not work in this case. I believe we're calling the service "dynamodbDocClient" using the non-V3 syntax.

* Fix lint

* Update tests to throw correct aws-sdk error

* Update tests with new aws-sdk error types

* Import error type correctly

* Correctly import sfn error

* Instantiate errors like I know what I'm doing

* Basic syntax 🤦

* update tests

* Remove unnecessary comment

* fixup for clarity

* Update test for clarity

* Update test fixture and logging for consistency
* Allow override of sfEventSqsLambda timeout with associated queue adjustments

* Update CHANGELOG

* Respond to PR feedback

* Update per PR feedback request
* CUMULUS-3906 - Update to ORCA v10.0.0

* Resolved CL conflict.

* Removes required wording for 3906 from CL
* Fixes merge conflict

* Adds diff link for v18.5.0
…e-granules-cmr-metadata-… (#3791)

* Added excludeFileRegex configuration to update-granules-cmr-metadata-file-links (#3790)

Updated tests to exercise new file-exclusion feature

* linter fixes

* remove explicit null for un-found regexpattern

* switch to logging when no excludable files found

* changelog broken into multiple lines

* linter fixes in changelog

* name in changelog after lambda function name

* remove TODO. non-mocked is a truer representation of function

* small refactor

* typo in passthrough of fileregex

* nyc values with new tests

* version requirement update

* fixed merge weirdness

* fix jsonpath in the other places it's flagged

* remove unneeded explicit pin in aws-client

* check like instead of deepequal on credentials return

---------

Co-authored-by: Mike Dorfman <42116953+mikedorfman@users.noreply.github.com>
* Fix cumulus versions due to bad merge

* Update aws-sdk versions to revert bad merge
* update dependencies to latest cma, cma-python, cumulus-process

* changelog

* fixed shas in locks

* whitelist jsonpath for buiggy audit behavior

* remove incorrect changelog entry

---------

Co-authored-by: etcart <amberhosen@gmail.com>
* CUMULUS-3891: Add fastGet download option to sftp data file download

* add sftpFastDownload config

* fix fastDownload boolean vs string

* add unit tests

* fix aws-client services unit test

* test SFTP_DEBUG

* remove only

* add changelog entry

* remove unused code

* remove jsonpath from common

* update latest-version and add jsonpath-plus to audit-ci

* serial

* update readme remove serial

* add sftp test
…3830)

* Update Orca version

* Update orca variables for v10 release series

* Update orca var to default value

* Update Orca version to official release
…ync-granules (#3823)

* Iniital commit updating sync-granule behavior

* Clean up comments

* Update schema config to match changes

* Update typings

* Fix sync-granules typing

* Update config docs to true

* Update task README

* Update CHANGELOG

* Minor fix

* Update spec tests with new default hashed granId path

* Update @cumulus/types to allow for explicit export of api/collections

* Abstract typings to seperate file

* Update _ingestGranule param based on PR feedback

* Fix unit test not updated on merge

* Add method unit tests for collection(name/version)From methods

* Fix integration helper

* Add hashed path to SyncGranules
…zed (#3832)

* CUMULUS-3919:Added terraform variables disableSsl and rejectUnauthorized

* disableSsl->disableSSL
…s services. (#3838)

* Allowing force_new_deployment to be configurable for ecs services.

* Update CHANGELOG

---------

Co-authored-by: Michael Hall <mlh0079@uah.edu>
* guarantee non-numeric nonNumericString

* bringing in pg8.13 snyk suggestion

* trying to kcik up the sync-granules task error

* trying to get repeatable tries to sync-granules

* focus on just the important part in syncgranule

* trying to get publish to work

* does only this need to change to import?

* move to import function import

* reverting bad code for testing reasons

* changelog

* keep string length the same, no reason to twiddle this
* Release 19.1.0 (#3816)

* version bump

* Update CL

* Update docs

* Update CL link

* Add note for clarity

* update missed deps

* Ecarton/cumulus 3928 imf work (#3831) (#3841)

* guarantee non-numeric nonNumericString

* bringing in pg8.13 snyk suggestion

* trying to kcik up the sync-granules task error

* trying to get repeatable tries to sync-granules

* focus on just the important part in syncgranule

* trying to get publish to work

* does only this need to change to import?

* move to import function import

* reverting bad code for testing reasons

* changelog

* keep string length the same, no reason to twiddle this

Co-authored-by: etcart <37375117+etcart@users.noreply.github.com>

* fix no top level await (#3843) (#3844)

Co-authored-by: etcart <37375117+etcart@users.noreply.github.com>

---------

Co-authored-by: etcart <37375117+etcart@users.noreply.github.com>
* Update CHANGELOG from release 18.5.1

* Add CHANGELOG footer

* Fix CHANGELOG
.eslintignore Outdated
@@ -36,3 +36,5 @@ _book/**
/packages/object-store/*.js
/packages/lzards-api-client/*.d.ts
/packages/lzards-api-client/*.js
/tasks/move-granule-collections/*.js
/tasks/move-granule-collections/*.d.ts
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these necessary? I don't see other tasks written in typescripts listed here, e.g. tasks/lzards-backup

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, I'm removin them, these were necessary beofre I moved my compilation products to a dist directory

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CHANGELOG.md Outdated Show resolved Hide resolved
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this workflow definition? Then it should only have definition, e.g. "event.$": "$", not any example data.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dacde25
fixed (this commit actually introduces a different mistake that's fixed here)
d46049b

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we will have a new endpoint to invoke this workflow, then the workflow should be included as cumulus core tf-modules/ingest or archive. So the users don't need to copy these two their cumulus-tf deployment.
But if the granules applyWorkflow works, then it can be a custom workflow.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as I had envisioned this this was sort of an "example workflow" but if the intention is that this is called by API and does a fairly standard thing, I'll try to move it to tf-modules. I think in principle it should be configurable from existing variables (e.g. prefix) without needing someone to rejigger anything custom.


const getTargetFiles = (targetUrlPrefix) => [
{
bucket: 'cumulus-test-sandbox-protected',
Copy link
Contributor

@jennyhliu jennyhliu Jan 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The buckets are hardcoded and won't work for all stacks.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

finalFiles = getTargetFiles(targetUrlPrefix);
//upload to cumulus
try {
await setupInitialState(stackName, sourceUrlPrefix, targetUrlPrefix);
Copy link
Contributor

@jennyhliu jennyhliu Jan 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need a few 'real' granules which are published to CMR for integration test.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this will need to come once we are updating cmr as a part of this workflow?


const activityStep = new ActivityStep();

describe('The MoveGranuleCollection workflow using ECS', () => {
Copy link
Contributor

@jennyhliu jennyhliu Jan 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are the source and target collections? I can't tell from the specs.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are the difference between MoveGranuleCollectionWorkflowSpec and MoveGranuleCollectionsSpec?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The intent is to run movegranulecollectionsSoec as a test of the functionality of the lambda, while the workflow is meant to run the workflow as it would exist with example data, to be added to with CMR, lizards etc when those tickets are done. Right now the only functional difference is that it tests the lambda in the ECS deployment


const getSourceCollection = (sourceUrlPrefix) => (
{
files: [
Copy link
Contributor

@jennyhliu jennyhliu Jan 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be part of the collection configuration, and shouldn't need to specify here. We ingest different granules/files to s3 to avoid conflicts.

}
);

const getTargetCollection = (targetUrlPrefix) => ({
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment: This should be part of the target collection configuration

packages/api-client/src/granules.ts Show resolved Hide resolved
@@ -0,0 +1,6 @@
export interface CMRFile {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this necessary?

| ---------- | ---- | ------- | ------ | -----------

| buckets | object | (required) | | Object specifying AWS S3 buckets used by this task
| collection | object | (required) | | The cumulus-api collection object
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is 'target' collection, right? Should this be part of the task input? Since the task can be invoked to move granules to different collections.

sourceGranules: Array<ApiGranuleRecord>,
targetGranules: Array<ApiGranuleRecord>,
targetCollectionId: string
): Promise<void> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May need to reverse the order of updates. Since if granule updates fail, the collection is updated, then the granule won't be processed again.

};
}

async function buildTargetGranules(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So buildTargetGranules does not only build but also update granule metadata in s3?
Where is the metadata got removed?
I'm confused with the sequence of events.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This builds the granule records as they should exist once we're done, so that they can later be used as a roadmap for the updates in s3 and pg

@etcart
Copy link
Contributor Author

etcart commented Jan 20, 2025

I'm thinking of pulling the example ecs deployment here. it was put in place to allow for exceeding 15 minutes (and other potential resource constraints). but splitting into subsets of granule_ids should allow us to control for that, an date ecs example adds (unnecessary?) complexity to this pr

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see other tasks/* have this file

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How are we going to avoid the start of the workflow triggering the granule updates, since the input payload has granules?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants