Skip to content

Commit a7b06bf

Browse files
authored
Merge pull request #339 from cta-observatory/use-lstcam-env
Allow to decide in the cfg file if the lstcam-env should be used or not
2 parents b4934e3 + a746570 commit a7b06bf

File tree

7 files changed

+23
-20
lines changed

7 files changed

+23
-20
lines changed
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
04179 lstcam_calib_onsite_create_drs4_pedestal_file v0.7.0 2021-12-19 22:11 None None 0
2-
04183 lstcam_calib_onsite_create_calibration_file v0.7.0 2021-12-19 22:11 None None 0
1+
04179 onsite_create_drs4_pedestal_file v0.7.0 2021-12-19 22:11 None None 0
2+
04183 onsite_create_calibration_file v0.7.0 2021-12-19 22:11 None None 0

src/osa/configs/sequencer.cfg

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ DL2_PROD_ID: model2
5050
# Calibration steps in calibration pipeline script
5151
#drs4_baseline: onsite_create_drs4_pedestal_file
5252
#charge_calibration: onsite_create_calibration_file
53-
drs4_baseline: lstcam_calib_onsite_create_drs4_pedestal_file
54-
charge_calibration: lstcam_calib_onsite_create_calibration_file
55-
catB_calibration: lstcam_calib_onsite_create_cat_B_calibration_file
53+
drs4_baseline: onsite_create_drs4_pedestal_file
54+
charge_calibration: onsite_create_calibration_file
55+
catB_calibration: onsite_create_cat_B_calibration_file
5656
use_ff_heuristic_id: False
5757

5858
# Data processing steps in datasequence script
@@ -75,6 +75,8 @@ dl2_config: /software/lstchain/data/lstchain_standard_config.json
7575
mc_prod: 20240918_v0.10.12_allsky_
7676
dl3_config: /software/lstchain/data/dl3_std_config.json
7777
max_tries: 3
78+
use_lstcam_env_for_CatA_calib: False
79+
use_lstcam_env_for_CatB_calib: False
7880

7981
[MC]
8082
IRF_file: /path/to/irf.fits

src/osa/job.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,10 @@ def calibration_sequence_job_template(sequence):
515515
# Get the job header template.
516516
job_header = job_header_template(sequence)
517517

518-
commandargs = ["conda", "run", "-n", "lstcam-env", "calibration_pipeline"]
518+
if cfg.getboolean("lstchain", "use_lstcam_env_for_CatA_calib"):
519+
commandargs = ["conda", "run", "-n", "lstcam-env", "calibration_pipeline"]
520+
else:
521+
commandargs = ["calibration_pipeline"]
519522

520523
if options.verbose:
521524
commandargs.append("-v")

src/osa/scripts/sequencer_catB_tailcuts.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,10 @@ def launch_catB_calibration(run_id: int):
127127
return
128128

129129
command = cfg.get("lstchain", "catB_calibration")
130-
env_command = f"conda run -n lstcam-env {command}"
130+
if cfg.getboolean("lstchain", "use_lstcam_env_for_CatB_calib"):
131+
env_command = f"conda run -n lstcam-env {command}"
132+
else:
133+
env_command = command
131134
options.filters = get_calib_filters(run_id)
132135
base_dir = Path(cfg.get(options.tel_id, "BASE")).resolve()
133136
r0_dir = Path(cfg.get(options.tel_id, "R0_DIR")).resolve()

src/osa/scripts/tests/test_osa_scripts.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -107,17 +107,17 @@ def test_simulate_processing(
107107

108108
with open(json_file_dl1) as file:
109109
dl1 = yaml.safe_load(file)
110-
assert len(dl1["entity"]) == 37
111-
assert len(dl1["activity"]) == 3
112-
assert len(dl1["used"]) == 12
113-
assert len(dl1["wasGeneratedBy"]) == 6
110+
assert len(dl1["entity"]) == 44
111+
assert len(dl1["activity"]) == 5
112+
assert len(dl1["used"]) == 15
113+
assert len(dl1["wasGeneratedBy"]) == 10
114114

115115
with open(json_file_dl2) as file:
116116
dl2 = yaml.safe_load(file)
117-
assert len(dl2["entity"]) == 37
118-
assert len(dl2["activity"]) == 3
119-
assert len(dl2["used"]) == 12
120-
assert len(dl2["wasGeneratedBy"]) == 6
117+
assert len(dl2["entity"]) == 44
118+
assert len(dl2["activity"]) == 5
119+
assert len(dl2["used"]) == 15
120+
assert len(dl2["wasGeneratedBy"]) == 10
121121

122122
rc = run_program("simulate_processing", "-p", "-d", "2020-01-17", "LST1")
123123
assert rc.returncode == 0

src/osa/tests/test_jobs.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -381,10 +381,6 @@ def test_create_job_scheduler_calibration(sequence_list):
381381
with tempfile.TemporaryDirectory() as tmpdirname:
382382
os.environ['NUMBA_CACHE_DIR'] = tmpdirname
383383
proc = subprocess.run([
384-
'conda',
385-
'run',
386-
'-n',
387-
'lstcam-env',
388384
'calibration_pipeline',
389385
'--config',
390386
'{DEFAULT_CFG}',

src/osa/workflow/tests/test_stages.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ def test_analysis_stage(
7979
assert lines[-1].split(" ")[1] == cmd[0]
8080
assert lines[-1].split(" ")[-1] == "255\n"
8181

82-
@pytest.mark.skip(reason="Currently not working with osa environment (needs lstcam-env environment)")
8382
def test_calibration_steps(running_analysis_dir):
8483
from osa.workflow.stages import DRS4PedestalStage, ChargeCalibrationStage
8584
from osa.scripts.calibration_pipeline import drs4_pedestal_command, calibration_file_command

0 commit comments

Comments
 (0)