Ensure single decorator should raise when discarding tasks
The ensure single decorator currently returns None if a task is being discarded because of other similar tasks already being executed. The user could be mislead in 2 ways:
- When he gets a return value of None, he could assume the job was successful, while it actually did not start/execute at all.
- When he gets a return value of None, while he expected some specific value, the code could raise or act differently
Instead we should raise our own custom DiscardException or something similar, so the user always knows what happened and could potentially try again
@khenderick if you would see an important use case to fix in Gilbert, please raise your voice
@wimpers, no, we can leave it to roadmap.
EnsureSingleTaskDiscarded is thrown internally now.
It can be exposed to be thrown back to the user.
Lines of code: Default: https://github.com/openvstorage/framework/blob/develop/ovs/lib/helpers/decorators.py#L204 Deduped: https://github.com/openvstorage/framework/blob/develop/ovs/lib/helpers/decorators.py#L259 Chained: https://github.com/openvstorage/framework/blob/develop/ovs/lib/helpers/decorators.py#L315