|
The Airflow scheduler is a core component, which makes it very sensitive to change, meaning that even improvements need to undergo very thorough checks and reviews, that makes it hard to push new improvements and fixes to the scheduler.
There cannot be 1 scheduler that will work for all possible cases and workloads, due to the flexibility that airflow allows.
Allowing the scheduler class to change, even as an external package, may open a lot of new possibilities, without hindering the flexibility that airflow currently gives, allowing for alternative schedulers and experiments in the scheduler to run, without interfering with or being directly under the airflow package, lowering the maintenance burden from the main airflow repository, and using it as community packages, just like is possible with executors in airflow.
There are a few considerations about the given AIP, mainly, from the security perspective, as the scheduler is a core component which has full read and write access to the db, and a bad actor may be able to exploit to gain access to secrets.
Will the 'external scheduler' be considered a trusted or not, as it did not come from the airflow repository, as this will change the implementation design of the feature.
Implementing a flag in the 'airflow scheduler' command to allow the change of the class that the command runs in order to start up the scheduler, allowing to change all or part of the implementations of the scheduler by extending the existing SchedulerJobRunner class, the command to run such a scheduler should look as such: 'airflow scheduler --impl "com.my.scheduler.NewScheduler
Chart changes are also needed, to allow for the deployment of a custom scheduler implementation selection (a string for python package / class), with control over how many custom schedulers to run (to allow for safe blue/green like deployment).
A deployment with a custom implementation will have the following values:
scheduler:
custom:
enabled: true
package: "com.my.scheduler.NewScheduler"
instances: 2 |
As of now, developing on the scheduler has to happen very delicately, and thoroughly checked, with countless manual tests that need to be run by the person who wants to make a change, a good example is pr #54103, where a change that should increase the schedulers efficiency is proposed, it required the author (alone) to run tests and collect metrics, if such a feature to allow for plugability of the scheduler existed, the scheduler could be developed as a third party module, tested by the community, which would allow for increased efficiency in testing and development phase, and would provide more insights than a single person can on a change to core airflow scheduler logic.
Developing new features for the scheduler tends to require heavy testing work (in addition to approval from project members), which is usually done by one person, the one who is developing the feature, which leaves a lot of room for error, as the developer has to deploy and entire cluster to check the scheduler under production workflows.
An example could be making sleep operator not take up an executor slot, and becoming a "special case" just like empty operator, this requires changes to the scheduler core logic, which may hinder certain workflows, but will improve a workflow that uses the sleep operator a lot, in this case, having a plugable scheduler, and having control over how many of the schedulers run as the custom implementation would make testing the new logic much simpler, as the developer could enroll it into his production environment and gradually increase the count of schedulers which have the new feature, allowing for proper testing, catching more edge cases and having a proper full scale proof of concept for the new feature, aiding in the decision of approving such changes, as they may already have community approval.
Due to the wide variety of workflows that are run using airflow, the current scheduler might not work well for all of the use cases, sometimes improvements are proposed, yet they need to be checked with all existing workflows and the specific workflows they are optimizing for.
The change affects only the following roles:
Users should not be affected by the change, the change will not affect the end users by default, only if the implementation is changed, only then will the users feel a change (i.e scheduling decisions, new concurrency limits, etc) .
N/A
It is possible to change the implementation of part or all of the scheduler instances, allowing for alternate custom tailored implementations and allowing for faster exploration and development of features.