MCPcopy Create free account
hub / github.com/comaps/comaps / apply

Function apply

tools/python/maps_generator/generator/stages.py:177–207  ·  view source on GitHub ↗
(obj: Stage, env: "Env", *args, **kwargs)

Source from the content-addressed store, hash-verified

175
176 def new_apply(method):
177 def apply(obj: Stage, env: "Env", *args, **kwargs):
178 name = get_stage_name(obj)
179 logfile = os.path.join(env.paths.log_path, f"{name}.log")
180 log_handler = create_file_handler(logfile)
181 logger.addHandler(log_handler)
182 # This message is used as an anchor for parsing logs.
183 # See maps_generator/checks/logs/logs_reader.py STAGE_START_MSG_PATTERN
184 logger.info(f"Stage {name}: start ...")
185 t = time.time()
186 try:
187 if not env.is_accepted_stage(stage):
188 logger.info(f"Stage {name} was not accepted.")
189 return
190
191 main_status = env.main_status
192 main_status.init(env.paths.main_status_path, name)
193 if main_status.need_skip():
194 logger.warning(f"Stage {name} was skipped.")
195 return
196
197 main_status.update_status()
198 env.set_subprocess_out(log_handler.stream)
199 method(obj, env, *args, **kwargs)
200 finally:
201 d = time.time() - t
202 # This message is used as an anchor for parsing logs.
203 # See maps_generator/checks/logs/logs_reader.py STAGE_FINISH_MSG_PATTERN
204 logger.info(
205 f"Stage {name}: finished in {str(datetime.timedelta(seconds=d))}"
206 )
207 logger.removeHandler(log_handler)
208
209 return apply
210

Callers 1

DecomposeOhMethod · 0.85

Calls 13

create_file_handlerFunction · 0.90
DummyObjectClass · 0.90
create_file_loggerFunction · 0.90
get_stage_nameFunction · 0.85
run_testsFunction · 0.85
get_urlsFunction · 0.85
download_under_lockFunction · 0.85
is_accepted_stageMethod · 0.80
need_skipMethod · 0.80
update_statusMethod · 0.80
set_subprocess_outMethod · 0.80
joinMethod · 0.45

Tested by

no test coverage detected