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

py files doesn't have to be checked is_zipfiles in process_files #21538

Merged

Conversation

sungpeo
Copy link
Contributor

@sungpeo sungpeo commented Feb 12, 2022

py files doesn't have to be checked with is_zipfiles in process_files
like find_dag_file_paths in file.

def find_dag_file_paths(directory: Union[str, "pathlib.Path"], safe_mode: bool) -> List[str]:
"""Finds file paths of all DAG files."""
file_paths = []
for file_path in find_path_from_directory(str(directory), ".airflowignore"):
try:
if not os.path.isfile(file_path):
continue
_, file_ext = os.path.splitext(os.path.split(file_path)[-1])
if file_ext != '.py' and not zipfile.is_zipfile(file_path):

zipfile.is_zipfile could take longer than anticipated in case of remote file mount (DAG_DIR).
So, I want py files (generaly almost dag files are py) skip to check is_zipfile.

(It is simple change. Exist tests cover this one)


^ Add meaningful description above

Read the Pull Request Guidelines for more information.
In case of fundamental code change, Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in UPDATING.md.

@boring-cyborg
Copy link

boring-cyborg bot commented Feb 12, 2022

Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contribution Guide (https://github.com/apache/airflow/blob/main/CONTRIBUTING.rst)
Here are some useful points:

  • Pay attention to the quality of your code (flake8, mypy and type annotations). Our pre-commits will help you with that.
  • In case of a new feature add useful documentation (in docstrings or in docs/ directory). Adding a new operator? Check this short guide Consider adding an example DAG that shows how users should use it.
  • Consider using Breeze environment for testing locally, it’s a heavy docker but it ships with a working Airflow and a lot of integrations.
  • Be patient and persistent. It might take some time to get a review or get the final approval from Committers.
  • Please follow ASF Code of Conduct for all communication including (but not limited to) comments on Pull Requests, Mailing list and Slack.
  • Be sure to read the Airflow Coding style.
    Apache Airflow is a community-driven project and together we are making it better 🚀.
    In case of doubts contact the developers at:
    Mailing List: [email protected]
    Slack: https://s.apache.org/airflow-slack

Copy link
Member

@potiuk potiuk left a comment

Choose a reason for hiding this comment

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

I am ok with this change. Looks reasonable. It has (very improbable) compatibility if someone would have stored a zip file as .py file. This is unlikely, and I think it does not "count" as backwards compatiblity, but this behaviour change should be mentioned in UPDATING.md

Also I think we need someone else from committers to also agree that this not "incompatible envough" to classify as backwards-incompatible.

@github-actions
Copy link

The PR most likely needs to run full matrix of tests because it modifies parts of the core of Airflow. However, committers might decide to merge it quickly and take the risk. If they don't merge it quickly - please rebase it to the latest main at your convenience, or amend the last commit of the PR, and push it with --force-with-lease.

@github-actions github-actions bot added the full tests needed We need to run full set of tests for this PR to merge label Feb 12, 2022
@sungpeo sungpeo force-pushed the py_skip_check_is_zipfile_in_process_files branch from 7ee80b9 to d23d3fa Compare February 13, 2022 07:52
@sungpeo
Copy link
Contributor Author

sungpeo commented Feb 13, 2022

Without extra changes, I rebased my PR branch.

The PR most likely needs to run full matrix of tests because it modifies parts of the core of Airflow. However, committers might decide to merge it quickly and take the risk. If they don't merge it quickly - please rebase it to the latest main at your convenience, or amend the last commit of the PR, and push it with --force-with-lease.

airflow/models/dagbag.py Outdated Show resolved Hide resolved
@sungpeo sungpeo requested a review from uranusjr February 13, 2022 12:14
@sungpeo
Copy link
Contributor Author

sungpeo commented Feb 13, 2022

@uranusjr
I made a mistake changing the condition.
and I fixed it. (new commit)

@sungpeo sungpeo requested a review from uranusjr February 13, 2022 14:44
@jedcunningham
Copy link
Member

@sungpeo can you add this to UPDATING.md? Thanks!

@sungpeo
Copy link
Contributor Author

sungpeo commented Feb 15, 2022

@jedcunningham

@sungpeo can you add this to UPDATING.md? Thanks!

I added description for change of this PR to main in UDPAING.md.
Please review the commit.

UPDATING.md Outdated Show resolved Hide resolved
@jedcunningham jedcunningham merged commit d87762b into apache:main Feb 16, 2022
@boring-cyborg
Copy link

boring-cyborg bot commented Feb 16, 2022

Awesome work, congrats on your first merged pull request!

@jedcunningham
Copy link
Member

@sungpeo, thanks! Congrats on your first commit 🎉

@jedcunningham jedcunningham added the type:improvement Changelog: Improvements label Feb 28, 2022
@sungpeo sungpeo deleted the py_skip_check_is_zipfile_in_process_files branch March 2, 2022 05:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
full tests needed We need to run full set of tests for this PR to merge type:improvement Changelog: Improvements
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants