https://prefect.io logo
Title
s

Seif Harrathi

11/29/2022, 9:38 AM
Hey I'm new with Prefect and I have a small issue. Like I was able to run prefect inside a docker with as S3 Minio everything works fine, even I was able to trigger my flow run via an API call /api/deployments/{id}/create_flow_run. My flow:
@flow(name="Run Check", description="Flow that controls the data integrity")
def run_check(layers_data):
    """
    1- Extract data from Arcgis databse
    2- Transform data
    3- Load result into Excel output
    @param layers_data:
    @return:
    """
    # 1- Extract data from  databse
    state = extract_data(layers_data, return_state=True)
    raw = state.result()
    # 2- Transform data
    state = DataTransformer.transform_results(raw, return_state=True)
    data = state.result()
    # 3- Load result into Excel output
    state = DataWriter.load_results(data, return_state=True)
    output = state.result()
    return {"Result": {
        "nb_errors": 12,
        "nb_lines_checked": 456
    },
        "output_path": "path_to_s3"
    }
My question is how to get the results returned by my flow run like I want to get
{
  "Result": {
    "nb_errors": 12,
    "nb_lines_checked": 456
  },
  "output_path": "path_to_s3"
}
I used the Endpoint :/api/flow_runs/{id} But I I dont the my result in the response 😕 Any help ? Any idea . I thought about saving the result in the S3 bucket than retrieve it but not sure if this is the best practice Thaaaaaaaaaaaanks in advance
1
s

Serina

11/29/2022, 7:19 PM
I’m not exactly sure what you mean by
get the results
-- If you don’t need to pass the data somewhere else, but you’re just wanting to view the results in the UI you could use logging https://docs.prefect.io/concepts/logs/?h=logging
s

Seif Harrathi

11/29/2022, 7:38 PM
I mean I need to pass the data to somewhere else. I have a microservice that calls the Prefect API to trigger a flow and that waits for a response
s

Serina

11/29/2022, 8:18 PM
Hi Seif, in that case I think this might be helpful for you https://docs.prefect.io/concepts/results/#toggling-persistence
s

Seif Harrathi

11/30/2022, 8:20 AM
thanks ^^
🙌 1