-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathtask.py
More file actions
59 lines (46 loc) · 1.25 KB
/
task.py
File metadata and controls
59 lines (46 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import sys
sys.dont_write_bytecode = True
from ..base import Task
from ..vm import VTask
from .template import RawManager, VMManager
class TaskMixin:
def __init__(self) -> None:
raise
@Task._config_handler
def check_config(self, eval_item) -> None:
...
class RawTask(Task, TaskMixin):
def __init__(
self,
config_path: str,
manager: RawManager,
*args,
**kwargs
) -> None:
# to enable Pylance type checker
assert isinstance(manager, RawManager)
self.manager = manager
super().__init__(config_path, manager, *args, **kwargs)
self.check_config()
def _init(self) -> bool:
...
return True
@Task._stop_handler
def eval(self) -> bool:
raise NotImplementedError
class VMTask(VTask, TaskMixin):
def __init__(
self,
config_path: str,
manager: VMManager,
*args,
**kwargs
) -> None:
# to enable Pylance type checker
assert isinstance(manager, VMManager)
self.manager = manager
super().__init__(config_path, manager, *args, **kwargs)
self.check_config()
@Task._stop_handler
def eval(self) -> bool:
raise NotImplementedError