How to get response from API call made via executor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-02-2025 06:52 AM
Hi Guys,
I'm trying to call multiple APIs via executor using foreach partition, However as API response is getting returned at executor level I'm unable to see the response of API weather its 200 or 500.
I dont want my APIs to execute on driver so I'm avoiding toPandas or Multi threading on Driver side.
Note: I've enabled logs to save in the Volume but there is no trace of the return response from API in the executor logs.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-07-2025 09:20 AM
Vaibhavaher2025 -
I recommend trying the following:
1. Write logs from executors to persist storage insideprocess_partition.
2. Use mapPartitions instead offoreachPartition to return responses back to the driver as a Dataframe
3. Check executor logs in Spark UI under Executors -> Logs for anylogger.info outputs.
Remember, foreachPartition doesn’t return data, so to see API responses, either write to external storage or use mapPartitions to collect results.