Skip to content

Commit

Permalink
add default osa cfg to package data, move cfg to osa/configs and adap…
Browse files Browse the repository at this point in the history
…t tests
  • Loading branch information
morcuended committed Apr 27, 2022
1 parent 5bb7118 commit dfedfba
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
9 changes: 8 additions & 1 deletion osa/configs/config.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
"""Open the lstosa configuration file."""

import configparser
import logging
import sys
import configparser
from pathlib import Path

from importlib_resources import files

from osa.configs import options
from osa.utils.logging import myLogger

Expand All @@ -22,9 +24,14 @@ def read_config():
config: ConfigParser
Configuration file cfg
"""

DEFAULT_CFG = files("osa").joinpath("configs/sequencer.cfg")

for idx, arg in enumerate(sys.argv):
if arg in ["-c", "--config"]:
options.configfile = sys.argv[idx + 1]
else:
options.configfile = DEFAULT_CFG

file = options.configfile

Expand Down
File renamed without changes.
10 changes: 5 additions & 5 deletions osa/tests/test_jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ def test_create_job_template_scheduler(
proc = subprocess.run([
'datasequence',
'--config',
'{Path.cwd()}/cfg/sequencer.cfg',
'{Path.cwd()}/osa/configs/sequencer.cfg',
'--date=2020_01_17',
'--prod-id=v0.1.0',
'--drs4-pedestal-file={drs4_baseline_file}',
Expand Down Expand Up @@ -211,7 +211,7 @@ def test_create_job_template_scheduler(
proc = subprocess.run([
'datasequence',
'--config',
'{Path.cwd()}/cfg/sequencer.cfg',
'{Path.cwd()}/osa/configs/sequencer.cfg',
'--date=2020_01_17',
'--prod-id=v0.1.0',
'--drs4-pedestal-file={drs4_baseline_file}',
Expand Down Expand Up @@ -275,7 +275,7 @@ def test_create_job_template_local(
proc = subprocess.run([
'datasequence',
'--config',
'{Path.cwd()}/cfg/sequencer.cfg',
'{Path.cwd()}/osa/configs/sequencer.cfg',
'--date=2020_01_17',
'--prod-id=v0.1.0',
'--drs4-pedestal-file={drs4_baseline_file}',
Expand Down Expand Up @@ -306,7 +306,7 @@ def test_create_job_template_local(
proc = subprocess.run([
'datasequence',
'--config',
'{Path.cwd()}/cfg/sequencer.cfg',
'{Path.cwd()}/osa/configs/sequencer.cfg',
'--date=2020_01_17',
'--prod-id=v0.1.0',
'--drs4-pedestal-file={drs4_baseline_file}',
Expand Down Expand Up @@ -349,7 +349,7 @@ def test_create_job_scheduler_calibration(sequence_list):
proc = subprocess.run([
'calibration_pipeline',
'--config',
'{Path.cwd()}/cfg/sequencer.cfg',
'{Path.cwd()}/osa/configs/sequencer.cfg',
'--date=2020_01_17',
'--drs4-pedestal-run=01804',
'--pedcal-run=01805',
Expand Down

0 comments on commit dfedfba

Please sign in to comment.