Skip to content

Commit

Permalink
Adaptions for asyncz>=0.11, fix typo (#373)
Browse files Browse the repository at this point in the history
- adapt changed add_task signature
- fix compatibility with asyncz>=0.11 (tests)
- fix typo in docs_src
  • Loading branch information
devkral authored Aug 2, 2024
1 parent a15908d commit d915830
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 17 deletions.
2 changes: 1 addition & 1 deletion docs_src/configurations/openapi/apiview.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
routes=[...],
docs_url="/another-url/swagger",
redoc_url="/another-url/redoc",
redoc_url="/another-url/stoplight",
stoplight_url="/another-url/stoplight",
)
14 changes: 7 additions & 7 deletions esmerald/contrib/schedulers/asyncz/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from asyncz.schedulers import AsyncIOScheduler
from asyncz.schedulers.types import SchedulerType
from asyncz.triggers.types import TriggerType
from asyncz.typing import UndefinedType, undefined
from asyncz.typing import Undefined, undefined

from esmerald.conf import settings
from esmerald.contrib.schedulers.base import SchedulerConfig
Expand Down Expand Up @@ -148,12 +148,12 @@ def __init__(
name: Union[str, None] = None,
trigger: Union[TriggerType, None] = None,
id: Union[str, None] = None,
mistrigger_grace_time: Union[int, UndefinedType, None] = undefined,
coalesce: Union[bool, UndefinedType] = undefined,
max_instances: Union[int, UndefinedType, None] = undefined,
next_run_time: Union[datetime, str, UndefinedType, None] = undefined,
store: str = "default",
executor: str = "default",
mistrigger_grace_time: Union[int, Undefined, None] = undefined,
coalesce: Union[bool, Undefined] = undefined,
max_instances: Union[int, Undefined, None] = undefined,
next_run_time: Union[datetime, str, Undefined, None] = undefined,
store: Union[str, None] = None,
executor: Union[str, None] = None,
replace_existing: bool = False,
args: Union[Any, None] = None,
kwargs: Union[Dict[str, Any], None] = None,
Expand Down
14 changes: 7 additions & 7 deletions esmerald/contrib/schedulers/asyncz/decorator.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from typing import Any, Dict, Optional, Union, cast

from asyncz.triggers.types import TriggerType
from asyncz.typing import UndefinedType, undefined
from asyncz.typing import Undefined, undefined

from esmerald.contrib.schedulers.asyncz.config import Task

Expand All @@ -12,12 +12,12 @@ def scheduler(
name: Optional[str] = None,
trigger: Optional[TriggerType] = None,
id: Optional[str] = None,
mistrigger_grace_time: Union[int, UndefinedType, None] = undefined,
coalesce: Union[bool, UndefinedType] = undefined,
max_instances: Union[int, UndefinedType, None] = undefined,
next_run_time: Union[datetime, str, UndefinedType, None] = undefined,
store: Optional[str] = "default",
executor: Optional[str] = "default",
mistrigger_grace_time: Union[int, Undefined, None] = undefined,
coalesce: Union[bool, Undefined] = undefined,
max_instances: Union[int, Undefined, None] = undefined,
next_run_time: Union[datetime, str, Undefined, None] = undefined,
store: Union[str, None] = None,
executor: Union[str, None] = None,
replace_existing: bool = True,
extra_args: Optional[Any] = None,
extra_kwargs: Optional[Dict[str, Any]] = None,
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ dev = [
templates = ["mako>=1.2.4,<2.0.0"]
jwt = ["passlib==1.7.4", "python-jose>=3.3.0,<4"]
encoders = ["ujson>=5.7.0,<6"]
schedulers = ["asyncz>=0.10.0"]
schedulers = ["asyncz>=0.11.0"]
all = [
"esmerald[test,dev,templates,jwt,encoders,schedulers]",
"ipython",
Expand Down
4 changes: 3 additions & 1 deletion tests/schedulers/asyncz/test_scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import pytest
from asyncz.executors.base import BaseExecutor
from asyncz.schedulers import AsyncIOScheduler
from asyncz.schedulers.base import BaseScheduler
from asyncz.schedulers.base import BaseScheduler, default_loggers_class
from asyncz.schedulers.datastructures import TaskDefaultStruct
from asyncz.stores.base import BaseStore
from asyncz.tasks.types import TaskType
Expand Down Expand Up @@ -113,6 +113,8 @@ def scheduler_class(monkeypatch):
# by patching out _setup task_defaults are not initialized anymore
scheduler_class.task_defaults = TaskDefaultStruct()
scheduler_class.timezone = timezone.utc
scheduler_class.loggers = default_loggers_class()
scheduler_class.logger_name = "asyncz.schedulers"
return scheduler_class


Expand Down

0 comments on commit d915830

Please sign in to comment.