Skip to content

Commit

Permalink
Undo class instance renaming (to rebase), handle defect OSError better
Browse files Browse the repository at this point in the history
  • Loading branch information
mrawls committed Aug 10, 2017
1 parent 2e0b296 commit b0514c1
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions decam_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,19 +245,19 @@ def doIngest(repo, ref_cats, datafiles):
# the retarget command is from line 2 of obs_decam/config/ingest.py
config = IngestConfig()
config.parse.retarget(DecamParseTask)
# create an instance of the decam ingest task
IngestTask = ingest.DecamIngestTask(config=config)
# create an *instance* of the decam ingest task
ingestTask = ingest.DecamIngestTask(config=config)
# feed everything to the argument parser
parsedCmd = argumentParser.parse_args(config=config, args=args)
# finally, run the IngestTask
IngestTask.run(parsedCmd)
# finally, run the ingestTask
ingestTask.run(parsedCmd)
# Copy ref_cats files to repo (needed for doProcessCcd)
astrom_tarball = os.path.join(ref_cats, ASTROM_REFCAT_TAR)
photom_tarball = os.path.join(ref_cats, PHOTOM_REFCAT_TAR)
tarfile.open(astrom_tarball, 'r').extractall(os.path.join(repo, ASTROM_REFCAT_DIR))
tarfile.open(photom_tarball, 'r').extractall(os.path.join(repo, PHOTOM_REFCAT_DIR))
print('Images are now ingested in {0}'.format(repo))
ingest_metadata = IngestTask.getFullMetadata()
ingest_metadata = ingestTask.getFullMetadata()
return ingest_metadata


Expand Down Expand Up @@ -288,18 +288,18 @@ def flatBiasIngest(repo, calib_repo, calibdatafiles):
argumentParser = IngestCalibsArgumentParser(name='ingestCalibs')
config = IngestCalibsConfig()
config.parse.retarget(ingestCalibs.DecamCalibsParseTask)
CalibIngestTask = IngestCalibsTask(config=config, name='ingestCalibs')
calibIngestTask = IngestCalibsTask(config=config, name='ingestCalibs')
parsedCmd = argumentParser.parse_args(config=config, args=args)
try:
CalibIngestTask.run(parsedCmd)
calibIngestTask.run(parsedCmd)
except sqlite3.IntegrityError as detail:
print('sqlite3.IntegrityError: ', detail)
print('(sqlite3 doesn\'t think all the calibration files are unique)')
flatBias_metadata = None
else:
print('Success!')
print('Calibrations corresponding to {0} are now ingested in {1}'.format(repo, calib_repo))
flatBias_metadata = CalibIngestTask.getFullMetadata()
flatBias_metadata = calibIngestTask.getFullMetadata()
return flatBias_metadata


Expand Down Expand Up @@ -338,8 +338,11 @@ def defectIngest(repo, calib_repo, defectfiles):
try:
os.mkdir('defects')
except OSError:
# defects directory already exists
print('Defects were previously ingested, skipping...')
# most likely the defects directory already exists
if os.path.isdir('defects'):
print('Defects were previously ingested, skipping...')
else:
print('Defect ingestion failed because \'defects\' dir could not be created')
defect_metadata = None
else:
print('Ingesting defects...')
Expand Down

0 comments on commit b0514c1

Please sign in to comment.