tasking 2.0.0__tar.gz → 2.1.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.
- {tasking-2.0.0 → tasking-2.1.0}/PKG-INFO +3 -3
- {tasking-2.0.0 → tasking-2.1.0}/README.rst +1 -1
- {tasking-2.0.0 → tasking-2.1.0}/doc/conf.py +2 -2
- {tasking-2.0.0 → tasking-2.1.0}/doc/readme.rst +1 -1
- {tasking-2.0.0 → tasking-2.1.0}/pyproject.toml +2 -2
- {tasking-2.0.0 → tasking-2.1.0}/src/tasking/task.py +4 -1
- {tasking-2.0.0 → tasking-2.1.0}/src/tasking/version.py +1 -1
- {tasking-2.0.0 → tasking-2.1.0}/src/tasking.egg-info/PKG-INFO +3 -3
- {tasking-2.0.0 → tasking-2.1.0}/test/test_task.py +17 -13
- {tasking-2.0.0 → tasking-2.1.0}/AUTHORS.rst +0 -0
- {tasking-2.0.0 → tasking-2.1.0}/CONTRIBUTING.rst +0 -0
- {tasking-2.0.0 → tasking-2.1.0}/HISTORY.rst +0 -0
- {tasking-2.0.0 → tasking-2.1.0}/LICENSE +0 -0
- {tasking-2.0.0 → tasking-2.1.0}/doc/Makefile +0 -0
- {tasking-2.0.0 → tasking-2.1.0}/doc/authors.rst +0 -0
- {tasking-2.0.0 → tasking-2.1.0}/doc/badges/listing.rst +0 -0
- {tasking-2.0.0 → tasking-2.1.0}/doc/biblio/biblio.rst +0 -0
- {tasking-2.0.0 → tasking-2.1.0}/doc/contributing.rst +0 -0
- {tasking-2.0.0 → tasking-2.1.0}/doc/history.rst +0 -0
- {tasking-2.0.0 → tasking-2.1.0}/doc/index.rst +0 -0
- {tasking-2.0.0 → tasking-2.1.0}/doc/installation.rst +0 -0
- {tasking-2.0.0 → tasking-2.1.0}/doc/make.bat +0 -0
- {tasking-2.0.0 → tasking-2.1.0}/doc/management.rst +0 -0
- {tasking-2.0.0 → tasking-2.1.0}/doc/usage.rst +0 -0
- {tasking-2.0.0 → tasking-2.1.0}/doc/user/index.rst +0 -0
- {tasking-2.0.0 → tasking-2.1.0}/doc/user/overview.rst +0 -0
- {tasking-2.0.0 → tasking-2.1.0}/requirements.txt +0 -0
- {tasking-2.0.0 → tasking-2.1.0}/requirements_minimal.txt +0 -0
- {tasking-2.0.0 → tasking-2.1.0}/setup.cfg +0 -0
- {tasking-2.0.0 → tasking-2.1.0}/src/tasking/__init__.py +0 -0
- {tasking-2.0.0 → tasking-2.1.0}/src/tasking/scheduler.py +0 -0
- {tasking-2.0.0 → tasking-2.1.0}/src/tasking.egg-info/SOURCES.txt +0 -0
- {tasking-2.0.0 → tasking-2.1.0}/src/tasking.egg-info/dependency_links.txt +0 -0
- {tasking-2.0.0 → tasking-2.1.0}/src/tasking.egg-info/requires.txt +0 -0
- {tasking-2.0.0 → tasking-2.1.0}/src/tasking.egg-info/top_level.txt +0 -0
- {tasking-2.0.0 → tasking-2.1.0}/test/conftest.py +0 -0
- {tasking-2.0.0 → tasking-2.1.0}/test/test_packaging.py +0 -0
- {tasking-2.0.0 → tasking-2.1.0}/test/test_scheduler.py +0 -0
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: tasking
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.1.0
|
|
4
4
|
Summary: Perform time simulation, using scheduled tasks to update current state
|
|
5
5
|
Author-email: revesansparole <revesansparole@gmail.com>
|
|
6
6
|
Maintainer-email: revesansparole <revesansparole@gmail.com>, Jerome Chopard <revesansparole@gmail.com>
|
|
7
7
|
License: cc_by_nc
|
|
8
8
|
Project-URL: repository, https://gitlab.com/revesansparole/tasking
|
|
9
|
-
Project-URL: pip, https://pypi.org/project/tasking/2.
|
|
9
|
+
Project-URL: pip, https://pypi.org/project/tasking/2.1.0/
|
|
10
10
|
Project-URL: conda, https://anaconda.org/revesansparole/tasking
|
|
11
11
|
Project-URL: documentation, https://revesansparole.gitlab.io/tasking/
|
|
12
12
|
Project-URL: pypi, https://badge.fury.io/py/tasking
|
|
@@ -48,7 +48,7 @@ tasking
|
|
|
48
48
|
|
|
49
49
|
.. image:: https://revesansparole.gitlab.io/tasking/_images/badge_pkging_pip.svg
|
|
50
50
|
:alt: PyPI version
|
|
51
|
-
:target: https://pypi.org/project/tasking/2.
|
|
51
|
+
:target: https://pypi.org/project/tasking/2.1.0/
|
|
52
52
|
|
|
53
53
|
.. image:: https://revesansparole.gitlab.io/tasking/_images/badge_pkging_conda.svg
|
|
54
54
|
:alt: Conda version
|
|
@@ -6,7 +6,7 @@ tasking
|
|
|
6
6
|
|
|
7
7
|
.. image:: https://revesansparole.gitlab.io/tasking/_images/badge_pkging_pip.svg
|
|
8
8
|
:alt: PyPI version
|
|
9
|
-
:target: https://pypi.org/project/tasking/2.
|
|
9
|
+
:target: https://pypi.org/project/tasking/2.1.0/
|
|
10
10
|
|
|
11
11
|
.. image:: https://revesansparole.gitlab.io/tasking/_images/badge_pkging_conda.svg
|
|
12
12
|
:alt: Conda version
|
|
@@ -5,7 +5,7 @@ Overview
|
|
|
5
5
|
|
|
6
6
|
.. image:: https://revesansparole.gitlab.io/tasking/_images/badge_pkging_pip.svg
|
|
7
7
|
:alt: PyPI version
|
|
8
|
-
:target: https://pypi.org/project/tasking/2.
|
|
8
|
+
:target: https://pypi.org/project/tasking/2.1.0/
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
.. image:: https://revesansparole.gitlab.io/tasking/_images/badge_pkging_conda.svg
|
|
@@ -8,7 +8,7 @@ build-backend = "setuptools.build_meta" # we don't know if we need it
|
|
|
8
8
|
# {# pkglts, pyproject.project
|
|
9
9
|
[project] # https://packaging.python.org/en/latest/specifications/pyproject-toml/
|
|
10
10
|
name = "tasking"
|
|
11
|
-
version = "2.
|
|
11
|
+
version = "2.1.0"
|
|
12
12
|
description = "Perform time simulation, using scheduled tasks to update current state"
|
|
13
13
|
readme = "README.rst"
|
|
14
14
|
requires-python = ">= 3.7"
|
|
@@ -59,7 +59,7 @@ test = [
|
|
|
59
59
|
|
|
60
60
|
[project.urls]
|
|
61
61
|
repository = "https://gitlab.com/revesansparole/tasking"
|
|
62
|
-
pip = "https://pypi.org/project/tasking/2.
|
|
62
|
+
pip = "https://pypi.org/project/tasking/2.1.0/"
|
|
63
63
|
conda = "https://anaconda.org/revesansparole/tasking"
|
|
64
64
|
documentation = "https://revesansparole.gitlab.io/tasking/"
|
|
65
65
|
pypi = "https://badge.fury.io/py/tasking"
|
|
@@ -84,7 +84,10 @@ class TaskCached(Task):
|
|
|
84
84
|
self.need_update(clock, prev_clock, state, params)
|
|
85
85
|
self._need_update = False
|
|
86
86
|
|
|
87
|
-
|
|
87
|
+
if clock == prev_clock:
|
|
88
|
+
return None # last call to this task
|
|
89
|
+
|
|
90
|
+
return clock + (clock - prev_clock) # heuristic to ensure this task is called each time step
|
|
88
91
|
|
|
89
92
|
def need_update(self, clock, prev_clock, state, params):
|
|
90
93
|
pass
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: tasking
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.1.0
|
|
4
4
|
Summary: Perform time simulation, using scheduled tasks to update current state
|
|
5
5
|
Author-email: revesansparole <revesansparole@gmail.com>
|
|
6
6
|
Maintainer-email: revesansparole <revesansparole@gmail.com>, Jerome Chopard <revesansparole@gmail.com>
|
|
7
7
|
License: cc_by_nc
|
|
8
8
|
Project-URL: repository, https://gitlab.com/revesansparole/tasking
|
|
9
|
-
Project-URL: pip, https://pypi.org/project/tasking/2.
|
|
9
|
+
Project-URL: pip, https://pypi.org/project/tasking/2.1.0/
|
|
10
10
|
Project-URL: conda, https://anaconda.org/revesansparole/tasking
|
|
11
11
|
Project-URL: documentation, https://revesansparole.gitlab.io/tasking/
|
|
12
12
|
Project-URL: pypi, https://badge.fury.io/py/tasking
|
|
@@ -48,7 +48,7 @@ tasking
|
|
|
48
48
|
|
|
49
49
|
.. image:: https://revesansparole.gitlab.io/tasking/_images/badge_pkging_pip.svg
|
|
50
50
|
:alt: PyPI version
|
|
51
|
-
:target: https://pypi.org/project/tasking/2.
|
|
51
|
+
:target: https://pypi.org/project/tasking/2.1.0/
|
|
52
52
|
|
|
53
53
|
.. image:: https://revesansparole.gitlab.io/tasking/_images/badge_pkging_conda.svg
|
|
54
54
|
:alt: Conda version
|
|
@@ -1,17 +1,13 @@
|
|
|
1
1
|
from tasking.task import TaskCached, TaskRecord
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
class TotoState:
|
|
5
|
-
duration: int = 1
|
|
6
|
-
|
|
7
|
-
|
|
8
4
|
class Toto(TaskCached):
|
|
9
5
|
def __init__(self):
|
|
10
6
|
super().__init__()
|
|
11
7
|
self.a = -1
|
|
12
8
|
|
|
13
|
-
def need_update(self,
|
|
14
|
-
self.a =
|
|
9
|
+
def need_update(self, clock, prev_clock, state, params):
|
|
10
|
+
self.a = clock
|
|
15
11
|
|
|
16
12
|
|
|
17
13
|
def test_task_record_stores_data():
|
|
@@ -38,16 +34,24 @@ def test_task_cached_only_update_when_required():
|
|
|
38
34
|
t = Toto()
|
|
39
35
|
assert t.a == -1
|
|
40
36
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
37
|
+
prev_clock = -1
|
|
38
|
+
clock = 0
|
|
39
|
+
next_clock = t.update(clock, prev_clock, None, None)
|
|
40
|
+
assert next_clock == 1
|
|
44
41
|
assert t.a == 0
|
|
45
42
|
|
|
46
|
-
|
|
47
|
-
|
|
43
|
+
prev_clock = clock
|
|
44
|
+
clock = next_clock
|
|
45
|
+
next_clock = t.update(clock, prev_clock, None, None)
|
|
46
|
+
assert next_clock == 2
|
|
48
47
|
assert t.a == 0
|
|
49
48
|
|
|
50
49
|
t.invalidate()
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
prev_clock = clock
|
|
51
|
+
clock = next_clock
|
|
52
|
+
next_clock = t.update(clock, prev_clock, None, None)
|
|
53
|
+
assert next_clock == 3
|
|
53
54
|
assert t.a == 2
|
|
55
|
+
|
|
56
|
+
clock = next_clock
|
|
57
|
+
assert t.update(clock, clock, None, None) is None
|
|
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
|