<?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 Re: Asynchronous API calls from Databricks in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/asynchronous-api-calls-from-databricks/m-p/4695#M1352</link>
    <description>&lt;P&gt;Hi @Paul Poco​&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope all is well! Just wanted to check in if you were able to resolve your issue and would you be happy to share the solution or mark an answer as best? Else please let us know if you need more help.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We'd love to hear from you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 19 May 2023 08:38:17 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2023-05-19T08:38:17Z</dc:date>
    <item>
      <title>Asynchronous API calls from Databricks</title>
      <link>https://community.databricks.com/t5/data-engineering/asynchronous-api-calls-from-databricks/m-p/4691#M1348</link>
      <description>&lt;P&gt;Hi, &lt;/P&gt;&lt;P&gt;​&lt;/P&gt;&lt;P&gt;I have to send thousands of API calls from a Databricks notebook to an API to retrieve some data. &lt;/P&gt;&lt;P&gt;Right now, I am using a sequential approach using the python request package. As the performance is not acceptable anymore, I need to send my API calls in parallel. I started changing my ingestion notebook, using the asyncio and aiohttp packages. &lt;/P&gt;&lt;P&gt;I am not an expert in these 2 packages but I keep having one error that I cannot expain:&lt;/P&gt;&lt;P&gt;&lt;I&gt;asyncio.run() cannot be called from a running event loop&lt;/I&gt;&lt;/P&gt;&lt;P&gt;which means that there is already an event loop but there shouldn't be an existing event loop!&lt;/P&gt;&lt;P&gt;When I run &lt;/P&gt;&lt;P&gt;&lt;I&gt;loop = asyncio.get_running_loop()&lt;/I&gt;&lt;/P&gt;&lt;P&gt;I get a running loop, even outside the main program. I know that Jupyter notebooks always have a running event loop, is it the same for Databricks?&lt;/P&gt;&lt;P&gt;Does anyone have some experience with these 2 packages in Databricks?&lt;/P&gt;&lt;P&gt;Is there a better way to handle asynchronous HTTP call from Databricks?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 08 May 2023 16:43:13 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/asynchronous-api-calls-from-databricks/m-p/4691#M1348</guid>
      <dc:creator>Paul_Poco</dc:creator>
      <dc:date>2023-05-08T16:43:13Z</dc:date>
    </item>
    <item>
      <title>Re: Asynchronous API calls from Databricks</title>
      <link>https://community.databricks.com/t5/data-engineering/asynchronous-api-calls-from-databricks/m-p/4692#M1349</link>
      <description>&lt;P&gt;You could try adding this:&lt;/P&gt;&lt;P&gt;import nest_asyncio&lt;/P&gt;&lt;P&gt;nest_asyncio.apply()&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And in your code calling it like this:&lt;/P&gt;&lt;P&gt;asyncio.run(your_method())&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Don't forget to install the nest_asyncio package.&lt;/P&gt;</description>
      <pubDate>Fri, 12 May 2023 16:08:15 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/asynchronous-api-calls-from-databricks/m-p/4692#M1349</guid>
      <dc:creator>cascode</dc:creator>
      <dc:date>2023-05-12T16:08:15Z</dc:date>
    </item>
    <item>
      <title>Re: Asynchronous API calls from Databricks</title>
      <link>https://community.databricks.com/t5/data-engineering/asynchronous-api-calls-from-databricks/m-p/4693#M1350</link>
      <description>&lt;P&gt;This worked for me - thanks, wasn't aware of this package.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FYI, nest_asyncio is included in the Databricks runtime by default since 10.4&lt;/P&gt;</description>
      <pubDate>Wed, 17 May 2023 18:11:30 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/asynchronous-api-calls-from-databricks/m-p/4693#M1350</guid>
      <dc:creator>SCWD</dc:creator>
      <dc:date>2023-05-17T18:11:30Z</dc:date>
    </item>
    <item>
      <title>Re: Asynchronous API calls from Databricks</title>
      <link>https://community.databricks.com/t5/data-engineering/asynchronous-api-calls-from-databricks/m-p/4694#M1351</link>
      <description>&lt;P&gt;I also ran in to this error and cascode's response resolved it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Of note, this error didn't pop for me when running the code on an all-purpose cluster, only on a new job cluster.&lt;/P&gt;</description>
      <pubDate>Wed, 17 May 2023 18:13:28 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/asynchronous-api-calls-from-databricks/m-p/4694#M1351</guid>
      <dc:creator>SCWD</dc:creator>
      <dc:date>2023-05-17T18:13:28Z</dc:date>
    </item>
    <item>
      <title>Re: Asynchronous API calls from Databricks</title>
      <link>https://community.databricks.com/t5/data-engineering/asynchronous-api-calls-from-databricks/m-p/4695#M1352</link>
      <description>&lt;P&gt;Hi @Paul Poco​&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope all is well! Just wanted to check in if you were able to resolve your issue and would you be happy to share the solution or mark an answer as best? Else please let us know if you need more help.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We'd love to hear from you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 19 May 2023 08:38:17 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/asynchronous-api-calls-from-databricks/m-p/4695#M1352</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-05-19T08:38:17Z</dc:date>
    </item>
    <item>
      <title>Re: Asynchronous API calls from Databricks</title>
      <link>https://community.databricks.com/t5/data-engineering/asynchronous-api-calls-from-databricks/m-p/91727#M38245</link>
      <description>&lt;P&gt;Hey&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/61400"&gt;@Paul_Poco&lt;/a&gt;&amp;nbsp;what about using the processpoolexecutor or threadypoolexecutor from the concurrent.futures module ? have u tried them or not . ?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Sep 2024 12:47:42 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/asynchronous-api-calls-from-databricks/m-p/91727#M38245</guid>
      <dc:creator>adarsh8304</dc:creator>
      <dc:date>2024-09-25T12:47:42Z</dc:date>
    </item>
  </channel>
</rss>

