Is there a way to get the currently defined `Resul...
# prefect-server
t
Is there a way to get the currently defined
Result
class/instance for a given task within the task itself?
k
If you’re using a subclass like
class MyTask(Task):
, just 
self.result
might work.
t
Argh, I’m just using
@task
. Is there no way to reference the current task in the context?
Because referencing the above issue with local vs remote flows, there are use cases that need to know the result class (i.e you’re running locally or in k8s) to make a decision.
k
I don’t think so within the task itself because it hasn’t been instantiated yet at point.
t
so I’m using it specifically like this:
Copy code
@task
def task():
    result = get_result_class_somehow()
    do_stuff(result.location)
    return result
https://github.com/PrefectHQ/prefect/discussions/4597
but it’s ok, I’ll work something out