Skip to content

[dagster-airlift][jobs 4/n] Definitions.execute_job_in_process #29243

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

Open
wants to merge 1 commit into
base: dpeng817/airflow_defs_data
Choose a base branch
from

Conversation

dpeng817
Copy link
Contributor

@dpeng817 dpeng817 commented Apr 12, 2025

Summary & Motivation

Adds a new internal execute_in_process method to Definitions class which contains full repository context. This ends up being really useful for the "monitoring job", which requires full repo context to build its mapping of items.

How I Tested These Changes

Additional execute_in_process test.

@dpeng817 dpeng817 changed the title [dagster-airlift][jobs 5/n] Definitions.execute_job_in_process [dagster-airlift][jobs 4/n] Definitions.execute_job_in_process Apr 12, 2025
@dpeng817 dpeng817 requested a review from OwenKephart April 15, 2025 01:35
@dpeng817 dpeng817 marked this pull request as ready for review April 15, 2025 01:35
@dpeng817 dpeng817 force-pushed the dpeng817/airflow_defs_data branch from b38fa41 to c581bfc Compare April 15, 2025 16:35
@dpeng817 dpeng817 force-pushed the defs_execute_in_process branch from a7caf6a to 05fb3ae Compare April 15, 2025 16:35
@dpeng817 dpeng817 force-pushed the dpeng817/airflow_defs_data branch from c581bfc to c580897 Compare April 15, 2025 17:04
@dpeng817 dpeng817 force-pushed the defs_execute_in_process branch from 05fb3ae to bbb6263 Compare April 15, 2025 17:04
Copy link
Contributor

@OwenKephart OwenKephart left a comment

Choose a reason for hiding this comment

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

where does this actually get used upstack? I'm having trouble understanding the precise usecase here -- is it purely for test use cases? If so, I'd prefer to "hide" this code a bit more (i.e. move as much of it as possible into the test code, and have this be a utility function rather than a method on Definitions itself)

@dpeng817
Copy link
Contributor Author

dpeng817 commented Apr 22, 2025

@OwenKephart purely for test. See the upstack monitoring job tests for how it's used - but the idea is that sometimes you want access to the full repo in scope when executing a job in process.

Fine with making it a utility function; but I'll make that change in an upstack PR to avoid refactor pain.

Copy link
Contributor

@OwenKephart OwenKephart left a comment

Choose a reason for hiding this comment

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

sounds good fixing upstack, would really prefer stuff like RepoBackedJob to also move into test-land when you do that

@dpeng817 dpeng817 force-pushed the dpeng817/airflow_defs_data branch from 42308cf to ae1523b Compare April 23, 2025 16:51
@dpeng817 dpeng817 force-pushed the defs_execute_in_process branch from 6595ca7 to f695d66 Compare April 23, 2025 16:51
run_config=run_config,
),
run_id=run_id,
asset_selection=frozenset(asset_selection),
Copy link
Contributor

Choose a reason for hiding this comment

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

The line asset_selection=frozenset(asset_selection) will raise a TypeError when asset_selection is None, which is a valid input according to the function signature. Since both this method and core_execute_in_process accept asset_selection as an Optional parameter, this should be changed to:

asset_selection=frozenset(asset_selection) if asset_selection else None

This matches the pattern used in JobDefinition.get_subset on line 743 and will properly handle the None case.

Suggested change
asset_selection=frozenset(asset_selection),
asset_selection=frozenset(asset_selection) if asset_selection else None,

Spotted by Diamond

Is this helpful? React 👍 or 👎 to let us know.

@dpeng817 dpeng817 force-pushed the dpeng817/airflow_defs_data branch from ae1523b to 86bdbc4 Compare April 23, 2025 21:59
@dpeng817 dpeng817 force-pushed the defs_execute_in_process branch from f695d66 to 55dd13b Compare April 23, 2025 21:59
@dpeng817 dpeng817 force-pushed the dpeng817/airflow_defs_data branch from 86bdbc4 to 94984b0 Compare April 23, 2025 22:27
@dpeng817 dpeng817 force-pushed the defs_execute_in_process branch from 55dd13b to 16f8742 Compare April 23, 2025 22:27
@dpeng817 dpeng817 force-pushed the dpeng817/airflow_defs_data branch from 94984b0 to 5d3a0e4 Compare April 24, 2025 00:50
@dpeng817 dpeng817 force-pushed the defs_execute_in_process branch from 16f8742 to 997cd2c Compare April 24, 2025 00:50
@dpeng817 dpeng817 force-pushed the dpeng817/airflow_defs_data branch from 5d3a0e4 to f1727c1 Compare April 24, 2025 23:47
@dpeng817 dpeng817 force-pushed the defs_execute_in_process branch 2 times, most recently from 9a12662 to 62cf80a Compare April 25, 2025 00:14
@dpeng817 dpeng817 force-pushed the dpeng817/airflow_defs_data branch from f1727c1 to b08c414 Compare April 25, 2025 00:29
@dpeng817 dpeng817 force-pushed the defs_execute_in_process branch from 62cf80a to f3a8535 Compare April 25, 2025 00:29
@dpeng817 dpeng817 force-pushed the defs_execute_in_process branch from f3a8535 to c7c9046 Compare April 25, 2025 02:02
This was referenced Apr 25, 2025
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.

2 participants