Skip to content

Comments

AF3 Astro Executor support for deployment create / update#1854

Merged
jaketf merged 46 commits intomainfrom
af3-deployment-create
Jun 23, 2025
Merged

AF3 Astro Executor support for deployment create / update#1854
jaketf merged 46 commits intomainfrom
af3-deployment-create

Conversation

@jaketf
Copy link
Contributor

@jaketf jaketf commented May 21, 2025

Description

Describe the purpose of this pull request.

Adds support to astro deployment [create|update] for AF 3 with Astro Executor

🎟 Issue(s)

Fixes #1852
Related #1853

🧪 Functional Testing

List the functional testing steps to confirm this feature or fix.
successful deployment creation of minimal Hosted AF3 deployment w/ astro executor

make build
./astro deployment create -v cm4sauxuo03ig01rfux2aun5d -v 3.0-1 -e ASTRO -n test-astro-exec-from-cli-2
Current Workspace: jake


Please select a Region for your Deployment:
 #     REGION            
 1     westus2           
 2     eastus2           
 3     westeurope        
 4     australiaeast     

> 1
 NAME                           NAMESPACE                   CLUSTER     CLOUD PROVIDER     REGION      DEPLOYMENT ID                 RUNTIME VERSION                    DAG DEPLOY ENABLED     CI-CD ENFORCEMENT     DEPLOYMENT TYPE     
 test-astro-exec-from-cli-2     explosive-parallax-1197     N/A         AZURE              westus2     cmbvbhl2f02pj01l6m1tv8g8q     3.0-1 (based on Airflow 3.0.0)     true                   false                 STANDARD            

 Successfully created Deployment: test-astro-exec-from-cli-2
 Deployment can be accessed at the following URLs 

 Deployment Dashboard: cloud.astronomer-dev.io/cm8s7ergj00vm01ovrdxw26u8/deployments/cmbvbhl2f02pj01l6m1tv8g8q/overview
 Airflow Dashboard: clztuyh0a01z701mwxjahsza2.astronomer-dev.run/d1tv8g8q?orgId=org_bql5Hn1KELMRNPoM

📸 Screenshots

Add screenshots to illustrate the validity of these changes.

📋 Checklist

  • Rebased from the main (or release if patching) branch (before testing)
  • Ran make test before taking out of draft
  • Ran make lint before taking out of draft
  • Added/updated applicable tests
  • Tested against Astro-API (if necessary).
  • Tested against Houston-API and Astronomer (if necessary).
  • Communicated to/tagged owners of respective clients potentially impacted by these changes.
  • Updated any related documentation

@jaketf jaketf mentioned this pull request May 22, 2025
8 tasks
@jaketf jaketf force-pushed the af3-deployment-create branch from aeb5076 to cc6e6a2 Compare May 22, 2025 17:47
@jaketf jaketf changed the title AF3 / Remote Execution support for deployment create AF3 Astro Executor support for deployment create Jun 13, 2025
@jaketf jaketf force-pushed the af3-deployment-create branch from 9ebac35 to 8e471a4 Compare June 13, 2025 22:16
@jaketf jaketf marked this pull request as ready for review June 13, 2025 22:28
@jaketf jaketf requested review from feluelle June 13, 2025 22:28
Comment on lines 719 to 721
// 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) {
Copy link
Member

Choose a reason for hiding this comment

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

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.

Suggested change
// 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.

Copy link
Member

Choose a reason for hiding this comment

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

@jaketf, did you revert this? Was that intentional? I'm okay with that if you think it's better.

Copy link
Member

Choose a reason for hiding this comment

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

Ah, you changed this in cmd/cloud/deployment.go but not in this module.

@jaketf jaketf force-pushed the af3-deployment-create branch from f0c8617 to 793fda2 Compare June 17, 2025 22:17
}
switch dedicatedDeploymentRequest.Executor {
case astroplatformcore.UpdateDedicatedDeploymentRequestExecutorCELERY:
case astroplatformcore.UpdateDedicatedDeploymentRequestExecutorCELERY, astroplatformcore.UpdateDedicatedDeploymentRequestExecutorASTRO:
Copy link
Contributor

Choose a reason for hiding this comment

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

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.

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 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.

Copy link
Contributor

Choose a reason for hiding this comment

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

Awesome, SGTM

Copy link
Contributor

@neel-astro neel-astro left a comment

Choose a reason for hiding this comment

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

Left some minor comments to work out, but functionally looks fine 👍


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 {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we have the exact same method declared twice in two separate packages and could be moved into a single place.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah it was already that way, but I took this opportunity to consolidate them, thanks for the note.

@jaketf jaketf requested review from dimberman and neel-astro June 18, 2025 19:27
Copy link
Member

@feluelle feluelle left a comment

Choose a reason for hiding this comment

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

LGTM, just a comment about testing, and a nit.

Copy link
Member

Choose a reason for hiding this comment

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

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

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.

@jaketf jaketf changed the title AF3 Astro Executor support for deployment create AF3 Astro Executor support for deployment create / update Jun 20, 2025
// check if executor is valid
if !isValidExecutor(executor) {
return fmt.Errorf("%s is %w", executor, errInvalidExecutor)
fmt.Println(deploymentType)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
fmt.Println(deploymentType)

@jaketf jaketf merged commit 3e20e0a into main Jun 23, 2025
6 checks passed
@jaketf jaketf deleted the af3-deployment-create branch June 23, 2025 21:16
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.

Allow Astro Executor for AF 3 Deployments

4 participants