diff options
author | Botond Hende <nettingman@gmail.com> | 2024-09-01 23:33:15 +0200 |
---|---|---|
committer | Botond Hende <nettingman@gmail.com> | 2024-09-01 23:33:15 +0200 |
commit | a994b822a4231061153c6b27d8c5d7307b59f8b0 (patch) | |
tree | 0807c64b101c4f62d3795467e9da552536e5df87 /modules/task_types.py | |
parent | f55028d8d7d703f348190598d2fce93103070d17 (diff) |
ship task setting from request body
Diffstat (limited to 'modules/task_types.py')
-rw-r--r-- | modules/task_types.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/modules/task_types.py b/modules/task_types.py new file mode 100644 index 0000000..d23ce55 --- /dev/null +++ b/modules/task_types.py @@ -0,0 +1,21 @@ +from typing import Annotated +from pydantic.functional_validators import AfterValidator + +IDLE = 'IDLE' +MINING = 'MINING' + +MIA = 'MIA' +ERROR = 'ERROR' + +task_types = [ + IDLE, + MINING, +] + + +def is_task_type(task: str): + assert task in task_types, f"'{task}' is not a valid task type." + return task + + +task_type = Annotated[str, AfterValidator(is_task_type)] |