Hey all! Does anyone know how you can pass kwargs ...
# ask-community
s
Hey all! Does anyone know how you can pass kwargs to a task function? Right now I have a task that does a very similar thing with some tweaks depending on keywords a few times.
Copy code
@task(timeout=60, nout=2)
def get_date(
    dt,
    ensure_explicit=False,
    max_late=timedelta(hours=12),
):
    # some code
    return None, None
However, when I try and add to my flow a
get_date(dt, max_late=timedelta(minutes=1))
I get
TypeError: got an unexpected keyword argument
. I assume the task decorator is wrapping the original function and doesnt pass through any kwargs it doesnt recognise. Is there a subtle keywork Im missing to pass kwargs through, or should I rewrite these functions of mine to utilise class based Tasks?
z
Hey @Samuel Hinton -- that should work. Can you provide the full traceback?
s
Sure thing, let me simplify and try to reproduce, one tick 🙂
I think I must have made a mistake on my end! The stripped down example works, which means something Ive done must be wrong. Dammit Sam! My apologies :)