Commit 1b2352a4 authored by Leo Pound Singer's avatar Leo Pound Singer
Browse files

WIP: Idea for incorporating conditionals into canvases

parent ff53f3ba
Pipeline #23987 passed with stages
in 1 minute and 56 seconds
"""Base classes for other Celery tasks."""
from celery import group
from celery.exceptions import Ignore
from celery.utils.log import get_task_logger
from ..celery import app
......@@ -14,6 +15,56 @@ def identity(arg):
return arg
@app.task(ignore_result=True, shared=False)
def halt():
"""Task that halts further processing of the chain."""
raise Ignore()
@app.task(shared=False)
def iftrue(arg):
"""
Pass through if ``bool(arg)`` is True.
Otherwise, halt further processing of the chain.
"""
if arg:
return arg
halt()
@app.task(shared=False)
def iffalse(arg):
"""
Pass through if ``bool(arg)`` is False.
Otherwise, halt further processing of the chain.
"""
if not arg:
return arg
halt()
@app.task(shared=False)
def ifeq(arg, value):
"""
Pass through if ``arg`` equals ``value``.
Otherwise, halt further processing of the chain.
"""
if arg == value:
return arg
halt()
@app.task(shared=False)
def ifneq(arg, value):
"""
Pass through if ``arg`` does not equal ``value``.
Otherwise, halt further processing of the chain.
"""
if arg != value:
return arg
halt()
class DispatchHandler(dict):
def process_args(self, *args, **kwargs):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment