Commit 62e53031 authored by Monica Rainer's avatar Monica Rainer
Browse files

Fix bug in raws variable declaration (ONLINE mode)

parent dc41e46e
......@@ -48,30 +48,28 @@ from watchdog.events import PatternMatchingEventHandler
# --------------------------------
docopt_args = docopt(__doc__)
# watchdog append fits files to the raw list
class UpdateRawList(PatternMatchingEventHandler):
def process(self, event):
raws.append(event.src_path)
drslogger.log('File %s has arrived.' % (event.src_path))
def on_created(self, event):
ext = os.path.splitext(event.src_path)[1]
if ext == '.fts':
self.process(event)
def run_gofio(CONFIG, rawlists, dbcalib, working, group, stop, drslogger, dbnight, dbramps):
do_calib = CONFIG['DO_CALIB']
rawdir = CONFIG['RAW_DIR']
# check if there are already files in RAW_DIR, create list raws in temporal order
fits = os.path.join(rawdir,"*.fts")
#global raws
raws = glob.glob(fits)
raws.sort()
# watchdog append fits files to the raw list
class UpdateRawList(PatternMatchingEventHandler):
def process(self, event):
#global raws
raws.append(event.src_path)
drslogger.log('File %s has arrived.' % (event.src_path))
def on_created(self, event):
ext = os.path.splitext(event.src_path)[1]
if ext == '.fts':
self.process(event)
# use watchdog to check when new files are created
observer = Observer()
observer.schedule(UpdateRawList(),rawdir)
......@@ -112,7 +110,6 @@ def run_gofio(CONFIG, rawlists, dbcalib, working, group, stop, drslogger, dbnigh
sys.exit(0)
except KeyboardInterrupt:
observer.stop()
# reduce any file still pending!
if working:
......
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