def run_file_exporting(self, task_filter_options=None, annotation_filter_options=None, serialization_options=None): if self.status == self.Status.IN_PROGRESS: logger.warning('Try to export with in progress stage') return self.status = self.Status.IN_PROGRESS self.save(update_fields=['status']) logger.info(f'Start file_exporting {self}') if redis_connected(): queue = django_rq.get_queue('default') job = queue.enqueue( export_background, self.id, task_filter_options, annotation_filter_options, serialization_options, on_failure=set_export_background_failure, job_timeout='3h', # 3 hours ) else: self.export_to_file( task_filter_options=task_filter_options, annotation_filter_options=annotation_filter_options, serialization_options=serialization_options, )
def sync(self): if redis_connected(): queue = django_rq.get_queue('default') job = queue.enqueue(export_sync_background, self.__class__, self.id) logger.info(f'Storage sync background job {job.id} for storage {self} has been started') else: logger.info(f'Start syncing storage {self}') self.save_all_annotations()
def sync(self): if redis_connected(): queue = django_rq.get_queue('default') job = queue.enqueue(sync_background, self.__class__, self.id) # job_id = sync_background.delay() # TODO: @niklub: check this fix logger.info(f'Storage sync background job {job.id} for storage {self} has been started') else: logger.info(f'Start syncing storage {self}') self.scan_and_create_links()
def run_file_exporting(self): if self.status == self.Status.IN_PROGRESS: logger.warning('Try to export with in progress stage') return self.status = self.Status.IN_PROGRESS self.save(update_fields=['status']) if redis_connected(): queue = django_rq.get_queue('default') job = queue.enqueue(export_background, self.id) logger.info( f'File exporting background job {job.id} for export {self} has been started' ) else: logger.info(f'Start file_exporting {self}') self.export_to_file()