o-nikolas commented on code in PR #38054: URL: https://github.com/apache/airflow/pull/38054#discussion_r1520513280
########## airflow/migrations/versions/0137_2_9_0_add_new_executor_field_to_db.py: ########## @@ -0,0 +1,48 @@ +# +# 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. + +"""add new executor field to db + +Revision ID: 677fdbb7fc54 +Revises: ab34f260b71c +Create Date: 2024-03-11 15:26:59.186579 + +""" + +import sqlalchemy as sa +from alembic import op + + +# revision identifiers, used by Alembic. +revision = '677fdbb7fc54' +down_revision = 'ab34f260b71c' +branch_labels = None +depends_on = None +airflow_version = '2.9.0' + + +def upgrade(): + """Apply add executor field to task instance""" + # NOTE: I cannot find a straightforward sdk doc for SA types. I don't know + # if I need default=None. No idea how to tell what are the defaults without docs Review Comment: Looking for feedback on this, thanks! ########## airflow/models/baseoperator.py: ########## @@ -719,6 +724,8 @@ class derived from this one results in the creation of a task object, "on_skipped_callback", "do_xcom_push", "multiple_outputs", + # TODO: should executor go here? I think so + "executor", Review Comment: Looking for feedback on this, thanks! ########## airflow/models/taskinstance.py: ########## @@ -1252,6 +1254,8 @@ class TaskInstance(Base, LoggingMixin): queued_dttm = Column(UtcDateTime) queued_by_job_id = Column(Integer) pid = Column(Integer) + # TODO: Should this be nullable? + executor = Column(String(1000)) Review Comment: I believe this should be nullable, but just flagging this to be doublechecked in review. ########## airflow/models/abstractoperator.py: ########## @@ -58,6 +58,8 @@ DEFAULT_OWNER: str = conf.get_mandatory_value("operators", "default_owner") DEFAULT_POOL_SLOTS: int = 1 DEFAULT_PRIORITY_WEIGHT: int = 1 +# TODO: Is None the right thing here? We want NULL essentially Review Comment: Looking for feedback on this, thanks! ########## airflow/models/baseoperator.py: ########## @@ -255,6 +257,7 @@ def partial( on_retry_callback: None | TaskStateChangeCallback | list[TaskStateChangeCallback] | ArgNotSet = NOTSET, on_skipped_callback: None | TaskStateChangeCallback | list[TaskStateChangeCallback] | ArgNotSet = NOTSET, run_as_user: str | None | ArgNotSet = NOTSET, + executor: str | None = None, Review Comment: I'm just noticing now that others are using NOTSET, instead of None. I'll update this unless anyone else things otherwise. -- 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]
