-
Notifications
You must be signed in to change notification settings - Fork 108
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-3847: Remove any remaining ES indexing functions and tests #3897
base: feature/es-phase-2
Are you sure you want to change the base?
Conversation
…loud Metrics usage
packages/api/tests/lambdas/sf-event-sqs-to-db-records/test-write-pdr.js
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can rename this file with different extension since we still want cleanExecution
functionality, and will be updated in a different ticket.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggest to comment out the code, and put a dummy handler, so the lambda can still be created in tf-modules/archive/clean_executions.tf
@@ -188,6 +188,7 @@ test('ec2() service defaults to localstack in test mode', async (t) => { | |||
); | |||
}); | |||
|
|||
// can this test be removed or is it needed for the granule CloudMetrics queries? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With es instance going away, I think packages/aws-client/tests/services.js es and this test are not needed.
@@ -49,7 +49,7 @@ const esSearchStub = sandbox.stub(); | |||
const esScrollStub = sandbox.stub(); | |||
FakeEsClient.prototype.scroll = esScrollStub; | |||
FakeEsClient.prototype.search = esSearchStub; | |||
|
|||
// is this es-client stuff still needed b/c granules and metrics? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think es-client is still needed. You can try to take it out.
…d of full removal
@@ -92,6 +92,8 @@ External tooling making use of `searchContext` in the `GET` `/granules/` endpoin | |||
- Updated `@cumulus/api/bin/serveUtils` to no longer add records to ElasticSearch | |||
- Removed ElasticSearch from local API server code | |||
- Updated CollectionSearch to filter granule fields in addition to time frame for active collections | |||
- **CUMULUS-3847** | |||
- list changes here |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
placeholder, I'm still making sure I've captured everything. will make sure this is filled out when I'm fairly certain
@@ -94,7 +94,7 @@ async function applyWorkflowToGranules({ | |||
* @param {number} [payload.concurrency] | |||
* granule concurrency for the bulk deletion operation. Defaults to 10 | |||
* @param {Object} [payload.query] - Optional parameter of query to send to ES | |||
* @param {string} [payload.index] - Optional parameter of ES index to query. | |||
* @param {string} [payload.index] - Optional parameter of ES index (metrics) to query. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Meaning we're checking the Cloud Metrics ES index?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, my understanding of why we need to keep the ES related functionality is that for some of the granules and bulk operations it will still query Cloud Metrics for data. I don't feel like totally understand how it all ties together, but that is what is mentioned in code and what I was informed of. So I thought it would be helpful to clarify as much as possible that the ES indexing and querying is going to Cloud Metrics and that's why it is staying around and not being removed as part of ES removal.
const Logger = require('@cumulus/logger'); | ||
const { sleep } = require('@cumulus/common'); | ||
// const { sleep } = require('@cumulus/common'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should avoid having commented-out code generally. We can rely on the git diff if we need to reference what was here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hah. Well, I completely removed the lambda and test, and @jennyhliu suggested that I add them back and comment out except for a dummy handler. So I'm open to suggestions on why one method is better than the other...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(see comment at top of file)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we remove lambda and test here, we have to remove the related tf code, that's why I suggested to have dummy handler since we want to keep the lambda with RDS implementation.
Now I think we can delete the code and leave only the dummy handler.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I can remove the commented code, if everyone is in agreement there.
What about the test file, should I remove the file altogether? Or if not, what should I leave in the file if not commented out tests?
packages/api/lib/testUtils.js
Outdated
@@ -620,20 +620,14 @@ const createAsyncOperationTestRecords = async (context) => { | |||
}; | |||
}; | |||
|
|||
// this doesn't look like it's being used anywhere, should I remove it? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it's not used, I'd say yes. It's an exported member so technically (possibly) a user-facing change for those using this package but... it's only test utils.
@@ -61,7 +61,7 @@ test.before(async (t) => { | |||
t.context.functionConfig = { | |||
Environment: { | |||
Variables: { | |||
ES_HOST: 'es-host', | |||
Timeout: 300, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's this for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we're moving away from ES in general, ES indexing and all that, in the async operations tests I've changed all the places we're referencing ES operations to other options in those enums. Since we should probably be doing operations other than ES ones if ES is going away.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So just as I changed the operationType
s away from ES Index, I'm trying to move away from the ES_HOST
. I wanted to keep a variable in here and found that Timeout could be one that is used.
@@ -357,7 +357,7 @@ test('getLambdaEnvironmentVariables returns expected environment variables', (t) | |||
const vars = getLambdaEnvironmentVariables(t.context.functionConfig); | |||
|
|||
t.deepEqual(new Set(vars), new Set([ | |||
{ name: 'ES_HOST', value: 'es-host' }, | |||
{ name: 'Timeout', value: 300 }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above, why this change?
@@ -15,8 +15,6 @@ resource "aws_lambda_function" "create_reconciliation_report" { | |||
CMR_HOST = var.cmr_custom_host | |||
DISTRIBUTION_ENDPOINT = var.distribution_url | |||
ES_HOST = var.elasticsearch_hostname |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about ES_HOST?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So I removed these two variables in reference to the comment at the very end of packages/api/lambdas/create-reconciliation-report.js, where I also removed them from logging.
I will be writing a ticket to remove ES from all the other terraform files where they're not needed (minus Cloud Metrics) so I thought this should be part of that removal.
…loud Metrics usage
Summary: Summary of changes
Addresses CUMULUS-3847: Remove any remaining ES indexing functions and tests
Changes
PR Checklist