i

    itay livni

    2 years ago
    Hi - Is it possible to have a class with x number of methods as tasks?
    Chris White

    Chris White

    2 years ago
    Hi itay - I don’t think I understand the question; if you create a Task class by subclassing the Prefect task you can definitely add as many methods to it as you want that you can call within your run method
    i

    itay livni

    2 years ago
    something like this
    Basically a class with multiple run methods
    Chris White

    Chris White

    2 years ago
    Gotcha; unfortunately I don’t think this will work. What you could do instead might be:
    class BaseDefinitions(Task):
        ...
    and then subclass this into two distinct Task classes with different run methods -> that way you can still reuse your other methods / logic
    i

    itay livni

    2 years ago
    yeah - that is the conclusion I got to after mucking around a bit more