agronholm / apscheduler

Task scheduling library for Python
MIT License
6.3k stars 712 forks source link

Allow more job defaults' config to be passed #941

Closed Kenchir closed 3 months ago

Kenchir commented 4 months ago

Things to check first

Feature description

Currently, BaseScheduler accepts job_defaults parameter. However, it only defaults to three configs being stored irregardless of any config passed. This can be a bug or enhancement .

Use case

As below function- only 3 defaults are being stored.

def _configure(self, config):
        # Set general options
        self._logger = maybe_ref(config.pop('logger', None)) or getLogger('apscheduler.scheduler')
        self.timezone = astimezone(config.pop('timezone', None)) or get_localzone()
        self.jobstore_retry_interval = float(config.pop('jobstore_retry_interval', 10))

        # Set the job defaults
        job_defaults = config.get('job_defaults', {})
        self._job_defaults = {
            'misfire_grace_time': asint(job_defaults.get('misfire_grace_time', 1)),
            'coalesce': asbool(job_defaults.get('coalesce', True)),
            'max_instances': asint(job_defaults.get('max_instances', 1))
        }