https://prefect.io logo
Title
k

Ken Nguyen

03/04/2022, 6:39 PM
I have a noob question, are you able to add a
@task
decorator on a function imported from a library (as opposed to one I defined)?
k

Kevin Kho

03/04/2022, 6:41 PM
I think the decorator syntax in Python is upon function declaration so you need to wrap it explicitly to convert from func to task
some_func = task(some_func)
k

Ken Nguyen

03/04/2022, 6:43 PM
When I do that, do I need to include all the functions inputs? For example:
some_func(input1, input2=True, input3) = task( some_func(input1, input2=True, input3)  )
?
k

Kevin Kho

03/04/2022, 6:47 PM
I think using task like that returns the same thing as the Task decorator, which is a class where the func goes in the
run
method