Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove redundant scheduler_lock column from dag table #43023

Merged
merged 12 commits into from
Oct 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions airflow/api_connexion/openapi/v1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3069,14 +3069,6 @@ components:
Time when the DAG last received a refresh signal
(e.g. the DAG's "refresh" button was clicked in the web UI)

*New in version 2.3.0*
scheduler_lock:
type: boolean
readOnly: true
nullable: true
description: |
Whether (one of) the scheduler is scheduling this DAG at the moment

*New in version 2.3.0*
pickle_id:
type: string
Expand Down
1 change: 0 additions & 1 deletion airflow/api_connexion/schemas/dag_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ class Meta:
last_parsed_time = auto_field(dump_only=True)
last_pickled = auto_field(dump_only=True)
last_expired = auto_field(dump_only=True)
scheduler_lock = auto_field(dump_only=True)
pickle_id = auto_field(dump_only=True)
default_view = auto_field(dump_only=True)
fileloc = auto_field(dump_only=True)
Expand Down
21 changes: 0 additions & 21 deletions airflow/api_fastapi/core_api/openapi/v1-generated.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1681,12 +1681,6 @@ components:
format: date-time
- type: 'null'
title: Last Expired
scheduler_lock:
anyOf:
- type: string
format: date-time
- type: 'null'
title: Scheduler Lock
pickle_id:
anyOf:
- type: string
Expand Down Expand Up @@ -1851,7 +1845,6 @@ components:
- last_parsed_time
- last_pickled
- last_expired
- scheduler_lock
- pickle_id
- default_view
- fileloc
Expand Down Expand Up @@ -1928,12 +1921,6 @@ components:
format: date-time
- type: 'null'
title: Last Expired
scheduler_lock:
anyOf:
- type: string
format: date-time
- type: 'null'
title: Scheduler Lock
pickle_id:
anyOf:
- type: string
Expand Down Expand Up @@ -2028,7 +2015,6 @@ components:
- last_parsed_time
- last_pickled
- last_expired
- scheduler_lock
- pickle_id
- default_view
- fileloc
Expand Down Expand Up @@ -2238,12 +2224,6 @@ components:
format: date-time
- type: 'null'
title: Last Expired
scheduler_lock:
anyOf:
- type: string
format: date-time
- type: 'null'
title: Scheduler Lock
pickle_id:
anyOf:
- type: string
Expand Down Expand Up @@ -2343,7 +2323,6 @@ components:
- last_parsed_time
- last_pickled
- last_expired
- scheduler_lock
- pickle_id
- default_view
- fileloc
Expand Down
1 change: 0 additions & 1 deletion airflow/api_fastapi/core_api/serializers/dags.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ class DAGResponse(BaseModel):
last_parsed_time: datetime | None
last_pickled: datetime | None
last_expired: datetime | None
scheduler_lock: datetime | None
pickle_id: datetime | None
default_view: str | None
fileloc: str
Expand Down
1 change: 0 additions & 1 deletion airflow/cli/commands/dag_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,6 @@ def _get_dagbag_dag_details(dag: DAG) -> dict:
"last_parsed_time": None,
"last_pickled": None,
"last_expired": None,
"scheduler_lock": None,
"pickle_id": dag.pickle_id,
"default_view": dag.default_view,
"fileloc": dag.fileloc,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

"""
remove scheduler_lock column.

Revision ID: 486ac7936b78
Revises: d59cbbef95eb
Create Date: 2024-10-23 07:48:52.494396

"""

from __future__ import annotations

import sqlalchemy as sa
from alembic import op

revision = "486ac7936b78"
down_revision = "d59cbbef95eb"
branch_labels = None
depends_on = None
airflow_version = "3.0.0"


def upgrade():
"""Apply remove scheduler_lock column."""
with op.batch_alter_table("dag", schema=None) as batch_op:
batch_op.drop_column("scheduler_lock")


def downgrade():
"""Unapply remove scheduler_lock column."""
with op.batch_alter_table("dag", schema=None) as batch_op:
batch_op.add_column(sa.Column("scheduler_lock", sa.BOOLEAN(), autoincrement=False, nullable=True))
2 changes: 0 additions & 2 deletions airflow/models/dag.py
Original file line number Diff line number Diff line change
Expand Up @@ -2818,8 +2818,6 @@ class DagModel(Base):
# Time when the DAG last received a refresh signal
# (e.g. the DAG's "refresh" button was clicked in the web UI)
last_expired = Column(UtcDateTime)
# Whether (one of) the scheduler is scheduling this DAG at the moment
scheduler_lock = Column(Boolean)
prabhusneha marked this conversation as resolved.
Show resolved Hide resolved
# Foreign key to the latest pickle_id
pickle_id = Column(Integer)
# The location of the file containing the DAG object
Expand Down
1 change: 0 additions & 1 deletion airflow/serialization/pydantic/dag.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ class DagModelPydantic(BaseModelPydantic):
last_parsed_time: Optional[datetime]
last_pickled: Optional[datetime]
last_expired: Optional[datetime]
scheduler_lock: Optional[bool]
pickle_id: Optional[int]
fileloc: str
processor_subdir: Optional[str]
Expand Down
39 changes: 0 additions & 39 deletions airflow/ui/openapi-gen/requests/schemas.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -295,18 +295,6 @@ export const $DAGDetailsResponse = {
],
title: "Last Expired",
},
scheduler_lock: {
anyOf: [
{
type: "string",
format: "date-time",
},
{
type: "null",
},
],
title: "Scheduler Lock",
},
pickle_id: {
anyOf: [
{
Expand Down Expand Up @@ -607,7 +595,6 @@ export const $DAGDetailsResponse = {
"last_parsed_time",
"last_pickled",
"last_expired",
"scheduler_lock",
"pickle_id",
"default_view",
"fileloc",
Expand Down Expand Up @@ -712,18 +699,6 @@ export const $DAGResponse = {
],
title: "Last Expired",
},
scheduler_lock: {
anyOf: [
{
type: "string",
format: "date-time",
},
{
type: "null",
},
],
title: "Scheduler Lock",
},
pickle_id: {
anyOf: [
{
Expand Down Expand Up @@ -889,7 +864,6 @@ export const $DAGResponse = {
"last_parsed_time",
"last_pickled",
"last_expired",
"scheduler_lock",
"pickle_id",
"default_view",
"fileloc",
Expand Down Expand Up @@ -1196,18 +1170,6 @@ export const $DAGWithLatestDagRunsResponse = {
],
title: "Last Expired",
},
scheduler_lock: {
anyOf: [
{
type: "string",
format: "date-time",
},
{
type: "null",
},
],
title: "Scheduler Lock",
},
pickle_id: {
anyOf: [
{
Expand Down Expand Up @@ -1380,7 +1342,6 @@ export const $DAGWithLatestDagRunsResponse = {
"last_parsed_time",
"last_pickled",
"last_expired",
"scheduler_lock",
"pickle_id",
"default_view",
"fileloc",
Expand Down
3 changes: 0 additions & 3 deletions airflow/ui/openapi-gen/requests/types.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ export type DAGDetailsResponse = {
last_parsed_time: string | null;
last_pickled: string | null;
last_expired: string | null;
scheduler_lock: string | null;
pickle_id: string | null;
default_view: string | null;
fileloc: string;
Expand Down Expand Up @@ -132,7 +131,6 @@ export type DAGResponse = {
last_parsed_time: string | null;
last_pickled: string | null;
last_expired: string | null;
scheduler_lock: string | null;
pickle_id: string | null;
default_view: string | null;
fileloc: string;
Expand Down Expand Up @@ -225,7 +223,6 @@ export type DAGWithLatestDagRunsResponse = {
last_parsed_time: string | null;
last_pickled: string | null;
last_expired: string | null;
scheduler_lock: string | null;
pickle_id: string | null;
default_view: string | null;
fileloc: string;
Expand Down
1 change: 0 additions & 1 deletion airflow/ui/src/pages/DagsList/DagCard.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ const mockDag = {
next_dagrun_data_interval_start: "2024-08-22T00:00:00+00:00",
owners: ["airflow"],
pickle_id: null,
scheduler_lock: null,
tags: [],
timetable_description: "",
timetable_summary: "",
Expand Down
2 changes: 1 addition & 1 deletion airflow/utils/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ class MappedClassProtocol(Protocol):
"2.9.2": "686269002441",
"2.10.0": "22ed7efa9da2",
"2.10.3": "5f2621c13b39",
"3.0.0": "d59cbbef95eb",
"3.0.0": "486ac7936b78",
}


Expand Down
6 changes: 0 additions & 6 deletions airflow/www/static/js/types/api-generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1058,12 +1058,6 @@ export interface components {
* *New in version 2.3.0*
*/
last_expired?: string | null;
/**
* @description Whether (one of) the scheduler is scheduling this DAG at the moment
*
* *New in version 2.3.0*
*/
scheduler_lock?: boolean | null;
/**
* @description Foreign key to the latest pickle_id
*
Expand Down
2 changes: 1 addition & 1 deletion docs/apache-airflow/img/airflow_erd.sha256
Original file line number Diff line number Diff line change
@@ -1 +1 @@
621811bf2476a947cf52d8b75149e2be7e0ec9d383eda551b1c6496c44f2a22d
247d6705552b669793ce92a4e15c9b225b1f852d5cbc066f204ec7eb21e77ca7
Loading