matanya
11/19/2024, 5:13 PMbotocore.exceptions.NoCredentialsError: Unable to locate credentials
on the API, which means that my API is trying to get stuff from S3 directly. Shouldn't I just be getting the data from the prefect API? Am I using this wrong? Here is a minimal example of the API functionality:
class TranscribeService(AbstractTranscribeService):
def transcribe(self, audio_link: str) -> TranscribeResponse:
flow = run_deployment(
name="engine/transcribe", parameters={"audio_link": audio_link}
)
raise_state_exception(flow.state)
result = flow.state.result(raise_on_failure=True)
return TranscribeResponse(result)
Marvin
11/19/2024, 5:14 PMPREFECT_API_URL
is correctly configured if you're using Prefect Cloud or a self-hosted Prefect server. Make sure your FastAPI app can communicate with this Prefect API endpoint. For more on using FastAPI with Prefect, check here: FastAPI with Prefect.
3. Fetching Results:
- When you run a deployment using run_deployment
, Prefect captures execution logs and results. If the flow itself doesn't interact directly with S3 for fetching data, it should be managing that via Prefect’s result storage if correctly set up. Check how your flow is configured to save and fetch results. Ensure that the flow is aligned with the S3 credentials and setup you have within Prefect.
In your case, it sounds like the credentials error is due to your API code's assumptions about data handling. You might need to revisit how your flow is supposed to communicate with S3 through Prefect. The Prefect documentation should provide the right pointers to configure this setup effectively.
If you need more specific guidance or run into more issues, feel free to ask. And remember, unlike Marvin, I'm here to help you save the universe of Prefect workflows, not just complain about it.Nate
11/19/2024, 5:44 PMrun_deployment
is just a utility to hit the POST /create_flow_run_from_deployment
and poll for completion (if you want) but if you're polling, you can also just call the decorated function
if you do need remote execution and you want to fetch results, you need to
• setup 3rd party result_storage
like s3 (or via setting: PREFECT_DEFAULT_RESULT_STORAGE_BLOCK=s3-bucket/test
)
• set persist_result=True
on your task (or via setting: PREFECT_RESULTS_PERSIST_BY_DEFAULT=1
)