<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic How to get response from API call  made via executor in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/how-to-get-response-from-api-call-made-via-executor/m-p/117523#M45516</link>
    <description>&lt;P&gt;Hi Guys,&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;I dont want my APIs to execute on driver so I'm avoiding toPandas or Multi threading on Driver side.&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;My_dataframe.&lt;/SPAN&gt;&lt;SPAN&gt;repartition&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;10&lt;/SPAN&gt;&lt;SPAN&gt;).&lt;/SPAN&gt;&lt;SPAN&gt;foreachPartition&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;lambda&lt;/SPAN&gt; &lt;SPAN&gt;partition&lt;/SPAN&gt;&lt;SPAN&gt;: &lt;/SPAN&gt;&lt;SPAN&gt;process_partition&lt;/SPAN&gt;&lt;SPAN&gt;(partition))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;logger.&lt;/SPAN&gt;&lt;SPAN&gt;info&lt;/SPAN&gt;&lt;SPAN&gt;(temp_dict)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Here I'm storing the response in&amp;nbsp;&lt;SPAN&gt;temp_dict&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
    <pubDate>Fri, 02 May 2025 13:52:41 GMT</pubDate>
    <dc:creator>vaibhavaher2025</dc:creator>
    <dc:date>2025-05-02T13:52:41Z</dc:date>
    <item>
      <title>How to get response from API call  made via executor</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-get-response-from-api-call-made-via-executor/m-p/117523#M45516</link>
      <description>&lt;P&gt;Hi Guys,&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;I dont want my APIs to execute on driver so I'm avoiding toPandas or Multi threading on Driver side.&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;My_dataframe.&lt;/SPAN&gt;&lt;SPAN&gt;repartition&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;10&lt;/SPAN&gt;&lt;SPAN&gt;).&lt;/SPAN&gt;&lt;SPAN&gt;foreachPartition&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;lambda&lt;/SPAN&gt; &lt;SPAN&gt;partition&lt;/SPAN&gt;&lt;SPAN&gt;: &lt;/SPAN&gt;&lt;SPAN&gt;process_partition&lt;/SPAN&gt;&lt;SPAN&gt;(partition))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;logger.&lt;/SPAN&gt;&lt;SPAN&gt;info&lt;/SPAN&gt;&lt;SPAN&gt;(temp_dict)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Here I'm storing the response in&amp;nbsp;&lt;SPAN&gt;temp_dict&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 02 May 2025 13:52:41 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-get-response-from-api-call-made-via-executor/m-p/117523#M45516</guid>
      <dc:creator>vaibhavaher2025</dc:creator>
      <dc:date>2025-05-02T13:52:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to get response from API call  made via executor</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-get-response-from-api-call-made-via-executor/m-p/118262#M45621</link>
      <description>&lt;P&gt;Vaibhavaher2025 -&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I recommend trying the following:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1. Write logs from executors to persist storage inside&lt;CODE&gt;process_partition&lt;/CODE&gt;.&lt;/P&gt;
&lt;P&gt;2. Use &lt;CODE&gt;mapPartitions&lt;/CODE&gt; instead of&lt;CODE&gt;foreachPartition&lt;/CODE&gt; to return responses back to the driver as a Dataframe&lt;/P&gt;
&lt;P&gt;3. Check executor logs in Spark UI under Executors -&amp;gt; Logs for any&lt;CODE&gt;logger.info&lt;/CODE&gt; outputs.&lt;/P&gt;
&lt;P class="my-0"&gt;Remember,&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;CODE&gt;foreachPartition&lt;/CODE&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;doesn’t return data, so to see API responses, either write to external storage or use&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;CODE&gt;mapPartitions&lt;/CODE&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;to collect results.&lt;/P&gt;</description>
      <pubDate>Wed, 07 May 2025 16:20:51 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-get-response-from-api-call-made-via-executor/m-p/118262#M45621</guid>
      <dc:creator>sarahbhord</dc:creator>
      <dc:date>2025-05-07T16:20:51Z</dc:date>
    </item>
  </channel>
</rss>

