AF3 Astro Executor support for deployment create / update#1854
Conversation
aeb5076 to
cc6e6a2
Compare
9ebac35 to
8e471a4
Compare
| // check if deployment is using Airflow 3 by validating runtime version | ||
| isAirflow3 := airflowversions.IsAirflow3(deploymentFromFile.Deployment.Configuration.RunTimeVersion) | ||
| if !isValidExecutor(deploymentFromFile.Deployment.Configuration.Executor, isAirflow3) { |
There was a problem hiding this comment.
hmm, I think it would be nicer if you could pass deploymentFromFile.Deployment.Configuration.RunTimeVersion instead of isAirflow3 to the isValidExecutor, from looking at just the call.
| // check if deployment is using Airflow 3 by validating runtime version | |
| isAirflow3 := airflowversions.IsAirflow3(deploymentFromFile.Deployment.Configuration.RunTimeVersion) | |
| if !isValidExecutor(deploymentFromFile.Deployment.Configuration.Executor, isAirflow3) { | |
| if !isValidExecutor(deploymentFromFile.Deployment.Configuration.Executor, deploymentFromFile.Deployment.Configuration.RunTimeVersion) { |
..and check for airflow 3 compatibility within valid executor determination.
There was a problem hiding this comment.
@jaketf, did you revert this? Was that intentional? I'm okay with that if you think it's better.
There was a problem hiding this comment.
Ah, you changed this in cmd/cloud/deployment.go but not in this module.
this commit is just to outline explicitly the changes we need to make in the astro core platform API. It can be overwritten by regeneration once those changes are in.
f0c8617 to
793fda2
Compare
cloud/deployment/deployment.go
Outdated
| } | ||
| switch dedicatedDeploymentRequest.Executor { | ||
| case astroplatformcore.UpdateDedicatedDeploymentRequestExecutorCELERY: | ||
| case astroplatformcore.UpdateDedicatedDeploymentRequestExecutorCELERY, astroplatformcore.UpdateDedicatedDeploymentRequestExecutorASTRO: |
There was a problem hiding this comment.
I worry a bit about all these cases of "if celery or astro executor" because there might be a point where we diverge somewhere and then the logic will get confusing (e.g. we need some special config just for astro). WDYT about us just making astro executor a separate case from the get-go? Slightly more code but cleaner conceptually.
There was a problem hiding this comment.
🤷 I hear what you are saying, but my preference is to copy/paste logic until it's actually different.
I'll make some extra little helpers to re-use in both case statements to future proof w/o copy paste. thanks for this note.
neel-astro
left a comment
There was a problem hiding this comment.
Left some minor comments to work out, but functionally looks fine 👍
cmd/cloud/deployment.go
Outdated
|
|
||
| func isValidExecutor(executor string) bool { | ||
| return strings.EqualFold(executor, deployment.KubeExecutor) || strings.EqualFold(executor, deployment.CeleryExecutor) || executor == "" || strings.EqualFold(executor, deployment.CELERY) || strings.EqualFold(executor, deployment.KUBERNETES) | ||
| func isValidExecutor(executor, runtimeVersion string) bool { |
There was a problem hiding this comment.
I think we have the exact same method declared twice in two separate packages and could be moved into a single place.
There was a problem hiding this comment.
Yeah it was already that way, but I took this opportunity to consolidate them, thanks for the note.
feluelle
left a comment
There was a problem hiding this comment.
LGTM, just a comment about testing, and a nit.
There was a problem hiding this comment.
The changes to this file appear more complex than I would expect. Can you also test manually that the deployment create/update requests for all executors still work as expected, including changing the executor on update?
There was a problem hiding this comment.
yeah I had to do some refactoring to get around the gocyclo linter. good shout. I'll test create / update requests for all executors manually and post screen shots before merging.
| // check if executor is valid | ||
| if !isValidExecutor(executor) { | ||
| return fmt.Errorf("%s is %w", executor, errInvalidExecutor) | ||
| fmt.Println(deploymentType) |
There was a problem hiding this comment.
| fmt.Println(deploymentType) |
Description
Adds support to
astro deployment [create|update]for AF 3 with Astro Executor🎟 Issue(s)
Fixes #1852
Related #1853
🧪 Functional Testing
📸 Screenshots
📋 Checklist
make testbefore taking out of draftmake lintbefore taking out of draft