eventdispatch 0.2.30__tar.gz → 0.2.31__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.30/eventdispatch.egg-info → eventdispatch-0.2.31}/PKG-INFO +1 -1
- {eventdispatch-0.2.30 → eventdispatch-0.2.31}/eventdispatch/learning.py +37 -0
- {eventdispatch-0.2.30 → eventdispatch-0.2.31/eventdispatch.egg-info}/PKG-INFO +1 -1
- {eventdispatch-0.2.30 → eventdispatch-0.2.31}/pyproject.toml +1 -1
- {eventdispatch-0.2.30 → eventdispatch-0.2.31}/setup.py +1 -1
- {eventdispatch-0.2.30 → eventdispatch-0.2.31}/LICENSE +0 -0
- {eventdispatch-0.2.30 → eventdispatch-0.2.31}/NOTICE +0 -0
- {eventdispatch-0.2.30 → eventdispatch-0.2.31}/README.md +0 -0
- {eventdispatch-0.2.30 → eventdispatch-0.2.31}/eventdispatch/__init__.py +0 -0
- {eventdispatch-0.2.30 → eventdispatch-0.2.31}/eventdispatch/common1.py +0 -0
- {eventdispatch-0.2.30 → eventdispatch-0.2.31}/eventdispatch/composite_semaphore.py +0 -0
- {eventdispatch-0.2.30 → eventdispatch-0.2.31}/eventdispatch/core.py +0 -0
- {eventdispatch-0.2.30 → eventdispatch-0.2.31}/eventdispatch/example_core.py +0 -0
- {eventdispatch-0.2.30 → eventdispatch-0.2.31}/eventdispatch/example_cs.py +0 -0
- {eventdispatch-0.2.30 → eventdispatch-0.2.31}/eventdispatch/example_sim_mujoco.py +0 -0
- {eventdispatch-0.2.30 → eventdispatch-0.2.31}/eventdispatch/sim.py +0 -0
- {eventdispatch-0.2.30 → eventdispatch-0.2.31}/eventdispatch.egg-info/SOURCES.txt +0 -0
- {eventdispatch-0.2.30 → eventdispatch-0.2.31}/eventdispatch.egg-info/dependency_links.txt +0 -0
- {eventdispatch-0.2.30 → eventdispatch-0.2.31}/eventdispatch.egg-info/entry_points.txt +0 -0
- {eventdispatch-0.2.30 → eventdispatch-0.2.31}/eventdispatch.egg-info/requires.txt +0 -0
- {eventdispatch-0.2.30 → eventdispatch-0.2.31}/eventdispatch.egg-info/top_level.txt +0 -0
- {eventdispatch-0.2.30 → eventdispatch-0.2.31}/setup.cfg +0 -0
|
@@ -181,6 +181,7 @@ class TrainingDispatch(SimClockCSBQCVED):
|
|
|
181
181
|
super(TrainingDispatch, self).__init__(blackboard, name)
|
|
182
182
|
if COMPLETIONS_KEY not in blackboard:
|
|
183
183
|
blackboard[COMPLETIONS_KEY] = CompletionLog()
|
|
184
|
+
self._last_finished = None
|
|
184
185
|
|
|
185
186
|
def dispatch_finish(self, event, *args, **kwargs):
|
|
186
187
|
"""The library's completion step, plus clock settling:
|
|
@@ -202,6 +203,42 @@ class TrainingDispatch(SimClockCSBQCVED):
|
|
|
202
203
|
bb = event.blackboard
|
|
203
204
|
if bb is not None and "sim" in bb:
|
|
204
205
|
bb["sim"].t = settled
|
|
206
|
+
self._last_finished = self._finished_note(event)
|
|
207
|
+
|
|
208
|
+
def _finished_note(self, event):
|
|
209
|
+
"""'Name OUTCOME' for the event that just finished, for
|
|
210
|
+
post_cb's annotation. The outcome is read back from the
|
|
211
|
+
record finish() just appended, matched on event_id;
|
|
212
|
+
an outcome carrying no name, or a record the harness
|
|
213
|
+
already drained, degrades to the class name alone."""
|
|
214
|
+
name = type(event).__name__
|
|
215
|
+
try:
|
|
216
|
+
records = self.blackboard[COMPLETIONS_KEY].snapshot()
|
|
217
|
+
except Exception:
|
|
218
|
+
return name
|
|
219
|
+
for record in reversed(records):
|
|
220
|
+
if record.get("event_id") != event.get_id():
|
|
221
|
+
continue
|
|
222
|
+
outcome = record.get("outcome")
|
|
223
|
+
if isinstance(outcome, dict):
|
|
224
|
+
outcome = outcome.get("outcome")
|
|
225
|
+
if isinstance(outcome, str) and outcome:
|
|
226
|
+
return "{} {}".format(name, outcome)
|
|
227
|
+
return name
|
|
228
|
+
return name
|
|
229
|
+
|
|
230
|
+
def post_cb(self, blackboard):
|
|
231
|
+
"""The base cycle marker, annotated with the event whose
|
|
232
|
+
finish woke this cycle. advance_one fires one completion
|
|
233
|
+
per cycle, after post_cb, so the annotation lags the
|
|
234
|
+
finish by exactly one cycle; a cycle no finish preceded
|
|
235
|
+
prints the plain marker."""
|
|
236
|
+
note = getattr(self, "_last_finished", None)
|
|
237
|
+
if note is None:
|
|
238
|
+
super(TrainingDispatch, self).post_cb(blackboard)
|
|
239
|
+
return
|
|
240
|
+
self._last_finished = None
|
|
241
|
+
self.internal_log("POST_CB! (finished: {})".format(note))
|
|
205
242
|
|
|
206
243
|
@property
|
|
207
244
|
def completions(self) -> CompletionLog:
|
|
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
|