Implement CloudWatch Log Retention Management
Fixes - #4585
This PR implements retention policy management for CloudWatch logs associated with EvalAI challenges. Currently, logs are retained indefinitely, which could lead to unnecessary costs. This implementation sets appropriate retention periods based on challenge end dates. Changes -
- Added function to calculate retention periods based on challenge end dates.
- Added function to set CloudWatch log retention policies for challenge log groups.
- Logs will be retained for 30 days after the challenge end date.
- For active challenges, logs will be retained until the end date plus 30 days.
- Retention periods are mapped to valid AWS CloudWatch values.
Reference https://boto3.amazonaws.com/v1/documentation/api/1.26.93/reference/services/logs/client/put_retention_policy.html
Sir please check these functions so that I can appropriately call them in other files.
Can you call this function when after you have created the task definition for AWS Fargate worker to update the log group?
I have called the function in challenge_approval_callback , restart_workers_signal_callback and register_task_def_by_challenge_pk.
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 69.70%. Comparing base (
96968d6) to head (19ed8c7). Report is 1177 commits behind head on master.
Additional details and impacted files
@@ Coverage Diff @@
## master #4586 +/- ##
==========================================
- Coverage 72.93% 69.70% -3.23%
==========================================
Files 83 21 -62
Lines 5368 3608 -1760
==========================================
- Hits 3915 2515 -1400
+ Misses 1453 1093 -360
see 65 files with indirect coverage changes
see 65 files with indirect coverage changes
Continue to review full report in Codecov by Sentry.
Legend - Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing dataPowered by Codecov. Last update 3ab0e40...19ed8c7. Read the comment docs.
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
- :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
@RishabhJain2018 Sir please review