LbProdRun 1.3.1__tar.gz → 1.4.1__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.
@@ -6,7 +6,7 @@ default_language_version:
6
6
 
7
7
  repos:
8
8
  - repo: https://github.com/pre-commit/pre-commit-hooks
9
- rev: v4.2.0
9
+ rev: v4.4.0
10
10
  hooks:
11
11
  - id: trailing-whitespace
12
12
  - id: end-of-file-fixer
@@ -16,29 +16,29 @@ repos:
16
16
  args: [--branch, main]
17
17
 
18
18
  - repo: https://github.com/pycqa/isort
19
- rev: 5.10.1
19
+ rev: 5.12.0
20
20
  hooks:
21
21
  - id: isort
22
22
 
23
23
  - repo: https://github.com/psf/black
24
- rev: 22.3.0
24
+ rev: 23.3.0
25
25
  hooks:
26
26
  - id: black
27
27
 
28
- - repo: https://gitlab.com/pycqa/flake8
29
- rev: 3.9.2
28
+ - repo: https://github.com/pycQA/flake8
29
+ rev: 6.0.0
30
30
  hooks:
31
31
  - id: flake8
32
32
  additional_dependencies: [flake8-bugbear]
33
33
 
34
34
  - repo: https://github.com/pre-commit/mirrors-mypy
35
- rev: v0.960
35
+ rev: v1.0.1
36
36
  hooks:
37
37
  - id: mypy
38
38
  args: [--strict-optional, --ignore-missing-imports]
39
39
  additional_dependencies: [types-PyYAML, pydantic]
40
40
 
41
41
  - repo: "https://gitlab.cern.ch/lhcb-core/LbDevTools.git"
42
- rev: 2.0.34
42
+ rev: 2.0.38
43
43
  hooks:
44
44
  - id: lb-add-copyright
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: LbProdRun
3
- Version: 1.3.1
3
+ Version: 1.4.1
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
@@ -42,7 +42,7 @@ console_scripts =
42
42
 
43
43
  [flake8]
44
44
  max-line-length = 80
45
- ignore = E501,W503,B950,B008,R0903
45
+ ignore = E501,W503,B950,B008,B905
46
46
  extend-ignore =
47
47
  E203,
48
48
  select = C,E,F,W,B,B9
@@ -11,6 +11,7 @@
11
11
  import os
12
12
  import re
13
13
  import shlex
14
+ import shutil
14
15
  from pathlib import Path
15
16
  from pprint import pformat
16
17
  from typing import Union
@@ -22,12 +23,14 @@ from packaging.version import Version
22
23
  from .models import JobSpecV1, read_jobspec
23
24
 
24
25
 
25
- def run_job(spec_file: Path, dry_run=False, verbose=False, interactive=False):
26
+ def run_job(
27
+ spec_file: Path, dry_run=False, verbose=False, interactive=False, prmon=False
28
+ ):
26
29
  job_spec = read_jobspec(spec_file)
27
30
  if verbose:
28
31
  typer.secho("Expanded spec file as:", fg=typer.colors.GREEN)
29
32
  typer.secho(pformat(job_spec.dict()))
30
- execute(job_spec, dry_run=dry_run, interactive=interactive)
33
+ execute(job_spec, dry_run=dry_run, interactive=interactive, prmon=prmon)
31
34
 
32
35
 
33
36
  def _write_prod_conf_options(job_spec, path: Path, verbose=False):
@@ -64,16 +67,33 @@ def _write_prod_conf_options(job_spec, path: Path, verbose=False):
64
67
  path.write_text(string)
65
68
 
66
69
 
67
- def execute(job_spec, dry_run=False, interactive=False):
70
+ def execute(job_spec, dry_run=False, interactive=False, prmon=False):
71
+ command = []
72
+ new_style = _is_new_style(job_spec.application.name, job_spec.application.version)
73
+
74
+ if not prmon:
75
+ pass
76
+ elif interactive:
77
+ typer.secho("Not using prmon as this is an interactive run!", fg="yellow")
78
+ elif shutil.which("prmon") is None:
79
+ typer.secho("Not using prmon as it wasn't found on $PATH!", fg="yellow")
80
+ else:
81
+ command += ["prmon"]
82
+ command += ["--interval", os.environ.get("LBPRODRUN_PRMON_INTERVAL", "60")]
83
+ command += ["--filename", f"prmon_{job_spec.output.prefix}.txt"]
84
+ command += ["--json-summary", f"prmon_{job_spec.output.prefix}.json"]
85
+ command += ["--"]
86
+
68
87
  if isinstance(job_spec.application, JobSpecV1.FullDevApplication):
69
- command = [str(job_spec.application.run_script.absolute())]
88
+ command += [str(job_spec.application.run_script.absolute())]
70
89
  else:
71
- command = ["lb-run"]
90
+ command += ["lb-run"]
72
91
  command += ["--siteroot=/cvmfs/lhcb.cern.ch/lib/"]
73
92
  command += ["-c", f"{job_spec.application.binary_tag}"]
74
93
  for ep in job_spec.application.data_pkgs:
75
94
  command += [f"--use={ep}"]
76
- command += ["--use=ProdConf"]
95
+ if not new_style:
96
+ command += ["--use=ProdConf"]
77
97
 
78
98
  if isinstance(job_spec.application, JobSpecV1.ReleaseApplication):
79
99
  typer.secho(
@@ -99,7 +119,7 @@ def execute(job_spec, dry_run=False, interactive=False):
99
119
  else:
100
120
  raise NotImplementedError(type(job_spec.application))
101
121
 
102
- if _is_new_style(job_spec.application.name, job_spec.application.version):
122
+ if new_style:
103
123
  inner_command = _make_lbexec_command(job_spec)
104
124
  else:
105
125
  inner_command = _make_gaudirun_command(job_spec)
@@ -136,8 +156,10 @@ def _make_lbexec_command(job_spec):
136
156
 
137
157
 
138
158
  def _write_options_yaml(job_spec, path: Path, verbose=False):
139
- """Write an options file for the ProdConf data package"""
159
+ """Write an options file for lbexec"""
140
160
  options = job_spec.options.extra_options.copy()
161
+ # FIXME: Can't actually use this option yet as it doesn't fail if the keys are missing
162
+ # options["write_decoding_keys_to_git"] = False
141
163
 
142
164
  if job_spec.input.files:
143
165
  options["input_files"] = job_spec.input.files
@@ -242,6 +264,8 @@ def _is_new_style(name: str, version: str) -> bool:
242
264
  parsed_version = Version(re.sub(r"[^\d]+", ".", version).strip("."))
243
265
  except Exception: # pylint: disable=broad-except
244
266
  typer.secho(f"Failed to parse {version!r}", fg="red")
267
+ if version == "HEAD":
268
+ return True
245
269
  return False
246
270
 
247
271
  version_compatibility: dict[str, Union[bool, Version]] = {
@@ -21,11 +21,14 @@ app = typer.Typer()
21
21
  def main(
22
22
  job_spec: Path = typer.Argument(..., exists=True, dir_okay=False, readable=True),
23
23
  dry_run: bool = False,
24
+ prmon: bool = False,
24
25
  verbose: bool = False,
25
26
  interactive: bool = False,
26
27
  ):
27
28
  typer.echo(f"Reading specification from {job_spec}")
28
- run_job(job_spec, dry_run=dry_run, verbose=verbose, interactive=interactive)
29
+ run_job(
30
+ job_spec, dry_run=dry_run, prmon=prmon, verbose=verbose, interactive=interactive
31
+ )
29
32
 
30
33
 
31
34
  if __name__ == "__main__":
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: LbProdRun
3
- Version: 1.3.1
3
+ Version: 1.4.1
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