[Subversion] / Trellis / test_trellis.py |
No default branch
Bookmark a link to HEAD:
(view)
(download)
(as text)
Implement Grant's suggested sorting fixes
Fix the "sensor undo" and "set before recalc" bugs; add some disabled tests for circularity-detection edge cases. (Making them pass will require a re-think of how cycle detection works, as this is turning out to be a "solve the halting problem" kind of problem!)
Fixes for various complex scenarios, such as: * False-positive detection of circularity in some cases where retried rules are related, but not actually circular. * Lazily-created components in uninitialized rules called from @compute or @perform rules could trigger read-only violation errors. * If a "future" value was accessed from both rule and non-rule code in the same transaction, it could trigger a silent, partial rollback of the non-rule code, leading to inexplicable result. Also, as a side effect of these changes, CircularityError instances now includes a path indicating at least one possible cycle in the given routes, and "futures" must now be copyable objects. Many thanks go to Sergey Schetinin, who not only reported these issues, but also diagnosed them and provided both test cases and suggestions for fixes. Thank you, Sergey!
Fix an intermittent issue with the wx event loop test, where it would lock up if the sub-millisecond event needed to be scheduled. Apparently, once a wx app's MainLoop() has exited, timed callbacks no longer work. So, to fix the test, a dummy Frame is created, so the MainLoop() won't exit until the test is finished. Also, ensure that if the MainLoop *does* exit, Time.tick() still gets called until the EventLoop is stopped.
Ensure that any wx-supplied delay is at least 1ms long.
Fix Time.next_event_time() being able to return the time of an event that's already passed in the current recalc (because it didn't depend on the rule that removes passed events from the schedule).
Added "pub/sub hub" to collections module, and updated Time service to use the same underlying "cellcache" mechanism. The cellcache mechanism itself is not yet a public API, however, due to minimal test coverage and some open questions regarding what cases it should support. It does quite well for the things it's currently being used for, but don't depend on its API being stable just yet.
Fix a problem with cross-recalc undo underflowing the "on commit" log
Prevent double-resuming of tasks when more than one dependency changes between flushes of the event loop.
Make undo log span recalculations, so that any actions that triggered a chained recalculation will also be undone (at the possible cost of losing external sync).
Prevent time-based rules from being able to create spurious circular dependencies.
Doc overhaul, and rename ObserverCell->Performer
Implement make(), make=, and rename variable->attribute. Disallow self-access in lazy (compute) rules.
First cut of the new API, and basic "lazy cell" support.
Highly-experimental SQLAlchemy integration proof-of-concept. You must have the 'user_defined_state' branch of SQLAlchemy, and it is only proven to work with *exactly* revision 4361. Revisions before or after are anyone's guess.
API cleanups, doc enhancements, and release prep
Get rid of the now-ancient Specification.txt and move its demos to Internals.txt
Move task-related stuff to activity module. Fleshed out docs for activity module. Tested undo support for Time service.
Simplified rollback support for collections. Only changes done to non-"future" cells need to be undo-logged, and the entire structure will be rolled back to the first point of change when *any* change to the structure is rolled back.
Refactor retry, cycle detection, and rollback to allow reentrant rollback, so we'll be able to have "todo" cells do complete data structure rollbacks. As a nice side-effect, this refactoring speeds up rule processing by making fewer attribute changes and recording fewer undo actions. The tests for Python 2.3 run about 33% faster than they did before, although they're still 7 times slower than the Python 2.5 tests. (The speedup for 2.3 is disproportionate because the cost of getting or setting controller attributes is much higher, due to threading.local being in Python instead of C.)
Restore Python 2.3 compatibility. This is of somewhat limited benefit, since the tests run (literally) 10 times slower than Python 2.4, due to the incredible slowness of the Python (i.e. non-C) version of threading.local.
Correct some of the more egregious documentation errors and terminology. Tests now pass under Python 2.4 as well as 2.5 (2.3 is still broken). Begin the split of the activity/eventlooop/task docs to a separate file. Remove some done items from the TODO section.
The new algorithm lands - version bump to 0.6a1dev. Too many changes to list!
Simplify undo by not logging undo's while undoing. This makes it possible to write code that doesn't care if it's a "do" or "undo", which should make data structures similar. i.e., the reverse of an 'add' can then be a 'remove' and vice versa, without needing to have separate 'undo_add' and 'undo_remove' operations that don't log undo information.
Improved retry algorithm to handle multiple simultaneous rollbacks, and to do them between rules. Add Observer and Cell implementations+tests.
First cut of basic Cell types based on the new algorithm. For now, they live in a different module, since they aren't fully featured yet. They do, however, perform many of the cell basics, including ReadOnlyCell->Constant, basic recalculation, etc. But read/write cell initialization is untested, observers don't exist yet, and neither do task cells. A suitable replacement for the 'future/todo' mechanism is also needed before the process of replacing the existing cell types and data structures can begin. But this is a pretty good start.
Improved commit/abort/undo logic, add dirty() method to allow listeners to skip being scheduled. (Also, schedule listeners immediately when changed() is called outside of run().)
Rule handling, with retry and cycle detection. This basically completes the core implementation of the new algorithm, on top of which Cells and other data structures and decorators can then be built.
Begin laying the foundation for the new algorithm's controller.
New algorithm: subjects, listeners, and links.
Begin work on new algorithm: STM history class. (Python 2.4 currently required)
Split advanced collection types into peak.events.collections. Add new "SubSet" type.
Event loops for tests, wx, and twisted. No docs, and only minimal testing so far, but much hacking was done to get these to work more-or-less correctly. wx needs some mocking, and it turns out that the Time service really needs to make next_event_time() dirty when new events are added, even if self._tick doesn't change. That'll have to be fixed later, though (as with the wx mocks issue).
Added List, Dict, and Set types with change events. We are now feature-complete for 0.5b1 (minus docs), weighing in at a modest 1066 lines of code. Woohoo!
Begin documentation/test refactoring; new intro, updated TODO.
High level API: Component class, decorators, properties. The tests are disorganized and the docs are non-existent, but it works, by golly. Docs and test re-orgs will begin next week.
Ensure that reads outside of propagation block until propagation is over. Drop EventLoop service; it was overkill for what's actually needed. I'm keeping the dependency on Contextual since Time, IO, and Signals will all be context.Service classes later. But the core doesn't need this service, and this way it'll be easier to write a C version later, if needed. There may still need to be a way to replace the runner to serve in other event loop systems, but for now I'm treating it as a YAGNI.
Rip out the old Trellis implementation and replace with a shiny new algorithm. This is nowhere near adequately tested, and Constant conversion doesn't work. The doctests are in horrible shape and don't describe the current algorithm at all. The fancy API described in my mailing list posts is nowhere to be found, and none of the new functionality is tested in the slightest. Experiment at your own risk; this is just a placeholder/proof-of-concept test to see if the new algorithm at least passes the old tests (except for Constant conversion.) And it does. :) So, everything from here on out should effectively be either documentation, tests, syntax sugar, or convenience/reference implementations of higher-level features.
Trellis: a new paradigm for event-driven programming, based on ideas from Gelernter's "Trellis" system, and Tilton's "Cells" for Lisp. Eventually, this will grow up to do the rest of the things that peak.events does now, only with deterministic updates and no need for explicit dependency management.
cvs-admin@eby-sarna.com Powered by ViewCVS 1.0-dev |
ViewCVS and CVS Help |