eventdispatch 0.2.24__tar.gz → 0.2.27__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.
- {eventdispatch-0.2.24/eventdispatch.egg-info → eventdispatch-0.2.27}/PKG-INFO +7 -3
- {eventdispatch-0.2.24 → eventdispatch-0.2.27}/README.md +1 -1
- {eventdispatch-0.2.24 → eventdispatch-0.2.27}/eventdispatch/common1.py +1 -1
- {eventdispatch-0.2.24 → eventdispatch-0.2.27}/eventdispatch/core.py +5 -1
- {eventdispatch-0.2.24 → eventdispatch-0.2.27}/eventdispatch/example1.py +12 -12
- {eventdispatch-0.2.24 → eventdispatch-0.2.27/eventdispatch.egg-info}/PKG-INFO +7 -3
- {eventdispatch-0.2.24 → eventdispatch-0.2.27}/pyproject.toml +1 -1
- {eventdispatch-0.2.24 → eventdispatch-0.2.27}/setup.py +1 -1
- {eventdispatch-0.2.24 → eventdispatch-0.2.27}/LICENSE +0 -0
- {eventdispatch-0.2.24 → eventdispatch-0.2.27}/NOTICE +0 -0
- {eventdispatch-0.2.24 → eventdispatch-0.2.27}/eventdispatch/__init__.py +0 -0
- {eventdispatch-0.2.24 → eventdispatch-0.2.27}/eventdispatch/composite_semaphore.py +0 -0
- {eventdispatch-0.2.24 → eventdispatch-0.2.27}/eventdispatch/example2.py +0 -0
- {eventdispatch-0.2.24 → eventdispatch-0.2.27}/eventdispatch.egg-info/SOURCES.txt +0 -0
- {eventdispatch-0.2.24 → eventdispatch-0.2.27}/eventdispatch.egg-info/dependency_links.txt +0 -0
- {eventdispatch-0.2.24 → eventdispatch-0.2.27}/eventdispatch.egg-info/entry_points.txt +0 -0
- {eventdispatch-0.2.24 → eventdispatch-0.2.27}/eventdispatch.egg-info/requires.txt +0 -0
- {eventdispatch-0.2.24 → eventdispatch-0.2.27}/eventdispatch.egg-info/top_level.txt +0 -0
- {eventdispatch-0.2.24 → eventdispatch-0.2.27}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: eventdispatch
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.27
|
|
4
4
|
Summary: Event Dispatch: discrete time synchronization
|
|
5
5
|
Home-page: http://github.com/cyan-at/python-eventdispatch
|
|
6
6
|
Author: Charlie Yan
|
|
@@ -216,6 +216,10 @@ Requires-Python: >=3.9
|
|
|
216
216
|
Description-Content-Type: text/markdown
|
|
217
217
|
License-File: LICENSE
|
|
218
218
|
License-File: NOTICE
|
|
219
|
+
Requires-Dist: argparse
|
|
220
|
+
Dynamic: author
|
|
221
|
+
Dynamic: home-page
|
|
222
|
+
Dynamic: license-file
|
|
219
223
|
|
|
220
224
|
# <a href="https://github.com/cyan-at/python-eventdispatch" target="_blank">python-eventdispatch</a>
|
|
221
225
|
Event Dispatch: discrete time synchronization, Markov control
|
|
@@ -224,7 +228,7 @@ Event Dispatch: discrete time synchronization, Markov control
|
|
|
224
228
|
|
|
225
229
|
The latest documentation on <a href="https://python-eventdispatch.readthedocs.io/en/latest/" target="_blank">readthedocs</a>
|
|
226
230
|
|
|
227
|
-
## python3: apt installation
|
|
231
|
+
## ~~python3: apt installation~~
|
|
228
232
|
```
|
|
229
233
|
sudo add-apt-repository ppa:cyanatlaunchpad/python3-eventdispatch-ppa
|
|
230
234
|
sudo apt update
|
|
@@ -5,7 +5,7 @@ Event Dispatch: discrete time synchronization, Markov control
|
|
|
5
5
|
|
|
6
6
|
The latest documentation on <a href="https://python-eventdispatch.readthedocs.io/en/latest/" target="_blank">readthedocs</a>
|
|
7
7
|
|
|
8
|
-
## python3: apt installation
|
|
8
|
+
## ~~python3: apt installation~~
|
|
9
9
|
```
|
|
10
10
|
sudo add-apt-repository ppa:cyanatlaunchpad/python3-eventdispatch-ppa
|
|
11
11
|
sudo apt update
|
|
@@ -194,7 +194,7 @@ class TimerWait(CommonEvent):
|
|
|
194
194
|
self.blackboard[event_dispatch.cv_name].release()
|
|
195
195
|
|
|
196
196
|
self.blackboard.pop(self.k)
|
|
197
|
-
elif self.blackboard[self.k]['status'] ==
|
|
197
|
+
elif self.blackboard[self.k]['status'] == TIMERWAIT_BAILED:
|
|
198
198
|
self.log("TimerWait bailed! noop")
|
|
199
199
|
|
|
200
200
|
class BlackboardQueueCVED(EventDispatch):
|
|
@@ -145,6 +145,8 @@ class Event(object):
|
|
|
145
145
|
self.event_dispatch = None
|
|
146
146
|
# not fixed, can be changed across different dispatches
|
|
147
147
|
|
|
148
|
+
self.daemon = True # default to shutdown cleanly, children override
|
|
149
|
+
|
|
148
150
|
# methods for the child to override
|
|
149
151
|
def get_id(self):
|
|
150
152
|
# return self.__class__.__name__ + "@" + str(self.event_id)
|
|
@@ -225,7 +227,9 @@ class EventDispatch(object):
|
|
|
225
227
|
# to the event dispatch, giving access / control
|
|
226
228
|
# over other events
|
|
227
229
|
callback=lambda event = event, args = args, kwargs = kwargs:\
|
|
228
|
-
self.dispatch_finish(event, *args, **kwargs)
|
|
230
|
+
self.dispatch_finish(event, *args, **kwargs),
|
|
231
|
+
daemon=event.daemon
|
|
232
|
+
)
|
|
229
233
|
self.thread_registry[event.get_id()].start()
|
|
230
234
|
# NOTE: events must deal with exceptions internally
|
|
231
235
|
|
|
@@ -32,22 +32,22 @@ class WorkItemEvent(CommonEvent):
|
|
|
32
32
|
self.blackboard[event_dispatch.cv_name].acquire()
|
|
33
33
|
self.blackboard[event_dispatch.queue_name].extend([
|
|
34
34
|
[
|
|
35
|
-
"
|
|
35
|
+
"UncertainEvent1",
|
|
36
36
|
args[0]-1
|
|
37
37
|
],
|
|
38
38
|
[
|
|
39
|
-
"
|
|
39
|
+
"UncertainEvent2",
|
|
40
40
|
args[0]-1
|
|
41
41
|
]
|
|
42
42
|
])
|
|
43
43
|
self.blackboard[event_dispatch.cv_name].notify(1)
|
|
44
44
|
self.blackboard[event_dispatch.cv_name].release()
|
|
45
45
|
|
|
46
|
-
class
|
|
46
|
+
class UncertainEvent1(CommonEvent):
|
|
47
47
|
debug_color = bcolors.CYAN
|
|
48
48
|
|
|
49
49
|
def dispatch(self, event_dispatch, *args, **kwargs):
|
|
50
|
-
self.log("
|
|
50
|
+
self.log("UncertainEvent1 dispatch!", args, kwargs)
|
|
51
51
|
|
|
52
52
|
time.sleep(random.randint(1, 5))
|
|
53
53
|
|
|
@@ -55,11 +55,11 @@ class UncertaintEvent1(CommonEvent):
|
|
|
55
55
|
self.blackboard["result1"] = random.randint(1, 5)
|
|
56
56
|
|
|
57
57
|
def finish(self, event_dispatch, *args, **kwargs):
|
|
58
|
-
self.log("
|
|
58
|
+
self.log("UncertainEvent1 finish!", args, kwargs)
|
|
59
59
|
|
|
60
60
|
with self.blackboard["result_mutex"]:
|
|
61
61
|
if self.blackboard["result2"] > 0:
|
|
62
|
-
self.log("
|
|
62
|
+
self.log("UncertainEvent2 wins")
|
|
63
63
|
|
|
64
64
|
s = self.blackboard["result1"] + self.blackboard["result2"]
|
|
65
65
|
self.blackboard["result1"] = 0
|
|
@@ -76,11 +76,11 @@ class UncertaintEvent1(CommonEvent):
|
|
|
76
76
|
self.blackboard[event_dispatch.cv_name].notify(1)
|
|
77
77
|
self.blackboard[event_dispatch.cv_name].release()
|
|
78
78
|
|
|
79
|
-
class
|
|
79
|
+
class UncertainEvent2(CommonEvent):
|
|
80
80
|
debug_color = bcolors.MAGENTA
|
|
81
81
|
|
|
82
82
|
def dispatch(self, event_dispatch, *args, **kwargs):
|
|
83
|
-
self.log("
|
|
83
|
+
self.log("UncertainEvent2 dispatch!", args, kwargs)
|
|
84
84
|
|
|
85
85
|
time.sleep(random.randint(1, 10))
|
|
86
86
|
|
|
@@ -88,11 +88,11 @@ class UncertaintEvent2(CommonEvent):
|
|
|
88
88
|
self.blackboard["result2"] = random.randint(1, 10)
|
|
89
89
|
|
|
90
90
|
def finish(self, event_dispatch, *args, **kwargs):
|
|
91
|
-
self.log("
|
|
91
|
+
self.log("UncertainEvent2 finish!", args, kwargs)
|
|
92
92
|
|
|
93
93
|
with self.blackboard["result_mutex"]:
|
|
94
94
|
if self.blackboard["result1"] > 0:
|
|
95
|
-
self.log("
|
|
95
|
+
self.log("UncertainEvent1 wins")
|
|
96
96
|
|
|
97
97
|
s = self.blackboard["result1"] + self.blackboard["result2"]
|
|
98
98
|
self.blackboard["result1"] = 0
|
|
@@ -257,8 +257,8 @@ def main():
|
|
|
257
257
|
|
|
258
258
|
# 1. Populate the `Blackboard` with `Event` declarations (name : type pairs)
|
|
259
259
|
blackboard["WorkItemEvent"] = WorkItemEvent
|
|
260
|
-
blackboard["
|
|
261
|
-
blackboard["
|
|
260
|
+
blackboard["UncertainEvent1"] = UncertainEvent1
|
|
261
|
+
blackboard["UncertainEvent2"] = UncertainEvent2
|
|
262
262
|
blackboard["CheckEvent1"] = CheckEvent1
|
|
263
263
|
|
|
264
264
|
blackboard["result_mutex"] = threading.Lock()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: eventdispatch
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.27
|
|
4
4
|
Summary: Event Dispatch: discrete time synchronization
|
|
5
5
|
Home-page: http://github.com/cyan-at/python-eventdispatch
|
|
6
6
|
Author: Charlie Yan
|
|
@@ -216,6 +216,10 @@ Requires-Python: >=3.9
|
|
|
216
216
|
Description-Content-Type: text/markdown
|
|
217
217
|
License-File: LICENSE
|
|
218
218
|
License-File: NOTICE
|
|
219
|
+
Requires-Dist: argparse
|
|
220
|
+
Dynamic: author
|
|
221
|
+
Dynamic: home-page
|
|
222
|
+
Dynamic: license-file
|
|
219
223
|
|
|
220
224
|
# <a href="https://github.com/cyan-at/python-eventdispatch" target="_blank">python-eventdispatch</a>
|
|
221
225
|
Event Dispatch: discrete time synchronization, Markov control
|
|
@@ -224,7 +228,7 @@ Event Dispatch: discrete time synchronization, Markov control
|
|
|
224
228
|
|
|
225
229
|
The latest documentation on <a href="https://python-eventdispatch.readthedocs.io/en/latest/" target="_blank">readthedocs</a>
|
|
226
230
|
|
|
227
|
-
## python3: apt installation
|
|
231
|
+
## ~~python3: apt installation~~
|
|
228
232
|
```
|
|
229
233
|
sudo add-apt-repository ppa:cyanatlaunchpad/python3-eventdispatch-ppa
|
|
230
234
|
sudo apt update
|
|
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
|