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 utilities for creating and executing flow bundles #17178

Merged
merged 4 commits into from
Feb 19, 2025

Conversation

desertaxle
Copy link
Member

@desertaxle desertaxle commented Feb 18, 2025

This PR adds an experimental bundles module containing the first initial utilities for working with flow bundles that will transport execution between different infrastructures.

The introduced utilities are:

  • create_bundle_for_flow_run which will take a flow, flow run, and context and serialize them for transport and storage. The flow and context are cloudpickled, gzipped, and base64 encoded for portability and storage effeciency.
  • execute_bundle_in_subprocess which will take a bundle and send it to a subprocess for extraction and execution. This will be used by the Runner to execute bundles downloaded from remote storage.

This PR also introduces a handle_engine_signals context manager to consolidate handling signals and exceptions from an engine instance since the handling had been duplicated in a few places.

Related to #17194

Copy link

codspeed-hq bot commented Feb 18, 2025

CodSpeed Performance Report

Merging #17178 will not alter performance

Comparing experimental-bundles (52ccc99) with main (168280f)

Summary

✅ 2 untouched benchmarks

@desertaxle desertaxle marked this pull request as ready for review February 19, 2025 04:12
@desertaxle desertaxle requested a review from cicdw February 19, 2025 04:12
Copy link
Collaborator

@zzstoatzz zzstoatzz left a comment

Choose a reason for hiding this comment

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

nice!

Comment on lines +196 to +198
# Stays in running state because the flow run is aborted manually
assert flow_run.state is not None
assert flow_run.state.is_running()
Copy link
Collaborator

Choose a reason for hiding this comment

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

hmm, I'm likely missing something - why this is expected?

Copy link
Member Author

Choose a reason for hiding this comment

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

The flow raises an abort, which causes the flow to stop running immediately without any state changes. This test ensures that the process has a 0 exit code in this case and I wanted to check to make sure the flow entered running before aborting.

@desertaxle desertaxle merged commit a476000 into main Feb 19, 2025
50 checks passed
@desertaxle desertaxle deleted the experimental-bundles branch February 19, 2025 16:53
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