jscheffl commented on code in PR #51716:
URL: https://github.com/apache/airflow/pull/51716#discussion_r2146875112
##########
providers/edge3/src/airflow/providers/edge3/executors/edge_executor.py:
##########
@@ -79,6 +79,13 @@ def _check_db_schema(self, engine: Engine) -> None:
if edge_job_columns and "concurrency_slots" not in edge_job_columns:
EdgeJobModel.metadata.drop_all(engine,
tables=[EdgeJobModel.__table__])
+ # Increase command column size in edge_job table to support larger
commands
+ if edge_job_columns and "command" in edge_job_columns:
Review Comment:
If think the criteria is not correct. The "command" column is always
existing. Also we should ALTER the table only if needed. How about this? So
meaning you check the length and only alter if the length is different?
```
with contextlib.suppress(NoSuchTableError):
edge_job_schema = inspector.get_columns("edge_job")
edge_job_columns = [column["name"] for column in edge_job_schema]
for column in edge_job_schema:
if column["name"] == "command":
edge_job_command_len = column["type"].length
# version 0.6.0rc1 added new column concurrency_slots
if edge_job_columns and "concurrency_slots" not in edge_job_columns:
EdgeJobModel.metadata.drop_all(engine,
tables=[EdgeJobModel.__table__])
# after version 1.1.0 the command column was changed to VARCHAR(2048)
elif edge_job_command_len and edge_job_command_len != 2048:
with Session(engine) as session:
query = "ALTER TABLE edge_job ALTER COLUMN command TYPE
VARCHAR(2048);"
session.execute(text(query))
session.commit()
edge_worker_columns = None
with contextlib.suppress(NoSuchTableError):
edge_worker_columns = [column["name"] for column in
inspector.get_columns("edge_worker")]
```
##########
providers/edge3/src/airflow/providers/edge3/executors/edge_executor.py:
##########
@@ -79,6 +79,13 @@ def _check_db_schema(self, engine: Engine) -> None:
if edge_job_columns and "concurrency_slots" not in edge_job_columns:
EdgeJobModel.metadata.drop_all(engine,
tables=[EdgeJobModel.__table__])
+ # Increase command column size in edge_job table to support larger
commands
+ if edge_job_columns and "command" in edge_job_columns:
+ with Session(engine) as session:
+ query = "ALTER TABLE edge_job ALTER COLUMN command TYPE
VARCHAR(2048);"
Review Comment:
providers/edge3/src/airflow/providers/edge3/models/edge_job.py:52 must be
adjusted accordingly
--
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]