Commit a0215b5c authored by Jose Enrique.Ruiz's avatar Jose Enrique.Ruiz
Browse files

redefine input args for provprocess.py

parent b8bdca9a
......@@ -497,7 +497,7 @@ def rawcopycliparsing(command):
##############################################################################
def provprocessparsing():
tag = standardhandle.gettag()
message = "usage: %prog [-c CONFIGFILE] <RUN_NUMBER> <DESTINATION_FOLDER>"
message = "usage: %prog [-c CONFIGFILE] <RUN_NUMBER> <DATEFOLDER> <SUBFOLDER>"
parser = OptionParser(usage=message)
parser.add_option("-c", "--config", action="store", dest="configfile", default="cfg/sequencer.cfg",
help="use specific config file [default cfg/sequencer.cfg]")
......@@ -506,12 +506,13 @@ def provprocessparsing():
# Parse the command line
(opts, args) = parser.parse_args()
# Checking arguments
if len(args) != 2:
if len(args) != 3:
standardhandle.error(tag, "incorrect number of arguments, type -h for help", 2)
# Set global variables
options.run = args[0]
options.out = args[1]
options.datefolder = args[1]
options.subfolder = args[2]
options.configfile = opts.configfile
options.quit = opts.quit
......
......@@ -4,7 +4,6 @@ Provenance post processing script for OSA pipeline
import shutil
from pathlib import Path, PurePath
from osa.utils import cliopts, standardhandle
from provenance.capture import get_activity_id, get_file_hash
from provenance.io import *
......@@ -158,31 +157,20 @@ if __name__ == "__main__":
# provprocess.py
# 02006
# /fefs/aswg/data/real/DL1/20200218/v0.4.3_v00
# v0.4.3_v00
# -c cfg/sequencer.cfg
# -q
# TODO: add type of prov processing to be done as arg - now only r0_to_dl1 in parse_lines_dl1
options, tag = cliopts.provprocessparsing()
# check LOG_FILENAME exists
if not Path(LOG_FILENAME).exists():
standardhandle.error(tag, f"file {LOG_FILENAME} does not exist", 2)
# check LOG_FILENAME is empty
# check LOG_FILENAME is not empty
if not Path(LOG_FILENAME).stat().st_size:
standardhandle.warning(tag, f"file {LOG_FILENAME} is empty")
exit()
# check options.out is a folder
if not Path(options.out).exists():
standardhandle.error(tag, f"path {options.out} does not exist", 2)
# make folder log/ if does not exist
outpath = Path(options.out) / "log"
if not outpath.exists():
outpath.mkdir()
# build base_filename with options.run and options.out
# ObservationDate = re.findall(r"DL1/(\d{8})/", options.out)[0]
base_filename = f"DL1_{options.run}_prov"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment