Decorators¶
-
cloudify.decorators.operation(func=None, **arguments)[source]¶ Decorate plugin operation function with this decorator. Internally, if celery is installed, will also wrap the function with a
@celery.taskdecoratorThe
ctxinjected to the function arguments is of typecloudify.context.CloudifyContextThe
ctxobject can also be accessed by importingcloudify.ctxExample:
from cloudify import ctx @operations def start(**kwargs): pass
-
cloudify.decorators.workflow(func=None, system_wide=False, **arguments)[source]¶ Decorate workflow functions with this decorator. Internally, if celery is installed,
@workflowwill also wrap the function with a@celery.taskdecoratorThe
ctxinjected to the function arguments is of typecloudify.workflows.workflow_context.CloudifyWorkflowContextorcloudify.workflows.workflow_context.CloudifySystemWideWorkflowContextifsystem_wideflag is set to True.The
ctxobject can also be accessed by importingcloudify.workflows.ctxsystem_wideflag turns this workflow into a system-wide workflow that is executed by the management worker and has access to an instance ofcloudify.workflows.workflow_context.CloudifySystemWideWorkflowContextas its context.Example:
from cloudify.workflows import ctx @workflow def reinstall(**kwargs): pass