Skip to content

Bugfix for issue #6405: Fast registration runs into infinite loop#3230

Merged
Future-Outlier merged 4 commits into
flyteorg:masterfrom
rambrus:bugfix/6405-fast-registration-infinite-loop
Apr 17, 2025
Merged

Bugfix for issue #6405: Fast registration runs into infinite loop#3230
Future-Outlier merged 4 commits into
flyteorg:masterfrom
rambrus:bugfix/6405-fast-registration-infinite-loop

Conversation

@rambrus
Copy link
Copy Markdown
Contributor

@rambrus rambrus commented Apr 15, 2025

Tracking issue

Closes flyteorg/flyte#6405

Why are the changes needed?

In Spark fast registration workflows, entrypoint.py runs into an infinite loop while preparing to run the job

flytekit is taking everything in the current working directory and zip it, the archive file (flyte_wf.zip) is placed in the same directory that is being archived.

shutil.make_archive creates a zip file and archives the whole directory, including the zip file itself. In the case of Databricks clusters, it triggers a recursion and runs into an endless zipping loop.

What changes were proposed in this pull request?

The easiest way to fix this issue to create the archive outside of the directory to be archived.

How was this patch tested?

Built a docker image with the fixed flytekit version and tested it E2E.

Setup process

Screenshots

Check all the applicable boxes

  • I updated the documentation accordingly.
  • All new and existing tests passed.
  • All commits are signed-off.

Related PRs

Docs link

Summary by Bito

This PR fixes a critical bug in Spark fast registration workflow that caused an infinite loop due to recursive archiving. The solution moves archive creation to a temporary directory, preventing the archive file from including itself. The changes also streamline function parameters and improve mock assertions for better test reliability.

Unit tests added: True

Estimated effort to review (1-5, lower is better): 1

Signed-off-by: rambrus <v-rambrus@expediagroup.com>
@welcome
Copy link
Copy Markdown

welcome Bot commented Apr 15, 2025

Thank you for opening this pull request! 🙌

These tips will help get your PR across the finish line:

  • Most of the repos have a PR template; if not, fill it out to the best of your knowledge.
  • Sign off your commits (Reference: DCO Guide).

@flyte-bot
Copy link
Copy Markdown
Contributor

flyte-bot commented Apr 15, 2025

Code Review Agent Run #5b67c9

Actionable Suggestions - 1
  • plugins/flytekit-spark/flytekitplugins/spark/task.py - 1
    • Temporary directory immediately deleted after creation · Line 241-241
Review Details
  • Files reviewed - 1 · Commit Range: 6d7148e..6d7148e
    • plugins/flytekit-spark/flytekitplugins/spark/task.py
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

Refer to the documentation for additional commands.

Configuration

This repository uses code_review_bito You can customize the agent settings here or contact your Bito workspace admin at haytham@union.ai.

Documentation & Help

AI Code Review powered by Bito Logo

@flyte-bot
Copy link
Copy Markdown
Contributor

flyte-bot commented Apr 15, 2025

Changelist by Bito

This pull request implements the following key changes.

Key Change Files Impacted
Bug Fix - Resolve Recursive Zipping Bug

task.py - Replaced archiving in working directory with a temporary directory to prevent recursive zipping and infinite loop.

Testing - Enhance Test Coverage for Spark Task

test_spark_task.py - Updated tests to mock temporary directory creation and archive functions, ensuring proper call validations for the new archiving process.

Comment thread plugins/flytekit-spark/flytekitplugins/spark/task.py Outdated
Signed-off-by: rambrus <v-rambrus@expediagroup.com>
@rambrus
Copy link
Copy Markdown
Contributor Author

rambrus commented Apr 15, 2025

/review

@flyte-bot
Copy link
Copy Markdown
Contributor

flyte-bot commented Apr 15, 2025

Code Review Agent Run #2fd235

Actionable Suggestions - 0
Review Details
  • Files reviewed - 1 · Commit Range: 6d7148e..1172159
    • plugins/flytekit-spark/flytekitplugins/spark/task.py
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

Refer to the documentation for additional commands.

Configuration

This repository uses code_review_bito You can customize the agent settings here or contact your Bito workspace admin at haytham@union.ai.

Documentation & Help

AI Code Review powered by Bito Logo

pingsutw
pingsutw previously approved these changes Apr 15, 2025
Copy link
Copy Markdown
Member

@pingsutw pingsutw left a comment

Choose a reason for hiding this comment

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

Thank you!

@flyte-bot
Copy link
Copy Markdown
Contributor

flyte-bot commented Apr 15, 2025

Code Review Agent Run #15f705

Actionable Suggestions - 0
Review Details
  • Files reviewed - 1 · Commit Range: 6d7148e..1172159
    • plugins/flytekit-spark/flytekitplugins/spark/task.py
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

Refer to the documentation for additional commands.

Configuration

This repository uses code_review_bito You can customize the agent settings here or contact your Bito workspace admin at haytham@union.ai.

Documentation & Help

AI Code Review powered by Bito Logo

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 15, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 52.32%. Comparing base (8abecfe) to head (854d54a).

❗ There is a different number of reports uploaded between BASE (8abecfe) and HEAD (854d54a). Click for more details.

HEAD has 26 uploads less than BASE
Flag BASE (8abecfe) HEAD (854d54a)
28 2
Additional details and impacted files
@@             Coverage Diff             @@
##           master    #3230       +/-   ##
===========================================
- Coverage   89.81%   52.32%   -37.49%     
===========================================
  Files         136      214       +78     
  Lines        6599    22371    +15772     
  Branches        0     2925     +2925     
===========================================
+ Hits         5927    11706     +5779     
- Misses        672     9979     +9307     
- Partials        0      686      +686     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Signed-off-by: rambrus <v-rambrus@expediagroup.com>
@rambrus
Copy link
Copy Markdown
Contributor Author

rambrus commented Apr 15, 2025

/review

@flyte-bot
Copy link
Copy Markdown
Contributor

flyte-bot commented Apr 15, 2025

Code Review Agent Run #044a16

Actionable Suggestions - 0
Review Details
  • Files reviewed - 2 · Commit Range: 6d7148e..854d54a
    • plugins/flytekit-spark/flytekitplugins/spark/task.py
    • plugins/flytekit-spark/tests/test_spark_task.py
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

Refer to the documentation for additional commands.

Configuration

This repository uses code_review_bito You can customize the agent settings here or contact your Bito workspace admin at haytham@union.ai.

Documentation & Help

AI Code Review powered by Bito Logo

@flyte-bot
Copy link
Copy Markdown
Contributor

flyte-bot commented Apr 15, 2025

Code Review Agent Run #1b7b4f

Actionable Suggestions - 0
Review Details
  • Files reviewed - 2 · Commit Range: 6d7148e..854d54a
    • plugins/flytekit-spark/flytekitplugins/spark/task.py
    • plugins/flytekit-spark/tests/test_spark_task.py
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

Refer to the documentation for additional commands.

Configuration

This repository uses code_review_bito You can customize the agent settings here or contact your Bito workspace admin at haytham@union.ai.

Documentation & Help

AI Code Review powered by Bito Logo

Future-Outlier
Future-Outlier previously approved these changes Apr 15, 2025
Signed-off-by: rambrus <v-rambrus@expediagroup.com>
@flyte-bot
Copy link
Copy Markdown
Contributor

flyte-bot commented Apr 16, 2025

Code Review Agent Run #8a0a73

Actionable Suggestions - 0
Review Details
  • Files reviewed - 1 · Commit Range: 854d54a..cb153b4
    • plugins/flytekit-spark/tests/test_spark_task.py
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

Refer to the documentation for additional commands.

Configuration

This repository uses code_review_bito You can customize the agent settings here or contact your Bito workspace admin at haytham@union.ai.

Documentation & Help

AI Code Review powered by Bito Logo

@Future-Outlier Future-Outlier merged commit 26db7a3 into flyteorg:master Apr 17, 2025
116 checks passed
@welcome
Copy link
Copy Markdown

welcome Bot commented Apr 17, 2025

Congrats on merging your first pull request! 🎉

Atharva1723 pushed a commit to Atharva1723/flytekit that referenced this pull request Oct 5, 2025
…yteorg#3230)

* Bugfix for issue #6405: Fast registration runs into infinite loop

Signed-off-by: rambrus <v-rambrus@expediagroup.com>

* Replace tempfile.TemporaryDirectory().name with tempfile.mkdtemp()

Signed-off-by: rambrus <v-rambrus@expediagroup.com>

* Update and add unit tests

Signed-off-by: rambrus <v-rambrus@expediagroup.com>

* Merge unit tests, fix lint issues

Signed-off-by: rambrus <v-rambrus@expediagroup.com>

---------

Signed-off-by: rambrus <v-rambrus@expediagroup.com>
Signed-off-by: Atharva <atharvakulkarni172003@gmail.com>
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.

[BUG] Fast registration Databricks jobs run into infinite loop with flytekit 1.14.7

4 participants