This is an automated email from the ASF dual-hosted git repository.
potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new e9dfe0b Fix MyPy errors in airflow/api and airflow/api_connexion
(#20390)
e9dfe0b is described below
commit e9dfe0b3647d90cbeb7dbc4397defaab7ba32072
Author: Josh Fell <[email protected]>
AuthorDate: Sat Dec 18 17:09:23 2021 -0500
Fix MyPy errors in airflow/api and airflow/api_connexion (#20390)
---
airflow/api/common/trigger_dag.py | 2 +-
airflow/api_connexion/endpoints/dag_run_endpoint.py | 2 +-
airflow/models/dagrun.py | 2 +-
airflow/models/pool.py | 6 +++---
setup.py | 1 +
5 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/airflow/api/common/trigger_dag.py
b/airflow/api/common/trigger_dag.py
index 70bbb78..9453fd3 100644
--- a/airflow/api/common/trigger_dag.py
+++ b/airflow/api/common/trigger_dag.py
@@ -34,7 +34,7 @@ def _trigger_dag(
conf: Optional[Union[dict, str]] = None,
execution_date: Optional[datetime] = None,
replace_microseconds: bool = True,
-) -> List[DagRun]:
+) -> List[Optional[DagRun]]:
"""Triggers DAG run.
:param dag_id: DAG ID
diff --git a/airflow/api_connexion/endpoints/dag_run_endpoint.py
b/airflow/api_connexion/endpoints/dag_run_endpoint.py
index a766f1d..479ef85 100644
--- a/airflow/api_connexion/endpoints/dag_run_endpoint.py
+++ b/airflow/api_connexion/endpoints/dag_run_endpoint.py
@@ -88,7 +88,7 @@ def _fetch_dag_runs(
start_date_lte: Optional[str],
limit: Optional[int],
offset: Optional[int],
- order_by: Optional[str],
+ order_by: str,
) -> Tuple[List[DagRun], int]:
if start_date_gte:
query = query.filter(DagRun.start_date >= start_date_gte)
diff --git a/airflow/models/dagrun.py b/airflow/models/dagrun.py
index 83d3507..58a0038 100644
--- a/airflow/models/dagrun.py
+++ b/airflow/models/dagrun.py
@@ -298,7 +298,7 @@ class DagRun(Base, LoggingMixin):
dag_id: Optional[Union[str, List[str]]] = None,
run_id: Optional[str] = None,
execution_date: Optional[Union[datetime, List[datetime]]] = None,
- state: Optional[DagRunState] = None,
+ state: Optional[Union[str, DagRunState]] = None,
external_trigger: Optional[bool] = None,
no_backfills: bool = False,
run_type: Optional[DagRunType] = None,
diff --git a/airflow/models/pool.py b/airflow/models/pool.py
index 8ae88aa..821e646 100644
--- a/airflow/models/pool.py
+++ b/airflow/models/pool.py
@@ -196,7 +196,7 @@ class Pool(Base):
}
@provide_session
- def occupied_slots(self, session: Session):
+ def occupied_slots(self, session: Session = NEW_SESSION):
"""
Get the number of slots used by running/queued tasks at the moment.
@@ -214,7 +214,7 @@ class Pool(Base):
)
@provide_session
- def running_slots(self, session: Session):
+ def running_slots(self, session: Session = NEW_SESSION):
"""
Get the number of slots used by running tasks at the moment.
@@ -232,7 +232,7 @@ class Pool(Base):
)
@provide_session
- def queued_slots(self, session: Session):
+ def queued_slots(self, session: Session = NEW_SESSION):
"""
Get the number of slots used by queued tasks at the moment.
diff --git a/setup.py b/setup.py
index a6ad949..744f867 100644
--- a/setup.py
+++ b/setup.py
@@ -526,6 +526,7 @@ mypy_dependencies = [
'types-boto',
'types-certifi',
'types-croniter',
+ 'types-Deprecated',
'types-docutils',
'types-freezegun',
'types-paramiko',