-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature flags to let dagit vary features for certain code locations (#…
…17016) Summary: For users on versions that are able to use thew new backfill policy, we want to hide the backfill dialog from the backfill page. For users still on older versions, we want to leave it. This gives the frontend the tools to check that. Test Plan: BK ## Summary & Motivation ## How I Tested These Changes
- Loading branch information
Showing
6 changed files
with
196 additions
and
3 deletions.
There are no files selected for viewing
6 changes: 6 additions & 0 deletions
6
js_modules/dagster-ui/packages/ui-core/src/graphql/schema.graphql
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
22 changes: 22 additions & 0 deletions
22
js_modules/dagster-ui/packages/ui-core/src/graphql/types.ts
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
python_modules/dagster/dagster/_core/host_representation/feature_flags.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
from enum import Enum | ||
from typing import TYPE_CHECKING, Mapping | ||
|
||
import packaging.version | ||
|
||
if TYPE_CHECKING: | ||
from dagster._core.workspace.workspace import CodeLocationEntry | ||
|
||
|
||
class CodeLocationFeatureFlags(Enum): | ||
SHOW_SINGLE_RUN_BACKFILL_TOGGLE = "SHOW_SINGLE_RUN_BACKFILL_TOGGLE" | ||
|
||
|
||
def get_feature_flags_for_location( | ||
code_location_entry: "CodeLocationEntry", | ||
) -> Mapping[CodeLocationFeatureFlags, bool]: | ||
return { | ||
CodeLocationFeatureFlags.SHOW_SINGLE_RUN_BACKFILL_TOGGLE: ( | ||
get_should_show_single_run_backfill_toggle(code_location_entry) | ||
) | ||
} | ||
|
||
|
||
def get_should_show_single_run_backfill_toggle(code_location_entry: "CodeLocationEntry"): | ||
# Starting in version 1.5 we stopped showing the single-run backfill toggle in the UI - | ||
# instead it is now set in code | ||
|
||
if not code_location_entry.code_location: | ||
# Error or loading status | ||
return False | ||
|
||
dagster_library_version = ( | ||
code_location_entry.code_location.get_dagster_library_versions() or {} | ||
).get("dagster") | ||
|
||
if not dagster_library_version: | ||
# Old enough version that it wasn't being stored | ||
return True | ||
|
||
if dagster_library_version == "1!0+dev": | ||
return False | ||
|
||
try: | ||
version = packaging.version.parse(dagster_library_version) | ||
return version.major < 1 or (version.major == 1 and version.minor < 5) | ||
except packaging.version.InvalidVersion: | ||
return False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters