summaryrefslogtreecommitdiff
path: root/taskflow/tests/unit/test_notifier.py
Commit message (Collapse)AuthorAgeFilesLines
* Add a 'can_be_registered' method that checks before notifyingJoshua Harlow2014-12-151-0/+14
| | | | | | | | | Add a new method that can be used to check if a event type is allowed to trigger a notification; and initially use it to disallow the 'ANY' meta event type from being used to trigger notifications. Change-Id: I842fcc5d3e06f69a9479b60b3b89a24233171cfb
* Use the notifier type in the task class/module directlyJoshua Harlow2014-12-131-0/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of having code that is some what like the notifier code we already have, but is duplicated and is slightly different in the task class just move the code that was in the task class (and doing similar actions) to instead now use a notifier that is directly contained in the task base class for internal task triggering of internal task events. Breaking change: alters the capabilities of the task to process notifications itself, most actions now must go through the task notifier property and instead use that (update_progress still exists as a common utility method, since it's likely the most common type of notification that will be used). Removes the following methods from task base class (as they are no longer needed with a notifier attribute): - trigger (replaced with notifier.notify) - autobind (removed, not replaced, can be created by the user of taskflow in a simple manner, without requiring functionality in taskflow) - bind (replaced with notifier.register) - unbind (replaced with notifier.unregister) - listeners_iter (replaced with notifier.listeners_iter) Due to this change we can now also correctly proxy back events from remote tasks to the engine for correct proxying back to the original task. Fixes bug 1370766 Change-Id: Ic9dfef516d72e6e32e71dda30a1cb3522c9e0be6
* Allow for the notifier to provide a 'details_filter'Joshua Harlow2014-12-041-5/+69
| | | | | | | | | | | | When a notifier is being used for retry atoms and for task atoms it is useful to allow a filter callback to be provided that will skip notification depending on whether the details matches or not (so that task or retry notifications can proceed). Part of fix for bug 1395966 Change-Id: If03005c253c3f540d2c33faf7a7474a5fde9dcdd
* Raise value errors instead of assertsJoshua Harlow2014-12-021-0/+5
| | | | | | | | Since asserts can be silenced using -0 and/or compiled out we want to be more strict here and raise value errors when the expected callable objects/functions are not actually callable. Change-Id: Ib14e2e7329dbfcce50660f144ad4780d99f36854
* Revert wrapt usage until further noticeJoshua Harlow2014-11-201-9/+0
| | | | | | | | | | | Currently its usage is failing on stable/icehouse which is being fixed, but that branch is also currently broken due to a tempest failure; so until this situation is resolved take out the usage of wrapt. Part of fixes for bug 1394647 Change-Id: Ibfe21944b6e6882f19f7cf4359e8356a64200278
* Use wrapt to provide the deprecated class proxyJoshua Harlow2014-11-191-0/+9
| | | | | | | | | | | | Instead of having our own mini-proxy class use the robustness (and correctness) that the wrapt library provides to implement a more compliant object proxy that handles edge-cases better than our own. Also adds a few basic sanity tests to ensure that the moved/deprecated classes operate as we want them to. Change-Id: Ib7ca832700583d3ca5e175cb322aa00543cbc475
* Hoist the notifier to its own moduleJoshua Harlow2014-10-181-0/+104
The notifier module needs to be hoisted out of the misc utility file so that it can be depended on existing by users in a well defined (non-utility) location. This change does this hoisting process & creates a new module and places the existing code there, then creates a deprecated proxy that exists at the old location (this will be removed in the next version + 1). In a future change (in 0.5) we can remove this old location and remove all references to the previous location (until then we must keep the old location being used to ensure subclass checks and other types checks function properly). Part of blueprint top-level-types Change-Id: I47fac110adf7cec5c859c2e055c1ceb1f25a7fbd