framework icon indicating copy to clipboard operation
framework copied to clipboard

Ensure single decorator should raise when discarding tasks

Open kvanhijf opened this issue 8 years ago • 3 comments

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

kvanhijf avatar Mar 02 '17 12:03 kvanhijf

@khenderick if you would see an important use case to fix in Gilbert, please raise your voice

wimpers avatar Mar 08 '17 16:03 wimpers

@wimpers, no, we can leave it to roadmap.

khenderick avatar Mar 08 '17 17:03 khenderick

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

JeffreyDevloo avatar May 03 '19 14:05 JeffreyDevloo