asyncz 0.4.0__tar.gz → 0.6.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {asyncz-0.4.0 → asyncz-0.6.0}/PKG-INFO +12 -9
- asyncz-0.6.0/asyncz/__init__.py +1 -0
- {asyncz-0.4.0 → asyncz-0.6.0}/asyncz/contrib/esmerald/decorator.py +2 -2
- {asyncz-0.4.0 → asyncz-0.6.0}/asyncz/contrib/esmerald/scheduler.py +4 -4
- {asyncz-0.4.0 → asyncz-0.6.0}/asyncz/executors/base.py +0 -1
- {asyncz-0.4.0 → asyncz-0.6.0}/asyncz/schedulers/base.py +0 -1
- {asyncz-0.4.0 → asyncz-0.6.0}/asyncz/state.py +3 -0
- {asyncz-0.4.0 → asyncz-0.6.0}/asyncz/stores/mongo.py +1 -1
- {asyncz-0.4.0 → asyncz-0.6.0}/asyncz/tasks/base.py +4 -0
- {asyncz-0.4.0 → asyncz-0.6.0}/asyncz/triggers/base.py +2 -0
- {asyncz-0.4.0 → asyncz-0.6.0}/asyncz/triggers/cron/fields.py +1 -1
- {asyncz-0.4.0 → asyncz-0.6.0}/asyncz/triggers/interval.py +0 -4
- {asyncz-0.4.0 → asyncz-0.6.0}/pyproject.toml +14 -21
- asyncz-0.4.0/asyncz/__init__.py +0 -1
- {asyncz-0.4.0 → asyncz-0.6.0}/.gitignore +0 -0
- {asyncz-0.4.0 → asyncz-0.6.0}/LICENSE +0 -0
- {asyncz-0.4.0 → asyncz-0.6.0}/README.md +0 -0
- {asyncz-0.4.0 → asyncz-0.6.0}/asyncz/_mapping.py +0 -0
- {asyncz-0.4.0 → asyncz-0.6.0}/asyncz/contrib/__init__.py +0 -0
- {asyncz-0.4.0 → asyncz-0.6.0}/asyncz/contrib/esmerald/__init__.py +0 -0
- {asyncz-0.4.0 → asyncz-0.6.0}/asyncz/datastructures.py +0 -0
- {asyncz-0.4.0 → asyncz-0.6.0}/asyncz/enums.py +0 -0
- {asyncz-0.4.0 → asyncz-0.6.0}/asyncz/events/__init__.py +0 -0
- {asyncz-0.4.0 → asyncz-0.6.0}/asyncz/events/base.py +0 -0
- {asyncz-0.4.0 → asyncz-0.6.0}/asyncz/events/constants.py +0 -0
- {asyncz-0.4.0 → asyncz-0.6.0}/asyncz/exceptions.py +0 -0
- {asyncz-0.4.0 → asyncz-0.6.0}/asyncz/executors/__init__.py +0 -0
- {asyncz-0.4.0 → asyncz-0.6.0}/asyncz/executors/asyncio.py +0 -0
- {asyncz-0.4.0 → asyncz-0.6.0}/asyncz/executors/debug.py +0 -0
- {asyncz-0.4.0 → asyncz-0.6.0}/asyncz/executors/pool.py +0 -0
- {asyncz-0.4.0 → asyncz-0.6.0}/asyncz/executors/types.py +0 -0
- {asyncz-0.4.0 → asyncz-0.6.0}/asyncz/py.typed +0 -0
- {asyncz-0.4.0 → asyncz-0.6.0}/asyncz/schedulers/__init__.py +0 -0
- {asyncz-0.4.0 → asyncz-0.6.0}/asyncz/schedulers/asyncio.py +0 -0
- {asyncz-0.4.0 → asyncz-0.6.0}/asyncz/schedulers/datastructures.py +0 -0
- {asyncz-0.4.0 → asyncz-0.6.0}/asyncz/schedulers/types.py +0 -0
- {asyncz-0.4.0 → asyncz-0.6.0}/asyncz/schedulers/utils.py +0 -0
- {asyncz-0.4.0 → asyncz-0.6.0}/asyncz/stores/__init__.py +0 -0
- {asyncz-0.4.0 → asyncz-0.6.0}/asyncz/stores/base.py +0 -0
- {asyncz-0.4.0 → asyncz-0.6.0}/asyncz/stores/memory.py +0 -0
- {asyncz-0.4.0 → asyncz-0.6.0}/asyncz/stores/redis.py +0 -0
- {asyncz-0.4.0 → asyncz-0.6.0}/asyncz/stores/types.py +0 -0
- {asyncz-0.4.0 → asyncz-0.6.0}/asyncz/tasks/__init__.py +0 -0
- {asyncz-0.4.0 → asyncz-0.6.0}/asyncz/tasks/types.py +0 -0
- {asyncz-0.4.0 → asyncz-0.6.0}/asyncz/triggers/__init__.py +0 -0
- {asyncz-0.4.0 → asyncz-0.6.0}/asyncz/triggers/combination.py +0 -0
- {asyncz-0.4.0 → asyncz-0.6.0}/asyncz/triggers/cron/__init__.py +0 -0
- {asyncz-0.4.0 → asyncz-0.6.0}/asyncz/triggers/cron/constants.py +0 -0
- {asyncz-0.4.0 → asyncz-0.6.0}/asyncz/triggers/cron/expressions.py +0 -0
- {asyncz-0.4.0 → asyncz-0.6.0}/asyncz/triggers/cron/trigger.py +0 -0
- {asyncz-0.4.0 → asyncz-0.6.0}/asyncz/triggers/cron/types.py +0 -0
- {asyncz-0.4.0 → asyncz-0.6.0}/asyncz/triggers/date.py +0 -0
- {asyncz-0.4.0 → asyncz-0.6.0}/asyncz/triggers/types.py +0 -0
- {asyncz-0.4.0 → asyncz-0.6.0}/asyncz/typing.py +0 -0
- {asyncz-0.4.0 → asyncz-0.6.0}/asyncz/utils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
2
|
Name: asyncz
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.6.0
|
|
4
4
|
Summary: The scheduler that nobody wants but every application needs.
|
|
5
5
|
Project-URL: Homepage, https://github.com/tarsil/asyncz
|
|
6
6
|
Project-URL: Documentation, https://asyncz.tarsild.io/
|
|
@@ -27,6 +27,7 @@ Classifier: Programming Language :: Python :: 3.8
|
|
|
27
27
|
Classifier: Programming Language :: Python :: 3.9
|
|
28
28
|
Classifier: Programming Language :: Python :: 3.10
|
|
29
29
|
Classifier: Programming Language :: Python :: 3.11
|
|
30
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
30
31
|
Classifier: Topic :: Internet
|
|
31
32
|
Classifier: Topic :: Internet :: WWW/HTTP
|
|
32
33
|
Classifier: Topic :: Internet :: WWW/HTTP :: HTTP Servers
|
|
@@ -38,7 +39,7 @@ Classifier: Typing :: Typed
|
|
|
38
39
|
Requires-Python: >=3.8
|
|
39
40
|
Requires-Dist: asyncio<4.0.0,>=3.4.3
|
|
40
41
|
Requires-Dist: loguru<0.8.0,>=0.7.0
|
|
41
|
-
Requires-Dist: pydantic<3.0.0,>=2.
|
|
42
|
+
Requires-Dist: pydantic<3.0.0,>=2.5.3
|
|
42
43
|
Requires-Dist: pytz>=2022.6
|
|
43
44
|
Requires-Dist: tzlocal<5.0,>=4.2
|
|
44
45
|
Provides-Extra: all
|
|
@@ -47,12 +48,14 @@ Requires-Dist: pytz>=2022.6; extra == 'all'
|
|
|
47
48
|
Requires-Dist: tzlocal<5.0,>=4.2; extra == 'all'
|
|
48
49
|
Provides-Extra: dev
|
|
49
50
|
Requires-Dist: autoflake<3.0.0,>=1.4.0; extra == 'dev'
|
|
50
|
-
Requires-Dist: black
|
|
51
|
-
Requires-Dist: flake8<
|
|
51
|
+
Requires-Dist: black==24.4.2; extra == 'dev'
|
|
52
|
+
Requires-Dist: flake8<8.0.0,>=3.8.3; extra == 'dev'
|
|
53
|
+
Requires-Dist: ipdb>=0.13.13; extra == 'dev'
|
|
52
54
|
Requires-Dist: isort<6.0.0,>=5.0.6; extra == 'dev'
|
|
53
55
|
Requires-Dist: mypy<2.0.0,>=0.982; extra == 'dev'
|
|
56
|
+
Requires-Dist: pdbpp; extra == 'dev'
|
|
54
57
|
Requires-Dist: pre-commit<3.0.0,>=2.17.0; extra == 'dev'
|
|
55
|
-
Requires-Dist: watchfiles<0.
|
|
58
|
+
Requires-Dist: watchfiles<0.22.0,>=0.16.1; extra == 'dev'
|
|
56
59
|
Provides-Extra: doc
|
|
57
60
|
Requires-Dist: mdx-include<2.0.0,>=1.4.2; extra == 'doc'
|
|
58
61
|
Requires-Dist: mkautodoc<0.3.0,>=0.2.0; extra == 'doc'
|
|
@@ -65,10 +68,10 @@ Provides-Extra: test
|
|
|
65
68
|
Requires-Dist: mock>=4.0.3; extra == 'test'
|
|
66
69
|
Requires-Dist: pymongo<5.0.0,>=4.3.3; extra == 'test'
|
|
67
70
|
Requires-Dist: pytest-asyncio<1.0.0,>=0.19.0; extra == 'test'
|
|
68
|
-
Requires-Dist: pytest-cov<
|
|
71
|
+
Requires-Dist: pytest-cov<6.0.0,>=2.12.0; extra == 'test'
|
|
69
72
|
Requires-Dist: pytest-loguru<1,>=0.2.0; extra == 'test'
|
|
70
|
-
Requires-Dist: pytest<
|
|
71
|
-
Requires-Dist: redis<
|
|
73
|
+
Requires-Dist: pytest<9.0.0,>=7.1.3; extra == 'test'
|
|
74
|
+
Requires-Dist: redis<6.0.0,>=4.4.0; extra == 'test'
|
|
72
75
|
Requires-Dist: requests<3.0.0,>=2.27.0; extra == 'test'
|
|
73
76
|
Requires-Dist: ruff<1.0.0,>=0.0.256; extra == 'test'
|
|
74
77
|
Description-Content-Type: text/markdown
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.6.0"
|
|
@@ -14,7 +14,7 @@ class scheduler(Task):
|
|
|
14
14
|
id: Optional[str] = None,
|
|
15
15
|
mistrigger_grace_time: Optional[int] = None,
|
|
16
16
|
coalesce: Optional[bool] = None,
|
|
17
|
-
|
|
17
|
+
max_instances: Optional[int] = None,
|
|
18
18
|
next_run_time: Optional[datetime] = None,
|
|
19
19
|
store: Optional[str] = "default",
|
|
20
20
|
executor: Optional[str] = "default",
|
|
@@ -29,7 +29,7 @@ class scheduler(Task):
|
|
|
29
29
|
id=id,
|
|
30
30
|
mistrigger_grace_time=mistrigger_grace_time,
|
|
31
31
|
coalesce=coalesce,
|
|
32
|
-
|
|
32
|
+
max_instances=max_instances,
|
|
33
33
|
next_run_time=next_run_time,
|
|
34
34
|
store=store,
|
|
35
35
|
executor=executor,
|
|
@@ -145,7 +145,7 @@ class Task:
|
|
|
145
145
|
id: Optional[str] = None,
|
|
146
146
|
mistrigger_grace_time: Optional[int] = None,
|
|
147
147
|
coalesce: Optional[bool] = None,
|
|
148
|
-
|
|
148
|
+
max_instances: Optional[int] = None,
|
|
149
149
|
next_run_time: Optional[datetime] = None,
|
|
150
150
|
store: Optional[str] = "default",
|
|
151
151
|
executor: Optional[str] = "default",
|
|
@@ -163,7 +163,7 @@ class Task:
|
|
|
163
163
|
mistrigger_grace_time: Seconds after the designated runtime that the task is still allowed to be run (or None to allow the task to run no
|
|
164
164
|
matter how late it is).
|
|
165
165
|
coalesce: Run once instead of many times if the scheduler determines that the task should be run more than once in succession.
|
|
166
|
-
|
|
166
|
+
max_instances: Maximum number of concurrently running instances allowed for this task.
|
|
167
167
|
next_run_time: When to first run the task, regardless of the trigger (pass None to add the task as paused).
|
|
168
168
|
store: Alias of the task store to store the task in.
|
|
169
169
|
executor: Alias of the executor to run the task with.
|
|
@@ -178,7 +178,7 @@ class Task:
|
|
|
178
178
|
self.id = id
|
|
179
179
|
self.mistrigger_grace_time = mistrigger_grace_time or undefined
|
|
180
180
|
self.coalesce = coalesce or undefined
|
|
181
|
-
self.
|
|
181
|
+
self.max_instances = max_instances or undefined
|
|
182
182
|
self.next_run_time = next_run_time or undefined
|
|
183
183
|
self.store = store
|
|
184
184
|
self.executor = executor
|
|
@@ -199,7 +199,7 @@ class Task:
|
|
|
199
199
|
name=self.name,
|
|
200
200
|
mistrigger_grace_time=self.mistrigger_grace_time,
|
|
201
201
|
coalesce=self.coalesce,
|
|
202
|
-
max_instances=self.
|
|
202
|
+
max_instances=self.max_instances,
|
|
203
203
|
next_run_time=self.next_run_time,
|
|
204
204
|
store=self.store,
|
|
205
205
|
executor=self.executor,
|
|
@@ -61,7 +61,6 @@ class BaseExecutor(BaseStateExtra, ABC):
|
|
|
61
61
|
run_times: A list of datetimes specifying when the task should have been run.
|
|
62
62
|
"""
|
|
63
63
|
assert self.lock is not None, "This executor has not been started yet."
|
|
64
|
-
|
|
65
64
|
with self.lock:
|
|
66
65
|
if self.instances[task.id] >= task.max_instances:
|
|
67
66
|
raise MaximumInstancesError(task.id, task.max_instances)
|
|
@@ -14,12 +14,15 @@ class BaseState(BaseModel):
|
|
|
14
14
|
"""
|
|
15
15
|
Retrives the data pickled and sets the state for Pydantic compatible fashion.
|
|
16
16
|
"""
|
|
17
|
+
state.model_config.update(self.model_config)
|
|
17
18
|
object_setattr(self, "__dict__", state.__dict__)
|
|
18
19
|
object_setattr(self, "__pydantic_fields_set__", state.__pydantic_fields_set__)
|
|
20
|
+
object_setattr(self, "__pydantic_extra__", state.__pydantic_extra__)
|
|
19
21
|
for name, value in state.__private_attributes__.items():
|
|
20
22
|
if callable(value) or inspect.iscoroutinefunction(value):
|
|
21
23
|
value = value.__name__
|
|
22
24
|
object_setattr(self, name, value)
|
|
25
|
+
|
|
23
26
|
return self
|
|
24
27
|
|
|
25
28
|
|
|
@@ -64,7 +64,7 @@ class MongoDBStore(BaseStore):
|
|
|
64
64
|
|
|
65
65
|
def rebuild_task(self, state: Any) -> "TaskType":
|
|
66
66
|
state = pickle.loads(state)
|
|
67
|
-
task = Task.__new__(
|
|
67
|
+
task = Task.__new__(Task)
|
|
68
68
|
task.__setstate__(state)
|
|
69
69
|
task.scheduler = self.scheduler
|
|
70
70
|
task.store_alias = self.alias
|
|
@@ -54,6 +54,8 @@ class Task(BaseStateExtra):
|
|
|
54
54
|
args: Optional[Any] = None
|
|
55
55
|
kwargs: Optional[Any] = None
|
|
56
56
|
next_run_time: Optional[datetime] = None
|
|
57
|
+
scheduler: Any = None
|
|
58
|
+
store_alias: Optional[str] = None
|
|
57
59
|
|
|
58
60
|
def __init__(
|
|
59
61
|
self,
|
|
@@ -220,6 +222,8 @@ class Task(BaseStateExtra):
|
|
|
220
222
|
def __setstate__(self, state):
|
|
221
223
|
object_setattr(self, "__dict__", state.__dict__)
|
|
222
224
|
object_setattr(self, "__pydantic_fields_set__", state.__pydantic_fields_set__)
|
|
225
|
+
object_setattr(self, "__pydantic_extra__", state.__pydantic_extra__)
|
|
226
|
+
state.model_config.update(self.model_config)
|
|
223
227
|
|
|
224
228
|
for name, value in self.__dict__.items():
|
|
225
229
|
if name == "fn":
|
|
@@ -94,10 +94,6 @@ class IntervalTrigger(BaseTrigger):
|
|
|
94
94
|
)
|
|
95
95
|
return state
|
|
96
96
|
|
|
97
|
-
def __setstate__(self, state: Any) -> None:
|
|
98
|
-
trigger = super().__setstate__(state)
|
|
99
|
-
trigger.interval_size = timedelta_seconds(self.interval)
|
|
100
|
-
|
|
101
97
|
def __str__(self) -> str:
|
|
102
98
|
return f"interval[{self.interval}]"
|
|
103
99
|
|
|
@@ -34,13 +34,14 @@ classifiers = [
|
|
|
34
34
|
"Programming Language :: Python :: 3.9",
|
|
35
35
|
"Programming Language :: Python :: 3.10",
|
|
36
36
|
"Programming Language :: Python :: 3.11",
|
|
37
|
+
"Programming Language :: Python :: 3.12",
|
|
37
38
|
"Topic :: Internet :: WWW/HTTP :: HTTP Servers",
|
|
38
39
|
"Topic :: Internet :: WWW/HTTP",
|
|
39
40
|
]
|
|
40
41
|
dependencies = [
|
|
41
42
|
"asyncio>=3.4.3,<4.0.0",
|
|
42
43
|
"loguru>=0.7.0,<0.8.0",
|
|
43
|
-
"pydantic>=2.
|
|
44
|
+
"pydantic>=2.5.3,<3.0.0",
|
|
44
45
|
"pytz>=2022.6",
|
|
45
46
|
"tzlocal>=4.2,<5.0",
|
|
46
47
|
]
|
|
@@ -76,23 +77,25 @@ test = [
|
|
|
76
77
|
# "esmerald==0.4.2",
|
|
77
78
|
"mock>=4.0.3",
|
|
78
79
|
"pymongo>=4.3.3,<5.0.0",
|
|
79
|
-
"pytest
|
|
80
|
-
"pytest-cov >=2.12.0,<
|
|
80
|
+
"pytest>=7.1.3,<9.0.0",
|
|
81
|
+
"pytest-cov >=2.12.0,<6.0.0",
|
|
81
82
|
"pytest-asyncio >=0.19.0,<1.0.0",
|
|
82
83
|
"pytest-loguru>=0.2.0,<1",
|
|
83
|
-
"redis>=4.4.0,<
|
|
84
|
+
"redis>=4.4.0,<6.0.0",
|
|
84
85
|
"requests >=2.27.0,<3.0.0",
|
|
85
86
|
"ruff>=0.0.256,<1.0.0",
|
|
86
87
|
]
|
|
87
88
|
|
|
88
89
|
dev = [
|
|
89
|
-
"autoflake
|
|
90
|
-
"black
|
|
91
|
-
"flake8>=3.8.3,<
|
|
90
|
+
"autoflake>=1.4.0,<3.0.0",
|
|
91
|
+
"black==24.4.2",
|
|
92
|
+
"flake8>=3.8.3,<8.0.0",
|
|
93
|
+
"ipdb>=0.13.13",
|
|
94
|
+
"pdbpp",
|
|
92
95
|
"isort>=5.0.6,<6.0.0",
|
|
93
96
|
"mypy>=0.982,<2.0.0",
|
|
94
97
|
"pre-commit>=2.17.0,<3.0.0",
|
|
95
|
-
"watchfiles>=0.16.1,<0.
|
|
98
|
+
"watchfiles>=0.16.1,<0.22.0",
|
|
96
99
|
]
|
|
97
100
|
|
|
98
101
|
doc = [
|
|
@@ -128,19 +131,9 @@ disable_error_code = "attr-defined"
|
|
|
128
131
|
warn_unused_ignores = true
|
|
129
132
|
warn_redundant_casts = true
|
|
130
133
|
|
|
131
|
-
[tool.ruff]
|
|
132
|
-
select = [
|
|
133
|
-
|
|
134
|
-
"W", # pycodestyle warnings
|
|
135
|
-
"F", # pyflakes
|
|
136
|
-
"C", # flake8-comprehensions
|
|
137
|
-
"B", # flake8-bugbear
|
|
138
|
-
]
|
|
139
|
-
ignore = [
|
|
140
|
-
"E501", # line too long, handled by black
|
|
141
|
-
"B008", # do not perform function calls in argument defaults
|
|
142
|
-
"C901", # too complex
|
|
143
|
-
]
|
|
134
|
+
[tool.ruff.lint]
|
|
135
|
+
select = ["E", "W", "F", "C", "B", "I"]
|
|
136
|
+
ignore = ["E501", "B008", "C901", "B026"]
|
|
144
137
|
|
|
145
138
|
exclude = ["docs_src/*"]
|
|
146
139
|
|
asyncz-0.4.0/asyncz/__init__.py
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.4.0"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|