Skip to content

Conversation

@Taragolis
Copy link
Contributor

Add missing "parameters" into NoteBook's templated fields and remove redundant loop on inlets/outlets

related: #28977

@Taragolis
Copy link
Contributor Author

cc: @TPapajCin @marvinfretly @nicnguyen3103

Comment on lines +62 to +70
Copy link
Contributor Author

Choose a reason for hiding this comment

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

may be we should also make this fields mandatory

Copy link
Member

Choose a reason for hiding this comment

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

I think it's OK to check their existence in the constructor.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Previously it checked in execute, no idea why, just assume that is somehow related to Linage

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
template_fields: ClassVar = {*File.template_fields, "parameters"}
template_fields: ClassVar[str] = {*File.template_fields, "parameters"}

(I don’t think the annotation is actually needed at all though, it should inherit the type from File.)

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 guess you mean ClassVar[Sequence[str]] instead of just ClassVar[str]

However even with with this annotation I got

 error: Incompatible types in assignment (expression has type "Set[str]", variable has type "Sequence[str]")  [assignment]

So I change wrap value to tuple

Copy link
Member

Choose a reason for hiding this comment

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

Can’t use sequence, you need Collection[str]. But changing it to tuple works as well, the difference is minimal.

@Taragolis Taragolis force-pushed the fix-papermill-operator-rendering branch 2 times, most recently from 6957f2f to e607c90 Compare January 17, 2023 10:09
Copy link
Member

@uranusjr uranusjr left a comment

Choose a reason for hiding this comment

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

Looks good, but I want one of the users in the original issue to actually test against real Papermill.

@Taragolis
Copy link
Contributor Author

Looks good, but I want one of the users in the original issue to actually test against real Papermill.

+1

@marvinfretly
Copy link

How can I try it? I'm currently using airflow using docker image

@Taragolis
Copy link
Contributor Author

How can I try it? I'm currently using airflow using docker image

There is different ways, however according to the fact that changes relevant only for single file you could:

  1. Download associated with this PR: https://raw.githubusercontent.com/apache/airflow/e607c90884da37bebc3d4ca257bd253f31954c14/airflow/providers/papermill/operators/papermill.py
  2. Place it in you DAG directory
  3. Use in your DAG from papermill import PapermillOperator instead of from airflow.providers.papermill.operators.papermill import PapermillOperator

Another options:

@marvinfretly
Copy link

How can I try it? I'm currently using airflow using docker image

There is different ways, however according to the fact that changes relevant only for single file you could:

  1. Download associated with this PR: https://raw.githubusercontent.com/apache/airflow/e607c90884da37bebc3d4ca257bd253f31954c14/airflow/providers/papermill/operators/papermill.py
  2. Place it in you DAG directory
  3. Use in your DAG from papermill import PapermillOperator instead of from airflow.providers.papermill.operators.papermill import PapermillOperator

Another options:

Thank you. Everything is working properly now. Using v2.5.0

@potiuk potiuk force-pushed the fix-papermill-operator-rendering branch from e607c90 to b79b9c2 Compare January 20, 2023 16:39
@potiuk
Copy link
Member

potiuk commented Jan 20, 2023

Rebased it as for some reason there was only 1 mergable check.

@Taragolis
Copy link
Contributor Author

Taragolis commented Jan 20, 2023

Well seems like broken compatibility with 2.3.x, I will check later on as well as will change wrong message for error in the CI (point to 2.2.0 but actually we test on 2.3.0)

@potiuk
Copy link
Member

potiuk commented Jan 20, 2023

Well seems like broken compatibility with 2.3.x, I will check later on as well as will change wrong message for error in the CI (point to 2.2.0 but actually we test on 2.3.0)

Not updated when we bumped it :)

@Taragolis
Copy link
Contributor Author

Not updated when we bumped it :)

I have a look and also found that we have environment variable USE_AIRFLOW_VERSION but we explicit set it to "wheel" (maybe somewhere in the past it make sense). We could use it for generate message or skip message if set to None. I plan to have a look more detail tomorrow

@potiuk
Copy link
Member

potiuk commented Jan 20, 2023

I have a look and also found that we have environment variable USE_AIRFLOW_VERSION but we explicit set it to "wheel" (maybe somewhere in the past it make sense). We could use it for generate message or skip message if set to None. I plan to have a look more detail tomorrow

I believe this is correct (but would be great to verify the logic - so please take a look) - in a number of steps in CI we install airflow and providers from pre-built wheels (to simulate the behaviour of installing wheels from PyPI)

See: https://github.com/apache/airflow/blob/main/IMAGES.rst#building-docker-images-from-current-sources

Building docker images from current sources
===========================================

The easy way to build the CI/PROD images is to use `<BREEZE.rst>`_. It uses a number of optimization
and caches to build it efficiently and fast when you are developing Airflow and need to update to
latest version.

CI image, airflow package is always built from sources. When you execute the image, you can however use
the ``--use-airflow-version`` flag (or ``USE_AIRFLOW_VERSION`` environment variable) to remove
the preinstalled source version of Airflow and replace it with one of the possible installation methods:

* "none" airflow is removed and not installed
* "wheel" airflow is removed and replaced with "wheel" version available in dist
* "sdist" airflow is removed and replaced with "sdist" version available in dist
* "<VERSION>" airflow is removed and installed from PyPI (with the specified version)

For PROD image by default production image is built from the latest sources when using Breeze, but when
you use it via docker build command, it uses the latest installed version of airflow and providers.
However, you can choose different installation methods as described in
`Building PROD docker images from released PIP packages <#building-prod-docker-images-from-released-packages>`_.
Detailed reference for building production image from different sources can be found in:
`Build Args reference <docs/docker-stack/build-arg-ref.rst#installing-airflow-using-different-methods>`_

You can build the CI image using current sources this command:

@Taragolis
Copy link
Contributor Author

I believe this is correct

Yes it is. I filtered only .py files when tried to find usage of USE_AIRFLOW_VERSION 🤦 🤦‍♂️ 🤦‍♀️

@Taragolis Taragolis force-pushed the fix-papermill-operator-rendering branch from b79b9c2 to 37cbb15 Compare January 22, 2023 18:24
@Taragolis
Copy link
Contributor Author

Well it was not straight forward to fix this in 2.3 due to cattrs, however finally it should be compatible with 2.3:

image

@potiuk potiuk merged commit 736f2e8 into apache:main Jan 22, 2023
@Taragolis Taragolis deleted the fix-papermill-operator-rendering branch September 28, 2023 18:43
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.

4 participants