MCPcopy Create free account
hub / github.com/It4innovations/hyperqueue / wrap_cls

Function wrap_cls

benchmarks/src/cli.py:98–145  ·  view source on GitHub ↗
(cls: Type[TestCase])

Source from the content-addressed store, hash-verified

96
97def register_case(app: Typer):
98 def wrap_cls(cls: Type[TestCase]):
99 case = cls()
100
101 @app.command(name=case.name())
102 def command(
103 workdir: Optional[Path] = None,
104 queue: Optional[str] = None,
105 project: Optional[str] = None,
106 init_script: Optional[Path] = None,
107 node_count: Optional[int] = 1,
108 walltime_h: Optional[int] = 1,
109 wait: bool = False,
110 clear: bool = False,
111 postprocess_only: bool = False,
112 ):
113 if workdir is None:
114 workdir = case.get_workdir()
115 workdir = workdir.absolute()
116 if clear:
117 shutil.rmtree(workdir, ignore_errors=True)
118
119 if queue is not None or project is not None or init_script is not None:
120 assert queue is not None and project is not None and init_script is not None
121 slurm = SlurmCliOptions(
122 queue=queue,
123 project=project,
124 init_script=init_script,
125 node_count=node_count,
126 wait_for_job=wait,
127 walltime_h=walltime_h,
128 )
129 else:
130 slurm = None
131
132 run_test_case(
133 workdir=workdir,
134 case=case,
135 slurm_cli=slurm,
136 postprocess_only=postprocess_only,
137 )
138
139 command.__doc__ = f"""
140Run the {case.name()} benchmark.
141
142{inspect.getdoc(cls)}
143"""
144
145 return cls
146
147 return wrap_cls

Callers

nothing calls this directly

Calls 1

nameMethod · 0.45

Tested by

no test coverage detected