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

[Issue #2351, #2472] Migrate to platforms step function pattern #2506

Merged
merged 7 commits into from
Oct 17, 2024

Conversation

coilysiren
Copy link
Collaborator

@coilysiren coilysiren commented Oct 17, 2024

Summary

Relates to: #2351, #2472

Time to review: 5 mins

Changes proposed

There are two goals to this PR:

  1. Make a material change that gets us closer in line with the platform. Specifically we are pulling in Add scheduled jobs navapbc/template-infra#745
  2. Updates the step functions in advance of adding another step function - for the terraform in ECS stuff

Context for reviewers

The majority of the diff is security related, specifically:

  • via guidance from @lorenyu, the permissions for managing the step function and workflow triggers were moved off of the task exec role. that's the diff on infra/modules/service/access-control.tf
  • those permissions were moved to infra/modules/service/scheduler_role.tf and infra/modules/service/workflow_orchestrator_role.tf

The rest of the diff is around easy of configuration:

  • infra/modules/service/scheduled_jobs.tf represents the new, highly configurable, way to create scheduled jobs
  • infra/api/app-config/env-config/scheduled_jobs.tf shows how two scheduled jobs are configured

Additional information

image image

@coilysiren coilysiren marked this pull request as ready for review October 17, 2024 05:37
@coilysiren coilysiren requested a review from chouinar October 17, 2024 05:37
Comment on lines 42 to 45
copy-oracle-data = {
task_command = ["poetry", "run", "flask", "data-migration", "copy-oracle-data"]
schedule_expression = "rate(2 minutes)"
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@chouinar fancy new simple way to setup scheduled jobs

Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks, this is simple enough that I can set things up / not bother you for any adjustments we make.

scheduled_jobs = {
copy-oracle-data = {
task_command = ["poetry", "run", "flask", "data-migration", "copy-oracle-data"]
schedule_expression = "rate(2 minutes)"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we include enabled/disabled here too, or does a null schedule or something like that cause the job to just not run? Just thinking there may be times we want to keep the job from running, but not delete it from here entirely.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Heh, I believe I had this same question in the original PR.

I think it's a good idea, so I'm gonna add it

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Added! 1ba3d06

mdragon
mdragon previously approved these changes Oct 17, 2024
Copy link
Collaborator

@mdragon mdragon left a comment

Choose a reason for hiding this comment

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

Approving as is. If we do want to facilitate pausing jobs via config as suggested in the comments, I'm happy to have that come in a future ticket.

@coilysiren coilysiren merged commit 1277e32 into main Oct 17, 2024
7 checks passed
@coilysiren coilysiren deleted the kai/sfns branch October 17, 2024 17:42
doug-s-nava pushed a commit that referenced this pull request Oct 18, 2024
## Summary

Relates to: #2351, #2472

### Time to review: __5 mins__

## Changes proposed

There are two goals to this PR:

1. Make a material change that gets us closer in line with the platform.
Specifically we are pulling in
navapbc/template-infra#745
2. Updates the step functions in advance of adding another step function
- for the terraform in ECS stuff

## Context for reviewers

The majority of the diff is security related, specifically: 

- via guidance from @lorenyu, the permissions for managing the step
function and workflow triggers were moved off of the task exec role.
that's the diff on `infra/modules/service/access-control.tf`
- those permissions were moved to
`infra/modules/service/scheduler_role.tf` and
`infra/modules/service/workflow_orchestrator_role.tf`

The rest of the diff is around easy of configuration:

- `infra/modules/service/scheduled_jobs.tf` represents the new, highly
configurable, way to create scheduled jobs
- `infra/api/app-config/env-config/scheduled_jobs.tf` shows how two
scheduled jobs are configured

## Additional information

<img width="1238" alt="image"
src="https://github.com/user-attachments/assets/24e6e50e-74b0-4cf8-b61b-bad34af90118">

<img width="1237" alt="image"
src="https://github.com/user-attachments/assets/aa297341-8d7d-4ac7-bcc9-ef102df25e05">
coilysiren added a commit that referenced this pull request Oct 30, 2024
## Summary

Relates to #2548

### Time to review: __2 mins__

## Changes proposed

Swaps the analytics application to the new step functions pattern that I
originally merged in
#2506. The size of the red
diff and the simplicity of the new configuration show have valuable the
new pattern is.

## Context for reviewers

The step function is now running, but the CLI itself is currently
broken. eg. the CLI is currently broken everywhere, even locally. Fixing
that is someone else's job though!
DavidDudas-Intuitial added a commit that referenced this pull request Nov 7, 2024
## Summary
Fixes #2665 

### Time to review: __1 min__

## Changes proposed
> What was added, updated, or removed in this PR.

Added `gh-transform-and-load` command to existing `make gh-data-export`
command. I'm not sure if this is sufficient or correct, but I'm taking a
guess based on what I see in
#2546 and
#2506.

## Context for reviewers
> Testing instructions, background context, more in-depth details of the
implementation, and anything else you'd like to call out or ask
reviewers. Explain how the changes were verified.

In the analytics work stream, we have a new CLI command `make
gh-transform-and-load` for transforming and loading (some) GitHub data.
Per issue #2665, that command should be run daily, after the existing
`gh-data-export` command which exports data from Github.

I see that `scheduled_jobs.tf` seems to be the mechanism by which `make
gh-data-export` runs daily. In this PR I'm taking and educated guess and
attempting to add `gh-transform-and-load` to the existing job, and
requesting feedback from @coilysiren as to whether this is the correct
approach.

## Additional information
> Screenshots, GIF demos, code examples or output to help show the
changes working as expected.

Co-authored-by: kai [they] <[email protected]>
babebe pushed a commit that referenced this pull request Nov 7, 2024
## Summary
Fixes #2665 

### Time to review: __1 min__

## Changes proposed
> What was added, updated, or removed in this PR.

Added `gh-transform-and-load` command to existing `make gh-data-export`
command. I'm not sure if this is sufficient or correct, but I'm taking a
guess based on what I see in
#2546 and
#2506.

## Context for reviewers
> Testing instructions, background context, more in-depth details of the
implementation, and anything else you'd like to call out or ask
reviewers. Explain how the changes were verified.

In the analytics work stream, we have a new CLI command `make
gh-transform-and-load` for transforming and loading (some) GitHub data.
Per issue #2665, that command should be run daily, after the existing
`gh-data-export` command which exports data from Github.

I see that `scheduled_jobs.tf` seems to be the mechanism by which `make
gh-data-export` runs daily. In this PR I'm taking and educated guess and
attempting to add `gh-transform-and-load` to the existing job, and
requesting feedback from @coilysiren as to whether this is the correct
approach.

## Additional information
> Screenshots, GIF demos, code examples or output to help show the
changes working as expected.

Co-authored-by: kai [they] <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants