Skip to content

Commit 3b3f968

Browse files
committed
Merge branch 'master' of https://github.com/i4Ds/STIXCore
2 parents e716f41 + 1f54c09 commit 3b3f968

11 files changed

Lines changed: 451 additions & 72 deletions

File tree

.zenodo.json

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"description": "STIXCore is the software pipeline for STIX data, turning raw telemetry into standards compliant FITS files for anaysis",
2+
"description": "STIXCore is the software pipeline for STIX data, turning raw telemetry into standards compliant FITS files for analysis",
33
"license": "bsd-3-clause",
44
"title": "STIXCore",
55
"upload_type": "software",
@@ -14,12 +14,6 @@
1414
"orcid": "0009-0005-3785-7643",
1515
"affiliation": "Ateleris GmbH Switzerland"
1616
},
17-
{
18-
"name": "",
19-
"orcid": "",
20-
"affiliation": ""
21-
}
22-
2317
],
2418
"access_right": "open"
2519
}

stixcore/io/fits/processors.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,10 +476,11 @@ def write_fits(self, product, *, version=0):
476476
data_hdu.name = 'DATA'
477477
hdul = fits.HDUList([primary_hdu, control_hdu, data_hdu])
478478

479-
logger.info(f'Writing fits file to {path / filename}')
480479
fullpath = path / filename
480+
logger.info(f'start writing fits file to {fullpath}')
481481
hdul.writeto(fullpath, overwrite=True, checksum=True)
482482
files.append(fullpath)
483+
logger.info(f'done writing fits file to {fullpath}')
483484

484485
return files
485486

stixcore/processing/pipeline.py

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import io
2-
import os
32
import re
43
import sys
54
import time
@@ -375,18 +374,23 @@ def status_server(self):
375374
connection.close()
376375

377376

378-
def search_unprocessed_tm_files(logging_dir, tm_dir):
377+
def search_unprocessed_tm_files(logging_dir, tm_dir, last_processed):
379378

380379
unprocessed_tm_files = list()
381-
list_of_log_files = logging_dir.glob('*.out')
382-
latest_log_file = max(list_of_log_files, key=os.path.getmtime)
383-
print(f"{latest_log_file}: {latest_log_file.stat().st_mtime}")
380+
latest_log_file = logging_dir / last_processed
384381
tm_file = Path(tm_dir / str(latest_log_file.name)[0:-4])
385-
if tm_file.exists():
386-
ftime = tm_file.stat().st_mtime
387-
for tmf in tm_dir.glob("*.xml"):
388-
if TM_REGEX.match(tmf.name) and tmf.stat().st_mtime > ftime:
389-
unprocessed_tm_files.append(tmf)
382+
ftime = tm_file.stat().st_mtime
383+
384+
for tmf in tm_dir.glob("*.xml"):
385+
log_out_file = logging_dir / (tmf.name + ".out")
386+
log_file = logging_dir / (tmf.name + ".log")
387+
logger.info(f"test: {tmf.name}")
388+
if TM_REGEX.match(tmf.name) and tmf.stat().st_mtime > ftime and (not log_out_file.exists()
389+
or not log_file.exists()):
390+
unprocessed_tm_files.append(tmf)
391+
logger.info(f"NOT FOUND: {log_out_file.name}")
392+
else:
393+
logger.info(f"found: {log_out_file.name}")
390394
return unprocessed_tm_files
391395

392396

@@ -413,7 +417,8 @@ def main():
413417
PipelineStatus.instance = PipelineStatus(tm_handler)
414418
if CONFIG.getboolean('Pipeline', 'start_with_unprocessed', fallback=True):
415419
logger.info("Searching for unprocessed tm files")
416-
unprocessed_tm_files = search_unprocessed_tm_files(log_dir, tmpath)
420+
last_processed = CONFIG.get('Pipeline', 'last_processed', fallback="")
421+
unprocessed_tm_files = search_unprocessed_tm_files(log_dir, tmpath, last_processed)
417422
if unprocessed_tm_files:
418423
fl = '\n '.join([f.name for f in unprocessed_tm_files])
419424
logger.info(f"Found unprocessed tm files: \n {fl}\nadding to queue.")

0 commit comments

Comments
 (0)