Hello, I am trying to obtain a future object from ...
# prefect-community
Hello, I am trying to obtain a future object from a toy task with a timeout state. Then ultimately send that timeout to slack. The slack integration is working but the flow calling the failed tasks never gets to access the timeout state and subsequently send it to slack. the logger prints: uuid-123 the number 42 doesn't get logged probably because it times out but I also never get to log the PrefectFuture object state .e.g. 'Timeout' Is there something I should be doing differently to catch and handle the timeout before the flow Fails
Copy code
def test_task_timeout(uuid: str):
    logger = get_run_logger()
    return 42

def test_flow_timeouts(station_id: str):
    logger = get_run_logger()

    future = test_task_timeout.submit(uuid='uuid-123')
    result = future.result()
    flow_context = context.get_run_context()
    prefect_state_handler(future_object=future, context=flow_context)
I extract the state from the Prefect Future object in the function: prefect_state_handler using the .wait() method, It just never gets a chance to execute based on logging