uranusjr commented on code in PR #29094:
URL: https://github.com/apache/airflow/pull/29094#discussion_r1149016329
##########
airflow/jobs/scheduler_job.py:
##########
@@ -83,6 +84,17 @@
DM = DagModel
+@dataclass
+class ConcurrencyMap:
+ """Dataclass to represent concurrency maps"""
+
+ dag_active_tasks_map: DefaultDict[str, int] =
field(default_factory=lambda: defaultdict(int))
+ task_concurrency_map: DefaultDict[tuple[str, str], int] =
field(default_factory=lambda: defaultdict(int))
+ task_dagrun_concurrency_map: DefaultDict[tuple[str, str, str], int] =
field(
+ default_factory=lambda: defaultdict(int)
+ )
Review Comment:
I feel something like this can reduce some noise
```python
def default_int_dict() -> dict[Any, int]:
return defaultdict(int)
@dataclass
class ConcurrencyMap:
dag_active_tasks_map: dict[str, int] =
field(default_factory=default_int_dict)
task_concurrency_map: dict[tuple[str, str], int] =
field(default_factory=default_int_dict)
task_dagrun_concurrency_map: dict[tuple[str, str, str], int] =
field(default_factory=default_int_dict)
```
--
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]