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

Initial work for v1 #268

Merged
merged 26 commits into from
May 8, 2024
Merged

Initial work for v1 #268

merged 26 commits into from
May 8, 2024

Conversation

jkeifer
Copy link
Collaborator

@jkeifer jkeifer commented May 2, 2024

This PR is all a starting point and we'll need to do more, but it includes:

  • clean up all code no longer required with the new operational paradigm
    • cirrus.cli code combed over for what is relevant to the cirrus management cli and moved there, the rest removed
    • cirrus.core code removed
    • cirrus.test module removed
  • reorganize remaining code
    • cirrus.lib2 becomes cirrus.lib
    • cirrus.builtins becomes cirrus.lambda_handlers and flattened
  • switch to pyproject.toml and pip-compile for deps
    • though I am uncertain how we should manage versions given that we do want to be able to install this package into a virtual env with pip from pypi (i.e., requirements files alone ain't going to cut it)
  • pull in cirrus-mgmt cli code and install as cirrus console script
  • docs dependency on cirrus-docs removed in favor of plain sphinx build and docs sources moved into docs/
  • I also looked for additional dead code that wasn't necessarily dead just from this work and removed it.
  • I pulled out all the backwards-compatibility code for deprecated features that I could find:
    • output_options support
    • support for the FAILED and INVALID SNS topics
    • removed InvalidInput exception in this cirrus.lib
    • legacy API support
  • I had concerns about recent changes to BatchHandler and the subclasses that were created, SNSPublisher and SQSPublisher. I took this opportunity to address those concerns.

@jkeifer
Copy link
Collaborator Author

jkeifer commented May 2, 2024

Tests currently fail because

  1. CI needs to be updated
  2. The management cli tests have not been updated per the changes to that component

I do not know if I will be able to finish the cli updates for a new config format nor fix the tests. One potential blocker is not having a new deployment to test against, which means if I do work on this I don't know if I'll derive the correct config file format. But I'll see if I can get that in.

@jkeifer
Copy link
Collaborator Author

jkeifer commented May 3, 2024

I want to question if we should also remove support for non-array process values, as we did in swoop... This seems like a great opportunity to do it.

Copy link

codecov bot commented May 3, 2024

Codecov Report

Attention: Patch coverage is 66.09195% with 295 lines in your changes are missing coverage. Please review.

Project coverage is 77.30%. Comparing base (8f82df5) to head (ac1d243).

Files Patch % Lines
src/cirrus/management/deployment.py 33.91% 113 Missing ⚠️
src/cirrus/management/commands/manage.py 65.03% 50 Missing ⚠️
src/cirrus/management/deployment_pointer.py 57.14% 30 Missing ⚠️
src/cirrus/management/utils/click.py 42.10% 22 Missing ⚠️
src/cirrus/lib/eventdb.py 81.15% 13 Missing ⚠️
src/cirrus/management/commands/payload.py 64.00% 9 Missing ⚠️
src/cirrus/lib/process_payload.py 79.48% 8 Missing ⚠️
src/cirrus/lambda_functions/api.py 75.86% 7 Missing ⚠️
src/cirrus/lib/statedb.py 84.78% 7 Missing ⚠️
src/cirrus/management/utils/templating.py 0.00% 7 Missing ⚠️
... and 10 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #268      +/-   ##
==========================================
- Coverage   82.95%   77.30%   -5.65%     
==========================================
  Files          57       26      -31     
  Lines        3033     1855    -1178     
==========================================
- Hits         2516     1434    -1082     
+ Misses        517      421      -96     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jkeifer
Copy link
Collaborator Author

jkeifer commented May 3, 2024

Tests are fixed. I am explicitly ignoring failures on the management tests right now.

@jkeifer jkeifer marked this pull request as ready for review May 4, 2024 00:58
@ircwaves
Copy link
Member

ircwaves commented May 6, 2024

@jkeifer says:

I want to question if we should also remove support for non-array process values, as we did in swoop... This seems like a great opportunity to do it.

Not privy to the motivations in swoop, but that is a pattern which I have seen some developers confused by, returning a list that is usually empty or 1 member. I was implored to change it to a -> Item | None, with some rational that it was more idiomatic. That said, I was never that upset by for result in process(): in my code. So, some sort of note that emphasizes that use-cases for list-of-results might be warranted.

@philvarner
Copy link
Contributor

Maybe lambda_handlers should be named lambda_functions?

@philvarner
Copy link
Contributor

wrt to deps, I think it's reasonable to have exact pinned deps, since this is the key dependency for the projects that use it

@philvarner
Copy link
Contributor

why "requirements files alone ain't going to cut it"?

@jkeifer
Copy link
Collaborator Author

jkeifer commented May 6, 2024

@jkeifer says:

I want to question if we should also remove support for non-array process values, as we did in swoop... This seems like a great opportunity to do it.

Not privy to the motivations in swoop, but that is a pattern which I have seen some developers confused by, returning a list that is usually empty or 1 member. I was implored to change it to a -> Item | None, with some rational that it was more idiomatic. That said, I was never that upset by for result in process(): in my code. So, some sort of note that emphasizes that use-cases for list-of-results might be warranted.

@ircwaves I'm confused by your response and the mention of items/results. I am speaking about the process payload format, which supports an array of process definitions for workflow chaining. That is, the payload format is, roughly,

{
    "type": "FeatureCollection",
    "features": [Items],
    "process": ProcessDef | [ProcessDef],
}

What I'm proposing here is that we make process just [ProcessDef] rather than supporting the single process definition case without an array. As to why we went with that in swoop, it was to simplify the payload format by enforcing the consistency, which also reduces the test cases we have to be concerned about.

@jkeifer
Copy link
Collaborator Author

jkeifer commented May 6, 2024

@philvarner

why "requirements files alone ain't going to cut it"?

Unless you know something I don't, to enable this to package to be pip-installable with the dependency pinning described in requirements.txt we have to have that pinning in pyproject.toml to have it be part of the package metadata.

@philvarner
Copy link
Contributor

@philvarner

why "requirements files alone ain't going to cut it"?

Unless you know something I don't, to enable this to package to be pip-installable with the dependency pinning described in requirements.txt we have to have that pinning in pyproject.toml to have it be part of the package metadata.

Oh, I see what you're saying now.

if not result:
continue
if not combined_results:
combined_results = result
Copy link
Contributor

Choose a reason for hiding this comment

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

should this break? If not, I think it would be better if there was a check above to see if combined_results is set and rs is non-empty and then pop the last one.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I don't know, I did what I thought would preserve the existing behavior as best as I could reason about while also supporting the case where we have Nones passed in to satisfy type checking. Maybe the whole thing deserves a bit more consideration. It might be better to throw an exception rather than returning None so we can avoid this case altogether.

@ircwaves
Copy link
Member

ircwaves commented May 6, 2024

confused by your response and the mention of items/results. I am speaking about the process payload format, which supports an array of process definitions for workflow chaining.

Ah, I see, I was thinking of the process function in a task. Process entry in a payload being an array of ProcessDefinitions makes sense.

@jkeifer
Copy link
Collaborator Author

jkeifer commented May 7, 2024

I rebased the changes on top of main to resolve the merge conflicts. I also renamed the lambda_handlers package to lambda_functions as suggested, and removed support for non-array process values.

Pyproject.toml supports loading metadata values from files. We can
leverage this to use pip-compile with .in files to generate requirements
files that also populate the package metadata. This gives us a way pin
all our dependencies (direct and transitive) strictly even when
installing from a remote package with no direct access to the
requirements files.
@jkeifer
Copy link
Collaborator Author

jkeifer commented May 7, 2024

I talked with @gadomski and he pointed me to a solution for the dependency concern I raised. In short, we can use dynamic metadata to load dependency lists from requirements files. This means we specify the direct dependencies in *.in files and the pip-compile workflow will generate requirements files that end up populating the dependency lists in the package metadata.

I also took a super quick pass through the README and remove all obviously out-of-date content. It will need further revisions but at least isn't completely erroneous.

Reverts the changes to the API functions to handle null responses from
eventdb queries (which were added to appease type checking), with some
further simplifications. The _query method on EventDB will now raise an
exception if called when events are disabled. This is explicitly handled
in the API and ignored.
@jkeifer
Copy link
Collaborator Author

jkeifer commented May 8, 2024

@philvarner I made the changes we discussed to the API/EventDB stuff. See the most recent commit for the specific changes.

@jkeifer jkeifer merged commit f905104 into main May 8, 2024
2 of 4 checks passed
@jkeifer jkeifer deleted the jak/cleanup branch May 8, 2024 21: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.

None yet

3 participants