def distort_image_shepards_task(img_id_in, img_id_out, distortion_set_id): try: distort_image_shepards(image_id_in=img_id_in, image_id_out=img_id_out, distortion_set_id=distortion_set_id) except Exception as e: log_asynchronous_exception(e)
def edge_detect_task(img_id_in, detection_threshold='all', auto_id=None, wide_id=None, tight_id=None): try: edge_detect(img_id_in, detection_threshold, auto_id, wide_id, tight_id) except Exception as e: log_asynchronous_exception(e)
def distort_image_shepards_chained(_, img_id_in, img_id_out): ''' For now assume no distortion_set_id for chained distortions. If we need a distortion set we'll get whatever has been associated with the group ''' try: distort_image_shepards(image_id_in=img_id_in, image_id_out=img_id_out, distortion_set_id=None) except Exception as e: log_asynchronous_exception(e)
def thermal_still_task(snap_id, group_id, pic_id, clean_up_files): ''' Wrapper method to handle the celery scheduling of the taking of a single Lepton still. Calls the synchronous take_thermal_still method. ''' try: camera.services.take_thermal_still(snap_id, group_id, pic_id, clean_up_files) except Exception as e: log_asynchronous_exception(e)
def scale_image_chained(_, img_id_in, img_id_out, group_id, **kwargs): try: if 'scale_image' in kwargs and not kwargs['scale_image']: # allow this functionality to be suppressed by a kwarg for 'scale_image' that evaluates to false pass else: scale_image(img_id_in, img_id_out, group_id, **kwargs) except Exception as e: log_asynchronous_exception(e)
def picam_still_task(snap_id, group_id, normal_exposure_pic_id, long_exposure_pic_id, clean_up_files=True): ''' Wrapper method to handle the celery scheduling of the taking of a single Picam still. Calls the synchronous take_picam_still method. ''' try: camera.services.take_picam_still(snap_id, group_id, normal_exposure_pic_id, long_exposure_pic_id, clean_up_files) except Exception as e: log_asynchronous_exception(e)
def merge_images_chained(_, img1_primary_id_in, img1_alternate_id_in, img2_id_in, img_id_out, group_id): try: merge_images(img1_primary_id_in=img1_primary_id_in, img1_alternate_id_in=img1_alternate_id_in, img2_id_in=img2_id_in, img_id_out=img_id_out, group_id=group_id) except Exception as e: log_asynchronous_exception(e)
def merge_images_task(img1_primary_id_in, img1_alternate_id_in, img2_id_in, img_id_out, group_id, **kwargs): try: merge_images(img1_primary_id_in=img1_primary_id_in, img1_alternate_id_in=img1_alternate_id_in, img2_id_in=img2_id_in, img_id_out=img_id_out, group_id=group_id, **kwargs) except Exception as e: log_asynchronous_exception(e)
def take_picam_still_chained(_, snap_id, group_id, normal_exposure_pic_id, long_exposure_pic_id, clean_up_files): ''' Wrapper method to handle the celery scheduling of the taking of a single Picam still, with an extra parameter to handle how celery chains tasks. Calls the synchronous take_picam_still method. ''' # don't call picam_still_task here. It would cause a new celery task to be created, which would be out of # sequence with the original chain of tasks we belong to try: camera.services.take_picam_still(snap_id, group_id, normal_exposure_pic_id, long_exposure_pic_id, clean_up_files) except Exception as e: log_asynchronous_exception(e)
def clean_up_files_chained(_, snap_id, group_id): try: admin.services.clean_up_files(snap_id, group_id) except Exception as e: log_asynchronous_exception(e)
def upload_files_to_s3_task(snap_id, group_id): try: admin.services.upload_files_to_s3(snap_id, group_id) except Exception as e: log_asynchronous_exception(e)
def scale_image_task(img_id_in, img_id_out, group_id, **kwargs): try: scale_image(img_id_in, img_id_out, group_id, **kwargs) except Exception as e: log_asynchronous_exception(e)
def send_mail_chained(_, snap_id, group_id): try: admin.services.send_mail(snap_id, group_id) except Exception as e: log_asynchronous_exception(e)