nuclearpinguin commented on a change in pull request #6760: [AIRFLOW-6157] Separate out common protocol for executors. URL: https://github.com/apache/airflow/pull/6760#discussion_r355399064
########## File path: airflow/executors/base_executor.py ########## @@ -42,7 +43,124 @@ QueuedTaskInstanceType = Tuple[CommandType, int, Optional[str], SimpleTaskInstance] -class BaseExecutor(LoggingMixin): +class BaseExecutorProtocol(LoggingMixin): + """ + Base Protocol implemented by all executors including multiple executors. + """ + + def __init__(self): + super().__init__() + + def start(self): # pragma: no cover + """ + Executors may need to get things started. + """ + raise NotImplementedError() + + def has_task(self, task_instance: TaskInstance) -> bool: + """ + Checks if a task is either queued or running in this executor. + + :param task_instance: TaskInstance + :return: True if the task is known to this executor + """ + raise NotImplementedError() + + def sync(self) -> None: + """ + Sync will get called periodically by the heartbeat method. + Executors should override this to perform gather statuses. + """ + raise NotImplementedError() Review comment: I just wonder if do I have to implement everything? I miss some information what is the purpose of the protocol. For example `sync` is usually called only by `heartbeat` so if I do not use it there, do I have to implement it? ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
