1

enter image description here

I'm trying to use python huey (https://github.com/coleifer/huey/blob/master/huey/api.py) to allow usage of a task queue with flask.

Based on TypeError: decorator() missing 1 required positional argument: 'func', I can use huey to create a task function without an argument using:

some_long_calculation_task = my_huey.task()(some_long_calculation)

However, I'd like to be able to pass in an argument, so I'd need something like:

some_long_calculation_task(arg) = my_huey.task()(some_long_calculation(arg)).

How would I create a task function with an argument using huey?

user1592380
  • 34,265
  • 92
  • 284
  • 515

1 Answers1

2

You are correct that this is the proper way to declare your task:

some_long_calculation_task = my_huey.task()(some_long_calculation)

If "some_long_calculation" accepts an argument, you can pass that argument in when you call "some_long_calculation_task":

# Execute the task w/the given args.
some_long_calculation_task(some_arg, another_arg)
coleifer
  • 24,887
  • 6
  • 60
  • 75