Skip to content

Commit

Permalink
fix: add compat for 2.0, bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
fritz-astronomer committed Sep 12, 2024
1 parent 3045d92 commit b9b714c
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
2 changes: 1 addition & 1 deletion astronomer_starship/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "2.0.5"
__version__ = "2.0.6"


def get_provider_info():
Expand Down
28 changes: 27 additions & 1 deletion astronomer_starship/compat/starship_compatability.py
Original file line number Diff line number Diff line change
Expand Up @@ -994,6 +994,30 @@ def get_task_instances(self, dag_id: str, offset: int = 0, limit: int = 10):
raise e


class StarshipAirflow20(StarshipAirflow21):
"""
- description does not exist in variables
- queued_at not on dag_run
"""

def variable_attrs(self):
attrs = super().variable_attrs()
del attrs["description"]
return attrs

def dag_runs_attrs(self):
attrs = super().dag_runs_attrs()
if "queued_at" in attrs["dag_runs"]["test_value"][0]:
del attrs["dag_runs"]["test_value"][0]["queued_at"]
return attrs

def dag_run_attrs(self):
attrs = super().dag_run_attrs()
if "queued_at" in attrs:
del attrs["queued_at"]
return attrs


class StarshipAirflow27(StarshipAirflow):
"""
- include_deferred is required in pools
Expand Down Expand Up @@ -1078,8 +1102,10 @@ def __new__(cls, airflow_version: "Union[str, None]" = None) -> StarshipAirflow:
return StarshipAirflow27()
if int(minor) == 2:
return StarshipAirflow22()
if int(minor) <= 1:
if int(minor) == 1:
return StarshipAirflow21()
if int(minor) == 0:
return StarshipAirflow20()
return StarshipAirflow()
else:
raise RuntimeError(f"Unsupported Airflow Version: {airflow_version}")

0 comments on commit b9b714c

Please sign in to comment.