Thread
#prefect-community
    f

    fabian wolfmann

    1 year ago
    Hi! is there a way to access to the params given to a task on a run, when the state is pending->running, when the next state is running
    i.e
    def state_handler_test(self, obj, old_state, new_state):
    	if new_state.is_running():
                # do something with attr 
    
    class Test(Task):
    	def __init__(self):
    		self.attr = None
    		
    	def run(attr):
    		self.attr = attr
    and the
    state_handler_test
    is already set
    Kevin Kho

    Kevin Kho

    1 year ago
    Hey @fabian wolfmann, by parameters you don't mean Prefect
    Parameters
    right? You mean values that went into the Task?
    I don't think you would have access to that at the state handler. What is your use case? Do you want the behavior of the state handler to change?
    If we're talking about Prefect
    Parameters
    though, you might be able to get them through the context
    f

    fabian wolfmann

    1 year ago
    no we are not using Parameters, i will give it a try