diff --git a/UPDATING.md b/UPDATING.md index db50c552d545c..b10cbfbb941a6 100644 --- a/UPDATING.md +++ b/UPDATING.md @@ -62,6 +62,16 @@ https://developers.google.com/style/inclusive-documentation --> +### Ability to patch Pool.DEFAULT_POOL_NAME in BaseOperator +It was not possible to patch pool in BaseOperator as the signature sets the default value of pool +as Pool.DEFAULT_POOL_NAME. +While using subdagoperator in unittest(without initializing the sqlite db), it was throwing the +following error: +``` +sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) no such table: slot_pool. +``` +Fix for this, https://github.com/apache/airflow/pull/8587 + ### Change signature of BigQueryGetDatasetTablesOperator Was: ```python diff --git a/airflow/models/baseoperator.py b/airflow/models/baseoperator.py index 2e431ca21dcf9..a9576a1681127 100644 --- a/airflow/models/baseoperator.py +++ b/airflow/models/baseoperator.py @@ -316,7 +316,7 @@ def __init__( priority_weight: int = 1, weight_rule: str = WeightRule.DOWNSTREAM, queue: str = conf.get('celery', 'default_queue'), - pool: str = Pool.DEFAULT_POOL_NAME, + pool: Optional[str] = None, pool_slots: int = 1, sla: Optional[timedelta] = None, execution_timeout: Optional[timedelta] = None, @@ -385,7 +385,7 @@ def __init__( self.retries = retries self.queue = queue - self.pool = pool + self.pool = Pool.DEFAULT_POOL_NAME if pool is None else pool self.pool_slots = pool_slots if self.pool_slots < 1: raise AirflowException("pool slots for %s in dag %s cannot be less than 1" diff --git a/tests/serialization/test_dag_serialization.py b/tests/serialization/test_dag_serialization.py index 9dda878592006..6580744494a1e 100644 --- a/tests/serialization/test_dag_serialization.py +++ b/tests/serialization/test_dag_serialization.py @@ -70,6 +70,7 @@ "bash_command": "echo {{ task.task_id }}", "_task_type": "BashOperator", "_task_module": "airflow.operators.bash", + "pool": "default_pool", }, { "task_id": "custom_task", @@ -84,6 +85,7 @@ "template_fields": ['bash_command'], "_task_type": "CustomOperator", "_task_module": "tests.test_utils.mock_operators", + "pool": "default_pool", }, ], "timezone": "UTC",