Skip to content

feat: adds script for codeocean cleanup notification#50

Merged
yosefmaru merged 8 commits into
mainfrom
feat-codeocean-cleanup-notification
Feb 27, 2026
Merged

feat: adds script for codeocean cleanup notification#50
yosefmaru merged 8 commits into
mainfrom
feat-codeocean-cleanup-notification

Conversation

@yosefmaru

@yosefmaru yosefmaru commented Feb 20, 2026

Copy link
Copy Markdown
Member

Fixes https://github.com/AllenNeuralDynamics/aind-aws-infrastructure/issues/433

  • Adds a script that:
    • Parses a csv file that contains user emails and capsule_urls
    • Parses a text/plain file that contains exclude lists (user email and/or capsule urls)
    • sends a post request to webhook in powerautomate flow.

@helen-m-lin helen-m-lin left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Left some minor comments. Could you please link the related issue? I'm a little unclear about how this will integrate- who is going to create the csv file and exclude list?

Comment thread tests/test_trigger_co_cleanup_notification.py Outdated
Comment thread tests/test_trigger_co_cleanup_notification.py Outdated
Comment thread tests/test_trigger_co_cleanup_notification.py Outdated
Comment thread tests/test_trigger_co_cleanup_notification.py Outdated
Comment thread tests/test_trigger_co_cleanup_notification.py Outdated
Comment thread src/aind_data_upload_utils/trigger_co_cleanup_notification.py

@helen-m-lin helen-m-lin left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Changes to read from S3 look good. Added comments for unit test, but if this takes too much time to update, maybe those can be addressed in a separate ticket.

self.example_job._is_s3_uri("/local/path/file.csv")
)
self.assertFalse(self.example_job._is_s3_uri("file.csv"))
# Test _parse_s3_uri method

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

nit: each unit test should only test 1 method. Ideally split this up into test_is_s3_uri and test_parse_s3_uri

with self.assertLogs(level="DEBUG") as captured:
exclude_items = self.example_job.read_exclude_list()
self.assertIsInstance(exclude_items, set)
self.assertIn("user2@example.com", exclude_items)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Should also assert the capsule. Maybe replace with self.assertEquals(["user2@example.com", "https://codeocean.com/capsule/12345"], exclude_items)

Similar comment for some of the other tests.

csv_data = self.example_job.read_csv_file()
self.assertIsInstance(csv_data, list)
self.assertEqual(len(csv_data), 4)
for row in csv_data:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

nit: This only checks the fieldnames. I'd suggest assertEqual the entire csv_data

@helen-m-lin

Copy link
Copy Markdown

Actually, before merging, can you run isort?

@yosefmaru yosefmaru merged commit db4b35e into main Feb 27, 2026
1 check passed
@yosefmaru yosefmaru deleted the feat-codeocean-cleanup-notification branch February 27, 2026 00:27
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.

2 participants