LbProdRun 1.5.2__tar.gz → 1.7.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: LbProdRun
3
- Version: 1.5.2
3
+ Version: 1.7.0
4
4
  Summary: CLI for running LHCb applications from LHCbDIRAC
5
5
  Home-page: https://gitlab.cern.ch/lhcb-core/lbprodrun
6
6
  License: GPL-3.0-only
@@ -54,6 +54,10 @@ def _write_prod_conf_options(job_spec, path: Path, verbose=False):
54
54
  "TCK": job_spec.input.tck,
55
55
  "ProcessingPass": job_spec.options.processing_pass,
56
56
  }
57
+ if _uses_gaudi_mp(job_spec.application.name, job_spec.application.version):
58
+ data["NThreads"] = 1
59
+ else:
60
+ data["NThreads"] = job_spec.application.number_of_processors
57
61
 
58
62
  lines = ["from ProdConf import ProdConf", ""]
59
63
  lines += ["ProdConf("]
@@ -234,8 +238,9 @@ def _make_gaudirun_command(job_spec):
234
238
 
235
239
  command = []
236
240
  command += job_spec.options.command
237
- if job_spec.application.number_of_processors > 1:
238
- command += ["--ncpus", f"{job_spec.application.number_of_processors}"]
241
+ if _uses_gaudi_mp(job_spec.application.name, job_spec.application.version):
242
+ if job_spec.application.number_of_processors > 1:
243
+ command += ["--ncpus", f"{job_spec.application.number_of_processors}"]
239
244
  command += job_spec.options.files
240
245
  command += [str(prod_conf_fn)]
241
246
 
@@ -256,8 +261,12 @@ def _make_gaudirun_command(job_spec):
256
261
  return command
257
262
 
258
263
 
259
- def _is_new_style(name: str, version: str) -> bool:
260
- """Determine if a given application/version combination should use lbexec"""
264
+ def _parse_version(version: str) -> Union[Version, bool]:
265
+ """Parse a version string into a Version object
266
+
267
+ If this fails, it will return a bool indicating a safe default value
268
+ for if an application supports modern features or not.
269
+ """
261
270
  try:
262
271
  parsed_version = Version(re.sub(r"[^\d]+", ".", version).strip("."))
263
272
  except Exception: # pylint: disable=broad-except
@@ -265,6 +274,14 @@ def _is_new_style(name: str, version: str) -> bool:
265
274
  if version == "HEAD":
266
275
  return True
267
276
  return False
277
+ return parsed_version
278
+
279
+
280
+ def _is_new_style(name: str, version: str) -> bool:
281
+ """Determine if a given application/version combination should use lbexec"""
282
+ parsed_version = _parse_version(version)
283
+ if isinstance(parsed_version, bool):
284
+ return parsed_version
268
285
 
269
286
  version_compatibility: dict[str, Union[bool, Version]] = {
270
287
  "Analysis": Version("40"),
@@ -292,6 +309,19 @@ def _is_new_style(name: str, version: str) -> bool:
292
309
  return is_new_style < parsed_version
293
310
 
294
311
 
312
+ def _uses_gaudi_mp(name: str, version: str) -> bool:
313
+ parsed_version = _parse_version(version)
314
+ if isinstance(parsed_version, bool):
315
+ return parsed_version
316
+
317
+ # Gauss v60+ supports multi-threading despite still using ProdConf
318
+ if name == "Gauss":
319
+ return parsed_version < Version("60")
320
+
321
+ # Otherwise assume only lbexec-style applications support native multi-threading
322
+ return _is_new_style(name, version)
323
+
324
+
295
325
  def _prepare_env():
296
326
  """Get a dictionary containing the environment that should be used for the job"""
297
327
  env = os.environ.copy()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: LbProdRun
3
- Version: 1.5.2
3
+ Version: 1.7.0
4
4
  Summary: CLI for running LHCb applications from LHCbDIRAC
5
5
  Home-page: https://gitlab.cern.ch/lhcb-core/lbprodrun
6
6
  License: GPL-3.0-only
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes