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

Decorate all operators with @apply_defaults #14

Merged
merged 1 commit into from
Nov 19, 2019
Merged

Conversation

arimbr
Copy link
Collaborator

@arimbr arimbr commented Nov 13, 2019

It seems to be a common practice to decorate all operators with @appy_defaults

Check for example, BigQueryToBigQueryOperator

The apply_defaults decorator apart from allowing to pass default_args to a task. It does some argument validation like:

  • Forcing to use keyword arguments when initializing operators
  • Checking for required arguments

That can be useful to debug operators.

Locally I tested for example if I removed the required step argument. Error message is a bit different.

BEFORE
image

AFTER
image

Good thing is that if someone does something like:

train_model = ValohaiSubmitExecutionOperator(
    'train_model',
    'tensorflow-example',
    step='Train model (MNIST)',

It will show the error:

Broken DAG: [/home/skillup/skillup/airflow-valohai-plugin/examples/dags/example_valohai_dag.py] Use keyword arguments when initializing operators

to force using the better:

train_model = ValohaiSubmitExecutionOperator(
    task_id='train_model',
    project_name='tensorflow-example',
    step='Train model (MNIST)',
...

@arimbr arimbr merged commit 9333fce into master Nov 19, 2019
@arimbr arimbr deleted the add-apply-defaults branch November 19, 2019 10:23
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.

3 participants