Python celery.signals.task_postrun.connect() Examples
The following are 4
code examples of celery.signals.task_postrun.connect().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
celery.signals.task_postrun
, or try the search function
.
Example #1
Source File: app.py From lightflow with BSD 3-Clause "New" or "Revised" License | 5 votes |
def create_app(config): """ Create a fully configured Celery application object. Args: config (Config): A reference to a lightflow configuration object. Returns: Celery: A fully configured Celery application object. """ # configure the celery logging system with the lightflow settings setup_logging.connect(partial(_initialize_logging, config), weak=False) task_postrun.connect(partial(_cleanup_workflow, config), weak=False) # patch Celery to use cloudpickle instead of pickle for serialisation patch_celery() # create the main celery app and load the configuration app = Celery('lightflow') app.conf.update(**config.celery) # overwrite user supplied settings to make sure celery works with lightflow app.conf.update( task_serializer='pickle', accept_content=['pickle'], result_serializer='pickle', task_default_queue=DefaultJobQueueName.Task ) if isinstance(app.conf.include, list): app.conf.include.extend(LIGHTFLOW_INCLUDE) else: if len(app.conf.include) > 0: raise ConfigOverwriteError( 'The content in the include config will be overwritten') app.conf.include = LIGHTFLOW_INCLUDE return app
Example #2
Source File: logger.py From KubeOperator with Apache License 2.0 | 4 votes |
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) task_prerun.connect(self.on_task_start) task_postrun.connect(self.on_start_end)
Example #3
Source File: celery.py From zeus with Apache License 2.0 | 4 votes |
def init_app(self, app): self.app = app new_celery = celery.Celery( app.import_name, broker=app.config["CELERY_BROKER_URL"], backend=app.config["CELERY_RESULT_BACKEND"], ) # XXX(dcramer): why the hell am I wasting time trying to make Celery work? self.celery.__dict__.update(vars(new_celery)) self.celery.conf.update(app.config) worker_process_init.connect(self._worker_process_init) task_postrun.connect(self._task_postrun) task_prerun.connect(self._task_prerun)
Example #4
Source File: celery.py From scout_apm_python with MIT License | 4 votes |
def install(app=None): if app is not None: copy_configuration(app) installed = scout_apm.core.install() if not installed: return before_task_publish.connect(before_task_publish_callback) task_prerun.connect(task_prerun_callback) task_postrun.connect(task_postrun_callback)