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

Display task container names for ECS task state change events #175

Merged
merged 6 commits into from
Dec 11, 2024

Conversation

kathy-t
Copy link
Contributor

@kathy-t kathy-t commented Dec 9, 2024

Description
This PR displays the containers that belong to the task when an ECS task state change event is received by the lambda.

See the dockstore-deploy PR https://github.com/dockstore/dockstore-deploy/pull/816 that redirects the events to different channels depending on if it's for the webservice task or a scheduled task.

The notifications now look like this for the webservice task:

Task arn:aws:ecs:us-east-2:<account-id>:task/KathysDockstore-DockstoreEcsCluster36A20B87-GI07lGcyBwKc/0d9fe1faba344695b0ad6fa00a3a5d0d is now STOPPED
Containers: bootstrap, webservice, cloudwatch-agent, migration, nginx
startedAt: 2024-12-10T18:04:28.393Z
stoppedAt: 2024-12-10T18:09:33.907Z
stoppedReason: Task stopped by user

and the topic updater task:

Task arn:aws:ecs:us-east-2:<account-id>:task/KathysDockstore-DockstoreEcsCluster36A20B87-GI07lGcyBwKc/e2509f7f865e4a00acb1866748c2431c is now STOPPED
Containers: TopicUpdater
startedAt: 2024-12-10T18:09:59.062Z
stoppedAt: 2024-12-10T18:10:32.301Z
stoppedReason: Essential container in task exited

Issue
Implemented while doing https://ucsc-cgl.atlassian.net/browse/SEAB-6795, but technically tackles https://ucsc-cgl.atlassian.net/browse/SEAB-6746

Security
If there are any concerns that require extra attention from the security team, highlight them here.

Please make sure that you've checked the following before submitting your pull request. Thanks!

  • Ensure that the PR targets the correct branch. Check the milestone or fix version of the ticket.

@kathy-t kathy-t self-assigned this Dec 9, 2024
@@ -258,6 +258,10 @@ function ecsTaskStateChangeMessageText(message) {
const taskArn = message?.detail?.taskArn;
const lastStatus = message?.detail?.lastStatus;
let messageText = `Task ${taskArn} is now ${lastStatus}`;
const taskContainers = message?.detail?.containers
?.map((container) => container.name)
.join(", ");
Copy link
Contributor

Choose a reason for hiding this comment

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

To be robust when the containers field is missing, probably needs a ?.join so that an undefined continues to propagate.

Also, right now, if the value of containers is a scalar (which it probably never will be, but you never know), this code will throw at the map invocation. What happens when the lambda throws, are we notified? If so, probably not worth worrying about.

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 don't believe we are notified. The lambda does have a dead queue configured but I don't think we do anything with it https://github.com/dockstore/dockstore-deploy/blob/38977e218b16a73d0a29167d00f3c89bbdb09b3d/cloudwatch-to-slack.yml.template#L146-L147

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@kathy-t kathy-t requested a review from svonworl December 11, 2024 16:04
@kathy-t kathy-t merged commit 4b661e5 into hotfix/0.4.1 Dec 11, 2024
11 checks passed
@kathy-t kathy-t deleted the feature/seab-6795/container-names branch December 11, 2024 16:39
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.

4 participants