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

Add support for custom command and args in jobs #20864

Merged
merged 1 commit into from
Feb 23, 2022

Conversation

jedcunningham
Copy link
Member

This allows custom command and args to be used for the database migration and create user jobs.

@boring-cyborg boring-cyborg bot added the area:helm-chart Airflow Helm Chart label Jan 14, 2022
Comment on lines +2002 to +2043
"default": [
"bash",
"-c",
"exec \\\nairflow {{ semverCompare \">=2.0.0\" .Values.airflowVersion | ternary \"users create\" \"create_user\" }} \"$@\"",
"--",
"-r",
"{{ .Values.webserver.defaultUser.role }}",
"-u",
"{{ .Values.webserver.defaultUser.username }}",
"-e",
"{{ .Values.webserver.defaultUser.email }}",
"-f",
"{{ .Values.webserver.defaultUser.firstName }}",
"-l",
"{{ .Values.webserver.defaultUser.lastName }}",
"-p",
"{{ .Values.webserver.defaultUser.password }}"
]
Copy link
Member Author

@jedcunningham jedcunningham Jan 14, 2022

Choose a reason for hiding this comment

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

Suggested change
"default": [
"bash",
"-c",
"exec \\\nairflow {{ semverCompare \">=2.0.0\" .Values.airflowVersion | ternary \"users create\" \"create_user\" }} \"$@\"",
"--",
"-r",
"{{ .Values.webserver.defaultUser.role }}",
"-u",
"{{ .Values.webserver.defaultUser.username }}",
"-e",
"{{ .Values.webserver.defaultUser.email }}",
"-f",
"{{ .Values.webserver.defaultUser.firstName }}",
"-l",
"{{ .Values.webserver.defaultUser.lastName }}",
"-p",
"{{ .Values.webserver.defaultUser.password }}"
]
"default": "See values.yaml"

I almost did this, as this is a lot on the params page. Thoughts?

Copy link
Contributor

@dstandish dstandish Jan 24, 2022

Choose a reason for hiding this comment

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

no objection from me

separately, i looked at the params page, and it is pretty tough to navigate. probably there is a better way to present this information. and if that is done, maybe then it's more worthwhile to add.

Along these lines, from code dupe perspective, perhaps defaults could be scraped from values.yaml for the purpose of docs.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, our docs is "easy", but artifacthub uses the schema alone, e.g:

https://artifacthub.io/packages/helm/apache-airflow/airflow?modal=values-schema&path=workers.affinity

With fresh eyes, we probably should be removing "See values.yaml" instead of adding more.

And good callout on the params being rough... It does indeed need some tlc.

@potiuk
Copy link
Member

potiuk commented Jan 22, 2022

Hmmm. do we really want that ? I'd rather fix any issues resulting from running standard commands here, otherwise it's not different from just adding a hook to run any job at any moment, which is kinda strange.

@jedcunningham
Copy link
Member Author

This is one of the last places where we have differences between Airflow 1 and 2, and also don't support customization (which will allow us to more easily drop official support for 1).

This also provides more flexibility for future args in these jobs. For example, even now some installs could utilize --use-random-password when creating the initial user. There could be more in the future too.

@github-actions github-actions bot added the okay to merge It's ok to merge this PR as it does not require more tests label Feb 22, 2022
@github-actions
Copy link

The PR is likely OK to be merged with just subset of tests for default Python and Database versions without running the full matrix of tests, because it does not modify the core of Airflow. If the committers decide that the full tests matrix is needed, they will add the label 'full tests needed'. Then you should rebase to the latest main or amend the last commit of the PR, and push it with --force-with-lease.

@jedcunningham jedcunningham merged commit 4e17528 into apache:main Feb 23, 2022
@jedcunningham jedcunningham deleted the job_args_configurable branch February 23, 2022 00:47
@jedcunningham jedcunningham added the type:new-feature Changelog: New Features label Feb 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:helm-chart Airflow Helm Chart okay to merge It's ok to merge this PR as it does not require more tests type:new-feature Changelog: New Features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants