eventdispatch 0.3.0__tar.gz → 0.3.1__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.
Files changed (24) hide show
  1. {eventdispatch-0.3.0/eventdispatch.egg-info → eventdispatch-0.3.1}/PKG-INFO +1 -1
  2. {eventdispatch-0.3.0 → eventdispatch-0.3.1}/eventdispatch/common1.py +1 -1
  3. eventdispatch-0.3.0/eventdispatch/example_learning.py → eventdispatch-0.3.1/eventdispatch/example_recording.py +10 -10
  4. eventdispatch-0.3.0/eventdispatch/learning.py → eventdispatch-0.3.1/eventdispatch/recording.py +19 -22
  5. {eventdispatch-0.3.0 → eventdispatch-0.3.1}/eventdispatch/sim.py +3 -3
  6. {eventdispatch-0.3.0 → eventdispatch-0.3.1/eventdispatch.egg-info}/PKG-INFO +1 -1
  7. {eventdispatch-0.3.0 → eventdispatch-0.3.1}/eventdispatch.egg-info/SOURCES.txt +2 -2
  8. {eventdispatch-0.3.0 → eventdispatch-0.3.1}/pyproject.toml +1 -1
  9. {eventdispatch-0.3.0 → eventdispatch-0.3.1}/setup.py +1 -1
  10. {eventdispatch-0.3.0 → eventdispatch-0.3.1}/tests/test_recording.py +2 -2
  11. {eventdispatch-0.3.0 → eventdispatch-0.3.1}/LICENSE +0 -0
  12. {eventdispatch-0.3.0 → eventdispatch-0.3.1}/NOTICE +0 -0
  13. {eventdispatch-0.3.0 → eventdispatch-0.3.1}/README.md +0 -0
  14. {eventdispatch-0.3.0 → eventdispatch-0.3.1}/eventdispatch/__init__.py +0 -0
  15. {eventdispatch-0.3.0 → eventdispatch-0.3.1}/eventdispatch/composite_semaphore.py +0 -0
  16. {eventdispatch-0.3.0 → eventdispatch-0.3.1}/eventdispatch/core.py +0 -0
  17. {eventdispatch-0.3.0 → eventdispatch-0.3.1}/eventdispatch/example_core.py +0 -0
  18. {eventdispatch-0.3.0 → eventdispatch-0.3.1}/eventdispatch/example_cs.py +0 -0
  19. {eventdispatch-0.3.0 → eventdispatch-0.3.1}/eventdispatch/example_sim_mujoco.py +0 -0
  20. {eventdispatch-0.3.0 → eventdispatch-0.3.1}/eventdispatch.egg-info/dependency_links.txt +0 -0
  21. {eventdispatch-0.3.0 → eventdispatch-0.3.1}/eventdispatch.egg-info/entry_points.txt +0 -0
  22. {eventdispatch-0.3.0 → eventdispatch-0.3.1}/eventdispatch.egg-info/requires.txt +0 -0
  23. {eventdispatch-0.3.0 → eventdispatch-0.3.1}/eventdispatch.egg-info/top_level.txt +0 -0
  24. {eventdispatch-0.3.0 → eventdispatch-0.3.1}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: eventdispatch
3
- Version: 0.3.0
3
+ Version: 0.3.1
4
4
  Summary: Event Dispatch: discrete time synchronization
5
5
  Home-page: http://github.com/cyan-at/python-eventdispatch
6
6
  Author: Charlie Yan
@@ -161,7 +161,7 @@ class ClockedEvent(CommonEvent):
161
161
  a CommonEvent that reads its dispatch's clock.
162
162
 
163
163
  The shared base of SimEvent (eventdispatch.sim) and
164
- RecordingEvent (eventdispatch.learning): the time stamps and
164
+ RecordingEvent (eventdispatch.recording): the time stamps and
165
165
  clock helpers both need, independent of how time passes.
166
166
 
167
167
  The running dispatch provides the clock as its `now`
@@ -1,13 +1,13 @@
1
- """Example learning: shake out the learning surface (learning.py).
1
+ """Example recording: shake out the recording surface (recording.py).
2
2
 
3
3
  Trivial RecordingEvents on both recording dispatches over a
4
4
  Blackboard, following example_core / example_cs's shape. What this
5
5
  demonstrates (RecordingEvent, SimClockRecordingDispatch and
6
- WallClockRecordingDispatch from eventdispatch.learning):
6
+ WallClockRecordingDispatch from eventdispatch.recording):
7
7
 
8
8
  1. Sim clock: events quote durations; records land in the
9
9
  dispatch's recordings field in duration order, not enqueue
10
- order, and the harness drains them with take().
10
+ order, and the reader drains them with take().
11
11
  2. A zero-arg event dispatches from the queue (RecordingEvent's
12
12
  deserialize drops the non-empty-tail check).
13
13
  3. A quote is a commitment the outcome may settle short of: an
@@ -21,7 +21,7 @@ WallClockRecordingDispatch from eventdispatch.learning):
21
21
  wall clock it stops cooperatively and its partial outcome is
22
22
  recorded; on_preempt() decides its wake.
23
23
 
24
- Run: python -m eventdispatch.example_learning
24
+ Run: python -m eventdispatch.example_recording
25
25
  """
26
26
  from __future__ import annotations
27
27
 
@@ -29,7 +29,7 @@ import threading
29
29
  import time
30
30
 
31
31
  from eventdispatch.core import Blackboard
32
- from eventdispatch.learning import (
32
+ from eventdispatch.recording import (
33
33
  PREEMPTED, RecordingEvent, SimClockRecordingDispatch,
34
34
  WallClockRecordingDispatch)
35
35
 
@@ -60,7 +60,7 @@ class PingEvent(RecordingEvent):
60
60
 
61
61
  class WaitEvent(RecordingEvent):
62
62
  """Wall clock: waits up to `secs`, stopping early if preempted.
63
- A preempt does not wake the policy (on_preempt)."""
63
+ A preempt does not request attention (on_preempt)."""
64
64
 
65
65
  def run_outcome(self, ed, secs):
66
66
  if self.wait_preempt(float(secs)):
@@ -98,10 +98,10 @@ def run_sim():
98
98
  blackboard["WorkEvent"] = WorkEvent
99
99
  blackboard["PingEvent"] = PingEvent
100
100
 
101
- ed = SimClockRecordingDispatch(blackboard, "learning")
102
- blackboard["learning"] = ed
101
+ ed = SimClockRecordingDispatch(blackboard, "recording")
102
+ blackboard["recording"] = ed
103
103
  thread = threading.Thread(
104
- target=ed.run, args=(blackboard, "learning", None, None))
104
+ target=ed.run, args=(blackboard, "recording", None, None))
105
105
  thread.start()
106
106
 
107
107
  # out-of-order quotes, plus a zero-arg event
@@ -167,7 +167,7 @@ def run_wall():
167
167
  def main():
168
168
  run_sim()
169
169
  run_wall()
170
- print("learning surface constructs and runs on both clocks")
170
+ print("recording surface constructs and runs on both clocks")
171
171
 
172
172
 
173
173
  if __name__ == "__main__":
@@ -1,12 +1,11 @@
1
- """Learning surface of the eventdispatch framework.
1
+ """Recording surface of the eventdispatch framework.
2
2
 
3
3
  Every language implementation of the framework keeps one module like
4
- this one: the surface that learning / training code programs against.
5
- Training code imports from here, never from core internals.
4
+ this one: the surface that consumers of event completions program
5
+ against. Consumers import from here, never from core internals.
6
6
 
7
- Recording is what makes learning possible on this framework: an
8
- event that opts in has its completion written as a record, and the
9
- records are what a training or inference loop reads.
7
+ An event that opts in to recording has its completion written as a
8
+ record to the recordings field, where a consumer reads it.
10
9
 
11
10
  RecordingEvent -- the Event base class that opts in to recording.
12
11
  A sibling of SimEvent (both are ClockedEvent,
@@ -16,12 +15,11 @@ records are what a training or inference loop reads.
16
15
  PREEMPTED records to the recordings field.
17
16
  SimClockRecordingDispatch -- RecordingMixin on SimClockCSBQCVED
18
17
  (eventdispatch.sim): quoted durations, a
19
- simulated clock. Training runs here.
18
+ simulated clock.
20
19
  WallClockRecordingDispatch -- RecordingMixin on CSBQCVED
21
20
  (eventdispatch.composite_semaphore): each
22
21
  recording event's run_outcome() runs on its
23
- own thread, in real time. Inference and
24
- calibration on hardware run here.
22
+ own thread, in real time.
25
23
  RecordingLog -- the recordings field's type.
26
24
 
27
25
  Events that do not inherit RecordingEvent run untouched on both
@@ -39,8 +37,8 @@ Recording protocol (the contract RecordingEvent subclasses follow):
39
37
  event's effects; return what happened.
40
38
  wake -> the event's own decision: class default True,
41
39
  settable per outcome from run_outcome(). A record whose wake
42
- is True always wakes the policy -- binding on the harness,
43
- not a hint. The dispatch never decides wake.
40
+ is True requests the consumer's attention, and the consumer
41
+ must honor it. The dispatch never decides wake.
44
42
  on_preempt(ed) -> optional. Called when the event is preempted,
45
43
  after run_outcome() on the wall clock (so it wins); it may
46
44
  set self.wake and may return a dict of notes for the record.
@@ -60,12 +58,11 @@ duration, and actual_duration when the event set it. A preempted
60
58
  recording event gets a record too, with outcome PREEMPTED, its
61
59
  elapsed time (and, on the sim clock, its progress fraction), and on
62
60
  the wall clock whatever run_outcome() returned as partial_outcome.
63
- A training or inference loop consumes the log by take() -- block for
64
- the next record, drain everything that has landed -- and engages the
65
- policy on every record whose wake is set. Draining on use is the
66
- field's hygiene: it has exactly one consumer, so the buffer never
67
- holds more than one decision interval's records. The dispatch
68
- itself never engages a policy; notification stops at the field.
61
+ A consumer reads the log by take() -- block for the next record,
62
+ drain everything that has landed. Draining on use is the field's
63
+ hygiene: it has exactly one consumer, so the buffer never holds
64
+ more than what has landed since the last take(). The dispatch's
65
+ responsibility stops at the field.
69
66
 
70
67
  Clock settling (sim clock only): a quote is a commitment the outcome
71
68
  may settle short of. When run_outcome() sets self.actual_duration
@@ -112,9 +109,9 @@ class RecordingLog:
112
109
  records, in order, drained on use.
113
110
 
114
111
  Writers append (the recording dispatch, on whichever thread
115
- the completion lands). The one reader -- the harness --
116
- consumes by take(): records leave the buffer as they are read,
117
- so the buffer stays bounded by one decision interval no matter
112
+ the completion lands). The one reader consumes by take():
113
+ records leave the buffer as they are read, so the buffer stays
114
+ bounded by what has landed since the last take(), no matter
118
115
  how long the run. snapshot() is a non-consuming peek, for tests
119
116
  and diagnostics only; it is not a read path.
120
117
  """
@@ -157,8 +154,8 @@ class RecordingEvent(ClockedEvent):
157
154
  and optionally on_preempt(); never finish().
158
155
 
159
156
  wake: class-level default True; run_outcome() / on_preempt()
160
- may set self.wake. A record whose wake is True always wakes the
161
- policy.
157
+ may set self.wake. A record whose wake is True requests the
158
+ consumer's attention.
162
159
 
163
160
  actual_duration: None unless the outcome consumed less than
164
161
  quoted (sim clock settling, module docstring). Recorded when
@@ -65,7 +65,7 @@ The dispatch stamps started_at / quoted_duration on any event it
65
65
  quotes, and ClockedEvent (eventdispatch.common1) exposes the
66
66
  clock through now(), so the same event interface is implemented
67
67
  against every simulator. Any event that quotes a duration runs
68
- here -- a SimEvent, or a RecordingEvent (eventdispatch.learning)
68
+ here -- a SimEvent, or a RecordingEvent (eventdispatch.recording)
69
69
  on SimClockRecordingDispatch.
70
70
  Engine adapters subclass SimClockCSBQCVED and override
71
71
  step_world() only.
@@ -98,7 +98,7 @@ class SimEvent(ClockedEvent):
98
98
  The clock stamps (started_at / quoted_duration) and helpers
99
99
  (now / elapsed / progress) come from ClockedEvent
100
100
  (eventdispatch.common1), shared with RecordingEvent
101
- (eventdispatch.learning).
101
+ (eventdispatch.recording).
102
102
  """
103
103
 
104
104
  def dispatch(self, ed, *args, **kwargs):
@@ -114,7 +114,7 @@ class SimEvent(ClockedEvent):
114
114
  class SimClockCSBQCVED(CSBQCVED):
115
115
  """CSBQCVED on a simulated clock (see module docstring).
116
116
 
117
- Pure dispatch machinery: no policy, no world, no iterables.
117
+ Pure dispatch machinery: no world, no iterables.
118
118
  Self-sufficient: run() is the advance driver. post_cb is
119
119
  inherited untouched; prior_cb reuses the base's CS
120
120
  partition and returns the CS gate as a verdict instead of
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: eventdispatch
3
- Version: 0.3.0
3
+ Version: 0.3.1
4
4
  Summary: Event Dispatch: discrete time synchronization
5
5
  Home-page: http://github.com/cyan-at/python-eventdispatch
6
6
  Author: Charlie Yan
@@ -9,9 +9,9 @@ eventdispatch/composite_semaphore.py
9
9
  eventdispatch/core.py
10
10
  eventdispatch/example_core.py
11
11
  eventdispatch/example_cs.py
12
- eventdispatch/example_learning.py
12
+ eventdispatch/example_recording.py
13
13
  eventdispatch/example_sim_mujoco.py
14
- eventdispatch/learning.py
14
+ eventdispatch/recording.py
15
15
  eventdispatch/sim.py
16
16
  eventdispatch.egg-info/PKG-INFO
17
17
  eventdispatch.egg-info/SOURCES.txt
@@ -7,7 +7,7 @@ dependencies = [
7
7
  "argparse"
8
8
  ]
9
9
  name = "eventdispatch"
10
- version = "0.3.0"
10
+ version = "0.3.1"
11
11
  authors = [{name = "Charlie Yan", email = "cyanatg@gmail.com"}]
12
12
  dynamic = ["scripts"]
13
13
  description = "Event Dispatch: discrete time synchronization"
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name='eventdispatch',
5
- version='0.3.0',
5
+ version='0.3.1',
6
6
  description='Event Dispatch, a discrete time synchronizer',
7
7
  url='http://github.com/cyan-at/python-eventdispatch',
8
8
  author='Charlie Yan',
@@ -1,4 +1,4 @@
1
- """Tests for the recording surface (eventdispatch.learning).
1
+ """Tests for the recording surface (eventdispatch.recording).
2
2
 
3
3
  Run: python3 -m pytest tests/
4
4
  """
@@ -9,7 +9,7 @@ import pytest
9
9
 
10
10
  from eventdispatch.common1 import CommonEvent
11
11
  from eventdispatch.core import Blackboard
12
- from eventdispatch.learning import (
12
+ from eventdispatch.recording import (
13
13
  PREEMPTED, RECORDINGS_KEY, RecordingEvent, RecordingLog,
14
14
  SimClockRecordingDispatch, WallClockRecordingDispatch)
15
15
  from eventdispatch.sim import SimClockCSBQCVED, SimEvent
File without changes
File without changes
File without changes
File without changes