Skip to content

Commit

Permalink
Add 'threadpool' as option (#60)
Browse files Browse the repository at this point in the history
  • Loading branch information
tarsil authored Jun 10, 2024
1 parent f8ae777 commit aabade3
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions asyncz/_mapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ def triggers(self) -> Dict[str, str]:
def executors(self) -> Dict[str, str]:
return {
"debug": "asyncz.executors.debug:DebugExecutor",
"pool": "asyncz.executors.pool:ThreadPoolExecutor",
"threadpool": "asyncz.executors.pool:ThreadPoolExecutor",
"processpool": "asyncz.executors.pool:ProcessPoolExecutor",
"asyncio": "asyncz.executors.asyncio:AsyncIOExecutor",
Expand Down
19 changes: 19 additions & 0 deletions tests/contrib/esmerald/test_esmerald_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,22 @@ def test_config():
scheduler = AsyncIOScheduler(global_config=global_config, stores=stores)
scheduler.start()
scheduler.shutdown()


def test_config_with_esmerald():
global_config = {
"asyncz.stores.mongo": {"type": "mongodb"},
"asyncz.stores.default": {"type": "redis", "database": "0"},
"asyncz.executors.pool": {
"max_workers": "20",
"class": "asyncz.executors.pool:ThreadPoolExecutor",
},
"asyncz.executors.default": {"class": "asyncz.executors.asyncio:AsyncIOExecutor"},
"asyncz.task_defaults.coalesce": "false",
"asyncz.task_defaults.max_instances": "3",
"asyncz.task_defaults.timezone": "UTC",
}
stores = {"mongodb": MongoDBStore()}
scheduler = AsyncIOScheduler(global_config=global_config, stores=stores)
scheduler.start()
scheduler.shutdown()

0 comments on commit aabade3

Please sign in to comment.