https://prefect.io logo
Title
m

Maximilian Schnieder

08/02/2022, 5:55 AM
Hi, I was wondering if I could use prefect for object methods. My use case would be that instead of creating a thread that runs inside the object every 60 seconds, I could create a scheduled flow for the object. But is this even possible? And how would the deployment file look?
👀 1
1
b

Bianca Hoch

08/02/2022, 9:01 PM
Hello Maximillian, thanks for reaching out. I'm not 100% I understand your use case here. What do you mean by object methods?
Are you referring to an object oriented programming approach like this user?
:gratitude-danke: 1
m

Maximilian Schnieder

08/03/2022, 8:50 AM
If I understand it correctly, yes. I for example have a class called "Job Manager" who is instanciated as an object and inside there are methods that could be solved as tasks. The problem is, that I can not use prefect inside an object, because it seems that it can not handle the self reference very well.
The problem is, that prefect also wants to receive self, but this does not work. Alternatively I could just use static methods...
b

Bianca Hoch

08/04/2022, 1:48 PM
Understood, I agree with Jeff that this would be an interesting route to explore in the future. I'd encourage you to open an issue in our GitHub talking about your use case.