def main(args): if args.verbose: logger.setLevel("DEBUG") logger.debug(args) with connect_to_database_from_args(args) as cursor: entry = TransmissionEntry.from_file( args.filename, cursor, sky_radius_inner=args.radius_inner, sky_radius_outer=args.radius_outer ) entry.upload_to_database(cursor)
def update(self, cursor): try: ref_image_id = get_refcat_id(self.real_filename) except NoAutoguider: # Return early but ensure the job is removed from the database by # not propogating the exception return if not ref_catalogue_exists(cursor, ref_image_id): logger.info("Reference catalogue missing, creating") ref_image_filename = ref_image_path(ref_image_id, cursor) build_catalogue(ref_image_filename, cursor) else: logger.info("Reference catalogue exists") t = TransmissionEntry.from_file( self.real_filename, cursor, sky_radius_inner=RADIUS_INNER, sky_radius_outer=RADIUS_OUTER ) t.upload_to_database(cursor)