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

CUMULUS-359 kinesis consumer users sf-scheduler #262

Conversation

abarciauskas-bgse
Copy link
Contributor

@abarciauskas-bgse abarciauskas-bgse commented Mar 16, 2018

Summary: Kinesis consumer users sf-scheduler

Kinesis Consumer's invocation of Rule.buildPayload uses the values of provider and collection in the the kinesis rule. The kinesis rule values for collection and provider are in the payload sent to sfScheduler#schedule. So the provider (the string id) and collection object (name and version object), that are stored in the rule are used to look up the provider and collection objects stored in dynamo. The full dynamodb data is what is set as the cumulus message's $.meta.provider and $.meta.collection. This is important because downstream tasks, such as sync granule, require the provider and collection data.

Addresses CUMULUS-359

Detailed Changes

  • kinesis consumer now calls sf-scheduler function schedule
  • updated tests
  • kinesis consumer lambda now requires env variables for the collections and providers table used in sf-scheduler#schedule
  • (unrelated) fixes eslint errors in packages/api/lambdas

Test Plan

Things that should succeed before merging.

  • Unit tests
  • Adhoc testing
    Created a stream, provider, collection and kinesis rule for HelloWorldWorkflow. Important that the kinesis rule has correct provider and collection information. Put a record on the stream for the collection. Verified hello world workflow had started and the payload includes the collection and provider data in the meta and the entire kinesis record in the payload.
  • Update CHANGELOG
  • Run ./bin/eslint-ratchet and verify that eslint errors have not increased
  • Commit .eslint-ratchet-high-water-mark if the score has improved

collection: { name: 'test-collection' },
payload: { test: 'test payload' }
};
test('the queue receives a correctly formatted workflow message', async(t) => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since we removed queueWorkflowMessage this is being repurposed to test enqueueGranuleIngestMessage

Copy link
Contributor

@laurenfrederick laurenfrederick left a comment

Choose a reason for hiding this comment

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

Minor comments

));
))
.catch((err) => {
console.log('Caught error in process record:');
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of console.log, this should use the logger i.e. log.error

* @param {function} cb lambda callback
* @param {Object} event - lambda input message
* @param {Object} context - lambda context
* @param {function} cb - lambda callback
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add a returns to this one please?

CHANGELOG.md Outdated
- Pass encrypted password to the ApiGranule Lambda function [CUMULUS-424]
- `@cumulus/api`: `kinesis-consumer.js` uses `sf-scheduler.js#schedule` instead of placing a message directly on the `startSF` SQS queue. This is a fix for [CUMULUS-359](https://bugs.earthdata.nasa.gov/browse/CUMULUS-359) because `sf-scheduler.js#schedule` looks up the provider and collection data in DynamoDB and adds it to the `meta` object of the enqueued message payload.
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be in the unreleased section

@abarciauskas-bgse abarciauskas-bgse merged commit 566a429 into master Mar 19, 2018
@scisco scisco deleted the abarciauskas-bgse_CUMULUS-359-kinesis-consumer-uses-sfscheduler branch March 27, 2018 20:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants