ben-denham / labtech

Easily run experiment permutations with multi-processing and caching
https://ben-denham.github.io/labtech/
GNU General Public License v3.0
7 stars 1 forks source link

Better error message when user forgets `@labtech.task` decorator #8

Closed nathanjmcdougall closed 7 months ago

nathanjmcdougall commented 7 months ago

I was finding that when I defined task classes, I sometimes forgot the @labtech.taskdecorator.

I got a cryptic error: AttributeError: type object 'MyTask' has no attribute '_lt'

Whereas I think this should be explicitly handled and a more informative error given,

ben-denham commented 7 months ago

Good catch, we should probably make Lab.run_tasks (and other methods) raise a LabError formatted with the offending object's repr if is_task (or is_task_type for types) returns false for any argument.