Repository navigation
Expand file tree
/
Copy path__init__.py
More file actions
111 lines (90 loc) · 2.83 KB
/
Copy path__init__.py
File metadata and controls
111 lines (90 loc) · 2.83 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
from pathlib import Path
from typing import TYPE_CHECKING, Any
if TYPE_CHECKING:
from running.benchmark import Benchmark
class RunbmsPlugin:
CLS_MAPPING: dict[str, Any]
CLS_MAPPING = {}
def __init__(self, **kwargs):
self.name = kwargs["name"]
self.run_id = None
self.runbms_dir: Path | None
self.runbms_dir = None
self.log_dir: Path | None
self.log_dir = None
def set_run_id(self, run_id: Path):
self.run_id = run_id
def set_runbms_dir(self, runbms_dir: str):
self.runbms_dir = Path(runbms_dir).resolve()
def set_log_dir(self, log_dir: Path):
self.log_dir = log_dir
@staticmethod
def from_config(name: str, config: dict[str, str]) -> Any:
return RunbmsPlugin.CLS_MAPPING[config["type"]](name=name, **config)
def __str__(self) -> str:
return f"RunbmsPlugin {self.name}"
def start_hfac(self, hfac: float | None):
pass
def end_hfac(self, hfac: float | None):
pass
def start_benchmark(self, hfac: float | None, size: int | None, bm: "Benchmark"):
pass
def end_benchmark(self, hfac: float | None, size: int | None, bm: "Benchmark"):
pass
def start_invocation(
self,
hfac: float | None,
size: int | None,
bm: "Benchmark",
invocation: int,
):
pass
def end_invocation(
self,
hfac: float | None,
size: int | None,
bm: "Benchmark",
invocation: int,
):
pass
def start_config(
self,
hfac: float | None,
size: int | None,
bm: "Benchmark",
invocation: int,
config: str,
config_index: int,
):
pass
def end_config(
self,
hfac: float | None,
size: int | None,
bm: "Benchmark",
invocation: int,
config: str,
config_index: int,
passed: bool,
):
pass
# !!! Do NOT remove this import nor change its position
# This is to make sure that the plugin classes are correctly registered
from running.plugin.runbms.copyfile import CopyFile # noqa: E402, F401
if TYPE_CHECKING:
from running.plugin.runbms.zulip import Zulip
else:
try:
from running.plugin.runbms.zulip import Zulip
except Exception:
from running.util import register
@register(RunbmsPlugin)
class Zulip(RunbmsPlugin):
def __init__(self, **kwargs):
raise RuntimeError(
"Trying to create an instance of the Zulip "
"plugin for runbms, but the import failed. "
"This is most likely due to the required "
"dependencies not being installed. Try pip "
"install running-ng[zulip] to install the extra dependencies."
)