Lee-W commented on code in PR #42953: URL: https://github.com/apache/airflow/pull/42953#discussion_r1804027731
########## newsfragments/42953.significant: ########## @@ -0,0 +1,3 @@ +DAG.max_active_runs now evaluated per-run + +Previously, this was evaluated across all runs of the dag. This behavior change was passed by lazy consensus. Vote thread: https://lists.apache.org/thread/9o84d3yn934m32gtlpokpwtbbmtxj47l. Review Comment: ```suggestion Previously, this was evaluated across all runs of the dag. This behavior change was passed by lazy consensus. Vote thread: https://lists.apache.org/thread/9o84d3yn934m32gtlpokpwtbbmtxj47l. ``` ########## airflow/jobs/scheduler_job_runner.py: ########## @@ -107,17 +104,24 @@ class ConcurrencyMap: to # of task instances in the given state list in each DAG run. """ - dag_active_tasks_map: dict[str, int] - task_concurrency_map: dict[tuple[str, str], int] - task_dagrun_concurrency_map: dict[tuple[str, str, str], int] - - @classmethod - def from_concurrency_map(cls, mapping: dict[tuple[str, str, str], int]) -> ConcurrencyMap: - instance = cls(Counter(), Counter(), Counter(mapping)) - for (d, _, t), c in mapping.items(): - instance.dag_active_tasks_map[d] += c - instance.task_concurrency_map[(d, t)] += c - return instance + def __init__(self): + self.dag_run_active_tasks_map: dict[tuple[str, str], int] = Counter() + self.task_concurrency_map: dict[tuple[str, str], int] = Counter() + self.task_dagrun_concurrency_map: dict[tuple[str, str, str], int] = Counter() + Review Comment: 9 ```suggestion self.dag_run_active_tasks_map: Counter[tuple[str, str] = Counter() self.task_concurrency_map: Counter[tuple[str, str]] = Counter() self.task_dagrun_concurrency_map: Counter[tuple[str, str, str]] = Counter() ``` ########## airflow/jobs/scheduler_job_runner.py: ########## @@ -107,17 +104,24 @@ class ConcurrencyMap: to # of task instances in the given state list in each DAG run. """ - dag_active_tasks_map: dict[str, int] - task_concurrency_map: dict[tuple[str, str], int] - task_dagrun_concurrency_map: dict[tuple[str, str, str], int] - - @classmethod - def from_concurrency_map(cls, mapping: dict[tuple[str, str, str], int]) -> ConcurrencyMap: - instance = cls(Counter(), Counter(), Counter(mapping)) - for (d, _, t), c in mapping.items(): - instance.dag_active_tasks_map[d] += c - instance.task_concurrency_map[(d, t)] += c - return instance + def __init__(self): + self.dag_run_active_tasks_map: dict[tuple[str, str], int] = Counter() + self.task_concurrency_map: dict[tuple[str, str], int] = Counter() + self.task_dagrun_concurrency_map: dict[tuple[str, str, str], int] = Counter() + + def load(self, session): Review Comment: ```suggestion def load(self, session: Session) -> None: ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
