summaryrefslogtreecommitdiff
path: root/python-lbaplocal.spec
blob: adcb1ea3517be3d1e1b555223c4ff779d4a89f1d (plain)
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
%global _empty_manifest_terminate_build 0
Name:		python-LbAPLocal
Version:	0.6.3
Release:	1
Summary:	Tool to locally run tests for AnalysisProductions
License:	GNU General Public License v3 or later (GPLv3+)
URL:		https://gitlab.cern.ch/lhcb-dpa/analysis-productions/lbaplocal
Source0:	https://mirrors.nju.edu.cn/pypi/web/packages/41/e5/4e4b77c9fa8d83542e1d9c6ee34b27955b4983bb55e6358be18ea35a0597/LbAPLocal-0.6.3.tar.gz
BuildArch:	noarch

Requires:	python3-click
Requires:	python3-consolemd
Requires:	python3-LbAPCommon
Requires:	python3-apd
Requires:	python3-LbEnv
Requires:	python3-LbDiracWrappers
Requires:	python3-requests
Requires:	python3-setuptools
Requires:	python3-mplhep
Requires:	python3-LbProdRun
Requires:	python3-pytest
Requires:	python3-pytest-cov
Requires:	python3-pytest-mock
Requires:	python3-pytest-timeout
Requires:	python3-pytest-recording

%description
# LbAPLocal

LbAPLocal is the python library for running offline tests for the LHCb AnalysisProductions framework.


## Usage

LbAPLocal is installed by default with the LHCb environment on lxplus.  For users on external clusters, one can source the LHCb environment from CVMFS to get setup: ``` source /cvmfs/lhcb.cern.ch/lib/LbEnv ```
After installing, LbAPLocal can be run from the command line with the following options:

```
Usage: lb-ap [OPTIONS] COMMAND [ARGS]...

  Command line tool for the LHCb AnalysisProductions

Options:
  --version
  --help     Show this message and exit.

Commands:
  versions   List the available tags of the Analysis Productions...
  checkout   Clean out the current copy of the specified production and...
  clone      Clone the AnalysisProductions repository and do lb-ap...
  list       List the available production folders by running 'lb-ap list'
  list-checks  List the checks for a specific production by running lb-ap...
  render     Render the info.yaml for a given production
  validate   Validate the configuration for a given production
  test       Execute a job locally
  check      Run checks for a production
  debug      Start an interactive session inside the job's environment
  reproduce  Reproduce an existing online test locally
  parse-log  Read a Gaudi log file and extract information
```

To update an existing production:
```bash
$ lb-ap checkout <version> <working_group> <production> <branch>
```
where `version` is the latest version of AnalysisProductions corresponding to `production`, `working_group` is the working group the production belongs to, `production` is the production you want to update and `branch` is the name of the branch you want to work on.

If you don't yet have a local copy of AnalysisProductions:
```bash
$ lb-ap clone <version> <working_group> <production> <branch> <clone_type>
```
where `version`, `working_group`, `production` and `branch` are defined as above. `clone_type` can be either `ssh`, `https` or `krb5`, by default it is `ssh`.

To see which versions of the repository are available for a given production:
```bash
$ lb-ap versions B2OC B02DKPi
The available versions for B02DKPi are:
  v0r0p1674088
  v0r0p1735460
  .
  .
  .
```

To see which productions are available locally:
```bash
$ lb-ap list
The available productions are:
* MyAnalysis
```

To see which jobs are available for a given production:
```bash
$ lb-ap list MyAnalysis
The available jobs for MyAnalysis are:
* My2016MagDownJob
* My2016MagUpJob
```

To see which checks are defined for a given production:
```bash
$ lb-ap list-checks MyAnalysis
The checks defined for MyAnalysis are:
* MyRangeCheck (type: range)
* MyOtherRangeCheck (type: range)
* MyNumEntriesCheck (type: num_entries)
```

To see which checks are used for a job within a given production:
```bash
$ lb-ap list-checks MyAnalysis My2016MagDownJob
The checks defined for MyAnalysis that are required by My2016MagDownJob are:
* MyRangeCheck (type: range)
* MyNumEntriesCheck (type: num_entries)
```

To render the templating in `info.yaml` for a given production:
```bash
$ lb-ap render MyAnalysis
```

To validate the configuration of a given production:
```bash
$ lb-ap validate MyAnalysis
Rendering info.yaml for MyAnalysis
YAML parsed successfully
YAML validated successfully
```

To run a test of a job interactively:
```bash
$ lb-ap debug MyAnalysis My2016MagDownJob

Welcome to analysis productions debug mode:

The production can be tested by running:

gaudirun.py -T '$ANALYSIS_PRODUCTIONS_DYNAMIC/Lb2Lll/MC_2017_MagDown_Lb2PsiL_mm_strip_autoconf.py' '$ANALYSIS_PRODUCTIONS_BASE/Lb2Lll/stripping_seq.py' prodConf_DaVinci_00012345_00006789_1.py

[DaVinci v45r5] output $
```

To test a job non-interactively:
```bash
$ lb-ap test MyAnalysis My2016MagDownJob
Success! Output can be found in xxxxxxxxxxxx
```

For both interactive and non-interactive testing, when testing a job that depends on another job to provide the input file the dependent job will be tested first and its output passed to the requested job. If the dependent job has already been run the location of its output can be passed to the requested job by appending `-i <output_file_path>` to `lb-ap test <production_name> <job_name>`.

To test a job on a specific input file:
```bash
$ lb-ap test MyAnalysis My2016MagDownJob -i InputFileLocation
Success! Output can be found in xxxxxxxxxxxx
```
InputFileLocation can be either an LFN or a path to a local file. This is also valid for the debug command.

To run only the checks for a job (non-interactively, requiring the output from an earlier successful `test` command):
```bash
$ lb-ap check MyAnalysis My2016MagDownJob local-tests/path/to/output/OUTPUT_NTUPLE.ROOT
All checks passed! Any output can be found in local-tests/path/to/output/checks
```

To run only the checks for a job but saving the output to a different location (non-interactively, requiring the output from an earlier successful `test` command):
```bash
$ lb-ap check MyAnalysis My2016MagDownJob local-tests/path/to/output/OUTPUT_NTUPLE.ROOT another/file/path
All checks passed! Any output can be found in another/file/path
```

To read a Gaudi log file and extract information:
```bash
$ lb-ap parse-log Job.log
Summary of log messages in: Job.log
    Found 2659 ERROR messages
        * 2649 instances of "*** Flag container MC/TrackInfo not found."
        * 9 instances of "HltSelReportsDecoder::   Failed to add Hlt selection name Hlt2RecSummary to its container "
        * 1 instances of "HltSelReportsDecoder:: The   ERROR message is suppressed : '  Failed to add Hlt selection name Hlt2RecSummary to its container '"
    Found 61 WARNING messages
        * 7 instances of "TupleToolBremInfo:: TupleToolBremInfo requires fullDST -  BremP and BremOrigin might not be reliable (Multiplicity is OK)"
        and 54 others (50 unique), pass "--suppress=0" to show all messages

Errors have been detected!
  * Lines: 3275, 3277, 3279, 3281, 3283 and 17 others
    This message indicates the location specified for the information being accessed by
    RelatedInfo does not exist. It is likely that either:

    * The location specified is incorrect, try looking for it with dst-dump.
    * The given information was never stored for that candidate, in which case the use of
    RelatedInfo should be removed.

General explanations
  * Line: 6318
    Histograms are not being saved as no filename has been specified for storing them. This
    message is harmless and normally ignored.
Error: Found issues in log
```


%package -n python3-LbAPLocal
Summary:	Tool to locally run tests for AnalysisProductions
Provides:	python-LbAPLocal
BuildRequires:	python3-devel
BuildRequires:	python3-setuptools
BuildRequires:	python3-pip
%description -n python3-LbAPLocal
# LbAPLocal

LbAPLocal is the python library for running offline tests for the LHCb AnalysisProductions framework.


## Usage

LbAPLocal is installed by default with the LHCb environment on lxplus.  For users on external clusters, one can source the LHCb environment from CVMFS to get setup: ``` source /cvmfs/lhcb.cern.ch/lib/LbEnv ```
After installing, LbAPLocal can be run from the command line with the following options:

```
Usage: lb-ap [OPTIONS] COMMAND [ARGS]...

  Command line tool for the LHCb AnalysisProductions

Options:
  --version
  --help     Show this message and exit.

Commands:
  versions   List the available tags of the Analysis Productions...
  checkout   Clean out the current copy of the specified production and...
  clone      Clone the AnalysisProductions repository and do lb-ap...
  list       List the available production folders by running 'lb-ap list'
  list-checks  List the checks for a specific production by running lb-ap...
  render     Render the info.yaml for a given production
  validate   Validate the configuration for a given production
  test       Execute a job locally
  check      Run checks for a production
  debug      Start an interactive session inside the job's environment
  reproduce  Reproduce an existing online test locally
  parse-log  Read a Gaudi log file and extract information
```

To update an existing production:
```bash
$ lb-ap checkout <version> <working_group> <production> <branch>
```
where `version` is the latest version of AnalysisProductions corresponding to `production`, `working_group` is the working group the production belongs to, `production` is the production you want to update and `branch` is the name of the branch you want to work on.

If you don't yet have a local copy of AnalysisProductions:
```bash
$ lb-ap clone <version> <working_group> <production> <branch> <clone_type>
```
where `version`, `working_group`, `production` and `branch` are defined as above. `clone_type` can be either `ssh`, `https` or `krb5`, by default it is `ssh`.

To see which versions of the repository are available for a given production:
```bash
$ lb-ap versions B2OC B02DKPi
The available versions for B02DKPi are:
  v0r0p1674088
  v0r0p1735460
  .
  .
  .
```

To see which productions are available locally:
```bash
$ lb-ap list
The available productions are:
* MyAnalysis
```

To see which jobs are available for a given production:
```bash
$ lb-ap list MyAnalysis
The available jobs for MyAnalysis are:
* My2016MagDownJob
* My2016MagUpJob
```

To see which checks are defined for a given production:
```bash
$ lb-ap list-checks MyAnalysis
The checks defined for MyAnalysis are:
* MyRangeCheck (type: range)
* MyOtherRangeCheck (type: range)
* MyNumEntriesCheck (type: num_entries)
```

To see which checks are used for a job within a given production:
```bash
$ lb-ap list-checks MyAnalysis My2016MagDownJob
The checks defined for MyAnalysis that are required by My2016MagDownJob are:
* MyRangeCheck (type: range)
* MyNumEntriesCheck (type: num_entries)
```

To render the templating in `info.yaml` for a given production:
```bash
$ lb-ap render MyAnalysis
```

To validate the configuration of a given production:
```bash
$ lb-ap validate MyAnalysis
Rendering info.yaml for MyAnalysis
YAML parsed successfully
YAML validated successfully
```

To run a test of a job interactively:
```bash
$ lb-ap debug MyAnalysis My2016MagDownJob

Welcome to analysis productions debug mode:

The production can be tested by running:

gaudirun.py -T '$ANALYSIS_PRODUCTIONS_DYNAMIC/Lb2Lll/MC_2017_MagDown_Lb2PsiL_mm_strip_autoconf.py' '$ANALYSIS_PRODUCTIONS_BASE/Lb2Lll/stripping_seq.py' prodConf_DaVinci_00012345_00006789_1.py

[DaVinci v45r5] output $
```

To test a job non-interactively:
```bash
$ lb-ap test MyAnalysis My2016MagDownJob
Success! Output can be found in xxxxxxxxxxxx
```

For both interactive and non-interactive testing, when testing a job that depends on another job to provide the input file the dependent job will be tested first and its output passed to the requested job. If the dependent job has already been run the location of its output can be passed to the requested job by appending `-i <output_file_path>` to `lb-ap test <production_name> <job_name>`.

To test a job on a specific input file:
```bash
$ lb-ap test MyAnalysis My2016MagDownJob -i InputFileLocation
Success! Output can be found in xxxxxxxxxxxx
```
InputFileLocation can be either an LFN or a path to a local file. This is also valid for the debug command.

To run only the checks for a job (non-interactively, requiring the output from an earlier successful `test` command):
```bash
$ lb-ap check MyAnalysis My2016MagDownJob local-tests/path/to/output/OUTPUT_NTUPLE.ROOT
All checks passed! Any output can be found in local-tests/path/to/output/checks
```

To run only the checks for a job but saving the output to a different location (non-interactively, requiring the output from an earlier successful `test` command):
```bash
$ lb-ap check MyAnalysis My2016MagDownJob local-tests/path/to/output/OUTPUT_NTUPLE.ROOT another/file/path
All checks passed! Any output can be found in another/file/path
```

To read a Gaudi log file and extract information:
```bash
$ lb-ap parse-log Job.log
Summary of log messages in: Job.log
    Found 2659 ERROR messages
        * 2649 instances of "*** Flag container MC/TrackInfo not found."
        * 9 instances of "HltSelReportsDecoder::   Failed to add Hlt selection name Hlt2RecSummary to its container "
        * 1 instances of "HltSelReportsDecoder:: The   ERROR message is suppressed : '  Failed to add Hlt selection name Hlt2RecSummary to its container '"
    Found 61 WARNING messages
        * 7 instances of "TupleToolBremInfo:: TupleToolBremInfo requires fullDST -  BremP and BremOrigin might not be reliable (Multiplicity is OK)"
        and 54 others (50 unique), pass "--suppress=0" to show all messages

Errors have been detected!
  * Lines: 3275, 3277, 3279, 3281, 3283 and 17 others
    This message indicates the location specified for the information being accessed by
    RelatedInfo does not exist. It is likely that either:

    * The location specified is incorrect, try looking for it with dst-dump.
    * The given information was never stored for that candidate, in which case the use of
    RelatedInfo should be removed.

General explanations
  * Line: 6318
    Histograms are not being saved as no filename has been specified for storing them. This
    message is harmless and normally ignored.
Error: Found issues in log
```


%package help
Summary:	Development documents and examples for LbAPLocal
Provides:	python3-LbAPLocal-doc
%description help
# LbAPLocal

LbAPLocal is the python library for running offline tests for the LHCb AnalysisProductions framework.


## Usage

LbAPLocal is installed by default with the LHCb environment on lxplus.  For users on external clusters, one can source the LHCb environment from CVMFS to get setup: ``` source /cvmfs/lhcb.cern.ch/lib/LbEnv ```
After installing, LbAPLocal can be run from the command line with the following options:

```
Usage: lb-ap [OPTIONS] COMMAND [ARGS]...

  Command line tool for the LHCb AnalysisProductions

Options:
  --version
  --help     Show this message and exit.

Commands:
  versions   List the available tags of the Analysis Productions...
  checkout   Clean out the current copy of the specified production and...
  clone      Clone the AnalysisProductions repository and do lb-ap...
  list       List the available production folders by running 'lb-ap list'
  list-checks  List the checks for a specific production by running lb-ap...
  render     Render the info.yaml for a given production
  validate   Validate the configuration for a given production
  test       Execute a job locally
  check      Run checks for a production
  debug      Start an interactive session inside the job's environment
  reproduce  Reproduce an existing online test locally
  parse-log  Read a Gaudi log file and extract information
```

To update an existing production:
```bash
$ lb-ap checkout <version> <working_group> <production> <branch>
```
where `version` is the latest version of AnalysisProductions corresponding to `production`, `working_group` is the working group the production belongs to, `production` is the production you want to update and `branch` is the name of the branch you want to work on.

If you don't yet have a local copy of AnalysisProductions:
```bash
$ lb-ap clone <version> <working_group> <production> <branch> <clone_type>
```
where `version`, `working_group`, `production` and `branch` are defined as above. `clone_type` can be either `ssh`, `https` or `krb5`, by default it is `ssh`.

To see which versions of the repository are available for a given production:
```bash
$ lb-ap versions B2OC B02DKPi
The available versions for B02DKPi are:
  v0r0p1674088
  v0r0p1735460
  .
  .
  .
```

To see which productions are available locally:
```bash
$ lb-ap list
The available productions are:
* MyAnalysis
```

To see which jobs are available for a given production:
```bash
$ lb-ap list MyAnalysis
The available jobs for MyAnalysis are:
* My2016MagDownJob
* My2016MagUpJob
```

To see which checks are defined for a given production:
```bash
$ lb-ap list-checks MyAnalysis
The checks defined for MyAnalysis are:
* MyRangeCheck (type: range)
* MyOtherRangeCheck (type: range)
* MyNumEntriesCheck (type: num_entries)
```

To see which checks are used for a job within a given production:
```bash
$ lb-ap list-checks MyAnalysis My2016MagDownJob
The checks defined for MyAnalysis that are required by My2016MagDownJob are:
* MyRangeCheck (type: range)
* MyNumEntriesCheck (type: num_entries)
```

To render the templating in `info.yaml` for a given production:
```bash
$ lb-ap render MyAnalysis
```

To validate the configuration of a given production:
```bash
$ lb-ap validate MyAnalysis
Rendering info.yaml for MyAnalysis
YAML parsed successfully
YAML validated successfully
```

To run a test of a job interactively:
```bash
$ lb-ap debug MyAnalysis My2016MagDownJob

Welcome to analysis productions debug mode:

The production can be tested by running:

gaudirun.py -T '$ANALYSIS_PRODUCTIONS_DYNAMIC/Lb2Lll/MC_2017_MagDown_Lb2PsiL_mm_strip_autoconf.py' '$ANALYSIS_PRODUCTIONS_BASE/Lb2Lll/stripping_seq.py' prodConf_DaVinci_00012345_00006789_1.py

[DaVinci v45r5] output $
```

To test a job non-interactively:
```bash
$ lb-ap test MyAnalysis My2016MagDownJob
Success! Output can be found in xxxxxxxxxxxx
```

For both interactive and non-interactive testing, when testing a job that depends on another job to provide the input file the dependent job will be tested first and its output passed to the requested job. If the dependent job has already been run the location of its output can be passed to the requested job by appending `-i <output_file_path>` to `lb-ap test <production_name> <job_name>`.

To test a job on a specific input file:
```bash
$ lb-ap test MyAnalysis My2016MagDownJob -i InputFileLocation
Success! Output can be found in xxxxxxxxxxxx
```
InputFileLocation can be either an LFN or a path to a local file. This is also valid for the debug command.

To run only the checks for a job (non-interactively, requiring the output from an earlier successful `test` command):
```bash
$ lb-ap check MyAnalysis My2016MagDownJob local-tests/path/to/output/OUTPUT_NTUPLE.ROOT
All checks passed! Any output can be found in local-tests/path/to/output/checks
```

To run only the checks for a job but saving the output to a different location (non-interactively, requiring the output from an earlier successful `test` command):
```bash
$ lb-ap check MyAnalysis My2016MagDownJob local-tests/path/to/output/OUTPUT_NTUPLE.ROOT another/file/path
All checks passed! Any output can be found in another/file/path
```

To read a Gaudi log file and extract information:
```bash
$ lb-ap parse-log Job.log
Summary of log messages in: Job.log
    Found 2659 ERROR messages
        * 2649 instances of "*** Flag container MC/TrackInfo not found."
        * 9 instances of "HltSelReportsDecoder::   Failed to add Hlt selection name Hlt2RecSummary to its container "
        * 1 instances of "HltSelReportsDecoder:: The   ERROR message is suppressed : '  Failed to add Hlt selection name Hlt2RecSummary to its container '"
    Found 61 WARNING messages
        * 7 instances of "TupleToolBremInfo:: TupleToolBremInfo requires fullDST -  BremP and BremOrigin might not be reliable (Multiplicity is OK)"
        and 54 others (50 unique), pass "--suppress=0" to show all messages

Errors have been detected!
  * Lines: 3275, 3277, 3279, 3281, 3283 and 17 others
    This message indicates the location specified for the information being accessed by
    RelatedInfo does not exist. It is likely that either:

    * The location specified is incorrect, try looking for it with dst-dump.
    * The given information was never stored for that candidate, in which case the use of
    RelatedInfo should be removed.

General explanations
  * Line: 6318
    Histograms are not being saved as no filename has been specified for storing them. This
    message is harmless and normally ignored.
Error: Found issues in log
```


%prep
%autosetup -n LbAPLocal-0.6.3

%build
%py3_build

%install
%py3_install
install -d -m755 %{buildroot}/%{_pkgdocdir}
if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi
if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi
if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi
if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi
pushd %{buildroot}
if [ -d usr/lib ]; then
	find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/lib64 ]; then
	find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/bin ]; then
	find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/sbin ]; then
	find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst
fi
touch doclist.lst
if [ -d usr/share/man ]; then
	find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst
fi
popd
mv %{buildroot}/filelist.lst .
mv %{buildroot}/doclist.lst .

%files -n python3-LbAPLocal -f filelist.lst
%dir %{python3_sitelib}/*

%files help -f doclist.lst
%{_docdir}/*

%changelog
* Thu May 18 2023 Python_Bot <Python_Bot@openeuler.org> - 0.6.3-1
- Package Spec generated