Belle II Software  release-05-02-19
test_caf.py
1 import os
2 import json
3 import subprocess
4 import validation_gt as vgt
5 import b2test_utils
6 
7 
9 
10  # Prepare the configuration dictionary for CAF and dump it into a JSON file.
11  config = {
12  "caf_script": "caf_klm_channel_status.py",
13  "database_chain": [globaltag for globaltag in reversed(vgt.get_validation_globaltags())],
14  "requested_iov": [0, 0, -1, -1]
15  }
16  with open("config.json", "w") as config_json:
17  json.dump(config, config_json)
18 
19  # Prepare the input files for the calibration and dump them into a JSON file.
20  input_files = {
21  "raw_physics": [
22  [f"{os.environ['BELLE2_VALIDATION_DATA_DIR']}/calibration/cdst_e0008_r3121_hadronSkim/", [8, 3121]],
23  [f"{os.environ['BELLE2_VALIDATION_DATA_DIR']}/calibration/cdst_e0010_r5095_hadronSkim/", [10, 5095]]
24  ],
25  "raw_cosmic": [
26  [f"{os.environ['BELLE2_VALIDATION_DATA_DIR']}/calibration/cdst_e0008_r3121_cosmicSkim/", [8, 3121]],
27  [f"{os.environ['BELLE2_VALIDATION_DATA_DIR']}/calibration/cdst_e0010_r5095_cosmicSkim/", [10, 5095]]
28  ],
29  "raw_beam": []
30  }
31  with open("input_files.json", "w") as input_files_json:
32  json.dump(input_files, input_files_json)
33 
34  # Now simply run the calibration locally (on our CI/CD servers we can not test different backends).
35  subprocess.check_call(['b2caf-prompt-run', 'Local', 'config.json', 'input_files.json', '--heartbeat', '10'])
b2test_utils.clean_working_directory
def clean_working_directory()
Definition: __init__.py:176