Hi! I’ve been using prefect for a pandas-heavy pip...
# ask-community
g
Hi! I’ve been using prefect for a pandas-heavy pipeline and I started to write some very redundant code. I can’t help but think there’s a nicer way than what I’m doing to achieve the desired result. I have a couple decorators I’m inserting into a function inside the task, then calling that function at the end. It works, but was wondering if I could extend the Task class or create one decorator with all the task calling stuff. My brain feels like a pretzel, is there any python superhero who’s been through this?
a
Hi @Greg Adams, you can definitely extend the base
Task
class. In the documentation, there is an example
HTTPGetTask
showing how you can subclass a task.
👍 2
m
@Greg Adams you can also compose decorators! https://www.py4u.net/discuss/14440
🙌 1
g
@Matt Alhonte looks like a cool solution, I’ll try it out
I’ve tried extending the class, and making my own style of ‘composed’ decorator. Think I’m just having Python growing pains…