File tree Expand file tree Collapse file tree 2 files changed +16
-12
lines changed Expand file tree Collapse file tree 2 files changed +16
-12
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,9 @@ Please use [this](https://docs.gitlab.com/ee/development/changelog.html) documen
77### Fixed
88
99* ci: Removed ` black 21.12b0 ` dependency since bug in ` datamodel-codegen-generator ` is fixed.
10+ * config: Verify ` advanced.scheduler ` config for correctness unsupported features.
1011* hasura: Fixed processing relation fields with missing ` related_name ` .
12+ * jobs: Fixed default ` apscheduler ` config.
1113
1214## 4.2.2 - 2022-02-01
1315
Original file line number Diff line number Diff line change 1+ import json
12from contextlib import AsyncExitStack
23from datetime import datetime
34from functools import partial
1819from dipdup .utils .database import in_global_transaction
1920
2021DEFAULT_CONFIG = {
21- 'jobstores' : {
22- 'default' : {
23- 'class' : 'apscheduler.jobstores.memory:MemoryJobStore' ,
24- },
25- },
26- 'executors' : {
27- 'default' : {
28- 'class' : 'dipdup.executors.asyncio:AsyncIOExecutor' ,
29- },
30- },
31- 'timezone' : 'UTC' ,
22+ 'apscheduler.jobstores.default.class' : 'apscheduler.jobstores.memory:MemoryJobStore' ,
23+ 'apscheduler.executors.default.class' : 'apscheduler.executors.asyncio:AsyncIOExecutor' ,
24+ 'apscheduler.timezone' : 'UTC' ,
3225}
3326
3427
3528def create_scheduler (config : Optional [Dict [str , Any ]] = None ) -> AsyncIOScheduler :
36- return AsyncIOScheduler (config or DEFAULT_CONFIG )
29+ if not config :
30+ return AsyncIOScheduler (DEFAULT_CONFIG )
31+
32+ json_config = json .dumps (config )
33+ if 'apscheduler.executors.pool' in json_config :
34+ raise ConfigurationError ('`apscheduler.executors.pool` is not supported. If needed, create a pool inside a regular hook.' )
35+ for key in config :
36+ if not key .startswith ('apscheduler.' ):
37+ raise ConfigurationError ('`advanced.scheduler` config keys must start with `apscheduler.`, see apscheduler library docs' )
38+ return AsyncIOScheduler (config )
3739
3840
3941def add_job (ctx : DipDupContext , scheduler : AsyncIOScheduler , job_config : JobConfig ) -> None :
You can’t perform that action at this time.
0 commit comments