Skip to content

Conversation

@adtisdal-ASDC
Copy link
Contributor

Summary: Summary of changes

Addresses CUMULUS-4471: Coreify PDR Cleanup task

Changes

  • Add and adjusts ASDC's pdr-cleanup task to fit into cumulus core

PR Checklist

  • Update CHANGELOG
  • Unit tests
  • Ad-hoc testing - Deploy changes and test manually
  • Integration tests

📝 Note:
For most pull requests, please Squash and merge to maintain a clean and readable commit history.

@adtisdal-ASDC adtisdal-ASDC force-pushed the adtisdal/CUMULUS-4427-add-pdr-cleanup branch from c5a1bfc to 92fec12 Compare January 21, 2026 16:17
Copy link
Contributor

@reweeden reweeden left a comment

Choose a reason for hiding this comment

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

Looks pretty good! Just some ideas / food for thought mostly about best practice things that we might want to standardize...

Comment on lines +19 to +24
cp ./src/*/*.py ./dist/
cp -r ./schemas ./dist/

cd ./dist || exit 1

node ../../../bin/zip.js lambda.zip $(ls | grep -v lambda.zip)
Copy link
Contributor

Choose a reason for hiding this comment

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

I ran into having to make the same modifications to this script. @paulpilone and I talked about possibly moving it to the top level bin folder so it doesn't need to be copy/pasted for every task. The thing I'm concerned with is slight drift between all the different versions over time.

source_code_hash = filebase64sha256("${path.module}/../dist/lambda.zip")
handler = "pdr_cleanup.handler"
role = var.lambda_processing_role_arn
runtime = "python3.13"
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe our python version is 3.12. Are we trying to keep all the tasks on the same version?

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 downgraded to 3.12 to keep things consistent

Copy link
Contributor

Choose a reason for hiding this comment

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

Should we be calling this task.py? I think in the best practices example there is a task.py and it makes sense to me for the 'entrypoint' (lambda handler) to always be in a file with the same name for all the tasks, but I'm not sure if that was actually the intention, so just an idea for discussion here.

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 wasn't sure if task.py was a filler name or not

Comment on lines 19 to 20
event (dict): A lambda event object
context (dict): An AWS Lambda context
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm also wondering about the docstring convention here. I think I ended up using the :param event: blah... convention (which I'm forgetting what it's called). I think it would be nice to pick one and have it be consistent across our python code.

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 have an opinion on the docstring stuff. Which ever one we pick I'll switch to!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@bhazuka Do you have a preference?

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't have a preference. Honestly, I generally just look for a quick summary of what the class or function is for and rely on typing for input/output unless there is something not readily intuitive.

I would say stay to a standard if you want to add params, etc. Either go with the google style guide for comments/docstings, numpy styling, or reStructuredText Docstring that looks like this

def add_numbers(x: int, y: int) -> int:
    """Returns the sum of two integers.

    :param x: The first integer.
    :type x: int
    :param y: The second integer.
    :type y: int
    :returns: The sum of the two integers.
    :rtype: int
    :raises ValueError: if x or y is not an integer.
    """
    if not isinstance(x, int) or not isinstance(y, int):
        raise ValueError("x and y must be integers")
    return x + y

Whatever you guys want to choose, let me know and I will update the best practices.

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 switched it over to the reStructuredText so they should be consistent now


try:
s3_client.delete_object(Bucket=provider["host"], Key=src_path)
logger.info(f"DELETED: {provider['host']}/{src_path}")
Copy link
Contributor

Choose a reason for hiding this comment

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

How do we feel about using format strings in logger calls? I thought usually the linter complains about this, but I guess it's not in the default lints or the lints we turned on.

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'm open to switching to an alternative

Copy link
Contributor

Choose a reason for hiding this comment

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

I've been using the '%' style formatting built in to the logging lib https://docs.astral.sh/ruff/rules/logging-f-string/

Copy link
Contributor

Choose a reason for hiding this comment

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

We could consider turning on some additional relevant lints

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 switched formats and I added in the check here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

actually nvm I removed the lint (kept the format changes) since there's a few other places outside this PR we'd have to update the logging statements

@adtisdal-ASDC adtisdal-ASDC force-pushed the adtisdal/CUMULUS-4427-add-pdr-cleanup branch 2 times, most recently from b01c24c to 2c11757 Compare January 29, 2026 20:28
@adtisdal-ASDC adtisdal-ASDC force-pushed the adtisdal/CUMULUS-4427-add-pdr-cleanup branch from 2c11757 to 7b995e6 Compare January 29, 2026 22:45
@adtisdal-ASDC adtisdal-ASDC marked this pull request as ready for review January 30, 2026 19:32
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