https://prefect.io logo
Title
a

ash

09/02/2021, 10:05 AM
Hello everyone , I am running my prefect on K8 cluster using helm charts. I have a separate postgres stateful database attached to persist states. I have 2 questions here :
1.) I have flow which gets data from an api and i want to publish it to slack directly, how should i do it without writing it anywhere. 
2.) If i want to save my flow/task results on a machine from where I am registering my flows despite flow running on pods on k8 ,how should i do it.
z

Zach Angell

09/02/2021, 1:54 PM
Hi @ash! For (1), I would recommend creating a task that takes the data from your api and publishes it to Slack For (2) I'd take a look at Results https://docs.prefect.io/api/latest/engine/results.html#prefectresult. If nothing fits your use case, you can write custom logic in tasks/flows to write results to the desired location
a

ash

09/03/2021, 5:25 AM
@Zach Angell thank you for the response. 1.) how shall i access the value in task output for ex my flow is this and i want to see value of df_web, since its a prefect task it now contains states and is not behaving like a functional output.
with Flow("funnnel_1", state_handlers=[flow_failed_alert]) as f:
    df_train = train_app_funnel()
    df_flight = brand_app_funnel()
    df_web = web_app_funnel()
    out = creating_final(df_train,df_flight,df_web)
z

Zach Angell

09/03/2021, 2:14 PM
Before returning output of
create_final
, you should be able to publish it to Slack
a

ash

09/04/2021, 9:01 AM
ohh ok got it. Is there a way i can retrieve it from the out variable?
z

Zach Angell

09/07/2021, 3:46 PM
You could pass it into another task
with Flow("funnnel_1", state_handlers=[flow_failed_alert]) as f:
    df_train = train_app_funnel()
    df_flight = brand_app_funnel()
    df_web = web_app_funnel()
    out = creating_final(df_train,df_flight,df_web)
    post_to_slack(out) # new task `post_to_slack` takes in `out` and posts it to slack