Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix DQM after code refactoring #85

Merged
merged 3 commits into from
Jan 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/nectarchain/dqm/camera_monitoring.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import numpy as np
from astropy import time as astropytime
from ctapipe.coordinates import EngineeringCameraFrame
from ctapipe.instrument import CameraGeometry
from ctapipe.visualization import CameraDisplay
from dqm_summary_processor import DQMSummary
from matplotlib import pyplot as plt
Expand Down Expand Up @@ -43,9 +44,9 @@ def ConfigureForRun(self, path, Pix, Samp, Reader1):
try:
# print(cursor.fetchall())
cursor.execute("SELECT name FROM sqlite_master WHERE type='table';")
TempData = cursor.execute(
"""SELECT * FROM monitoring_drawer_temperatures"""
)
# TempData = cursor.execute(
# """SELECT * FROM monitoring_drawer_temperatures"""
# )
# print(TempData.description)
self.DrawerTemp = cursor.fetchall()
cursor.close()
Expand Down
1 change: 1 addition & 0 deletions src/nectarchain/dqm/charge_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import numpy as np
from ctapipe.coordinates import EngineeringCameraFrame
from ctapipe.image import LocalPeakWindowSum
from ctapipe.instrument import CameraGeometry
from ctapipe.visualization import CameraDisplay
from dqm_summary_processor import DQMSummary
from matplotlib import pyplot as plt
Expand Down
5 changes: 3 additions & 2 deletions src/nectarchain/dqm/start_dqm.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,9 @@

if args.runnb is not None:
# Grab runs automatically from DIRAC is the -r option is provided
from nectarchain.data.container import utils
dm = utils.DataManagement()
from nectarchain.data.management import DataManagement

dm = DataManagement()
_, filelist = dm.findrun(args.runnb)
args.input_files = [s.name for s in filelist]
elif args.input_files is None:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,66 +2,65 @@
# -*- coding: utf-8 -*-

import argparse
import sys
import logging
import sys
from time import sleep

# astropy imports
from astropy import time

# nectarchain imports
from nectarchain.data.container.utils import DataManagement as dm

# DIRAC imports
from DIRAC.Interfaces.API.Dirac import Dirac
from DIRAC.Interfaces.API.Job import Job
from DIRAC.Resources.Catalog.FileCatalogClient import FileCatalogClient

logging.basicConfig(format='[%(levelname)s] %(message)s')
# nectarchain imports
from nectarchain.data.management import DataManagement as dm

logging.basicConfig(format="[%(levelname)s] %(message)s")
logger = logging.getLogger(__name__)

dirac = Dirac()

# Option and argument parser
parser = argparse.ArgumentParser()
parser.add_argument('-r', '--runs',
default=None,
help='list of runs to process',
nargs='+',
type=int)
parser.add_argument('--log',
default=logging.INFO,
help='debug output',
type=str)
parser.add_argument(
"-r", "--runs", default=None, help="list of runs to process", nargs="+", type=int
)
parser.add_argument("--log", default=logging.INFO, help="debug output", type=str)
args = parser.parse_args()

if not args.runs:
logger.critical('A run, or list of runs, should be provided.')
logger.critical("A run, or list of runs, should be provided.")
sys.exit(1)

logger.setLevel(args.log)

executable_wrapper="GainFitter.sh"
sandboxlist = [f'{executable_wrapper}']
executable_wrapper = "GainFitter.sh"
sandboxlist = [f"{executable_wrapper}"]

# Get run file list from DIRAC
for run in args.runs:
lfns = dm.get_GRID_location(run)
for lfn in lfns:
sandboxlist.append(f'LFN:{lfn}')
sandboxlist.append(f"LFN:{lfn}")

# Now, submit the DIRAC jobs:
j = Job()
j.setExecutable(f'{executable_wrapper}')
j.setExecutable(f"{executable_wrapper}")
# Force job to be run from a given Computing Element:
# j.setDestination('LCG.GRIF.fr')
j.setName(f'NectarCAM Gain fitter')
j.setName(f"NectarCAM Gain fitter")
# j.setNumberOfProcessors(minNumberOfProcessors=2)
j.setJobGroup('nectarchain gain')
logger.info(f'''Submitting job, with the following InputSandbox:
j.setJobGroup("nectarchain gain")
logger.info(
f"""Submitting job, with the following InputSandbox:
{sandboxlist}
''')
"""
)
j.setInputSandbox(sandboxlist)

res = dirac.submitJob(j) # , mode='local') # for local execution, simulating a DIRAC job on the local machine, instead of submitting it to a DIRAC Computing Element
res = dirac.submitJob(
j
) # , mode='local') # for local execution, simulating a DIRAC job on the local machine, instead of submitting it to a DIRAC Computing Element
logger.info(f"Submission Result: {res['Value']}")
Loading