<?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 Is it good to process files in multithreading? in Get Started Discussions</title>
    <link>https://community.databricks.com/t5/get-started-discussions/is-it-good-to-process-files-in-multithreading/m-p/43911#M5783</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I need to process nearly 30 files from different locations and insert records to RDS.&lt;/P&gt;&lt;P&gt;I am using multi-threading to process these files parallelly like below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;def&amp;nbsp;process_files(file_path):&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;lt;process files here&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; 1. Find bad records based on field validation&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; 2. Find good records based on field validation&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; 3. Insert only good records to the RDS&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; 4. Write good records to COMPLETED folder and bad records to ERROR folder (These files should be written to the same location where original file is present)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;pool = ThreadPool(len(files_list))&lt;BR /&gt;pool.map(process_files, ((file_path) for file_path in files_list))&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Questions:&lt;/DIV&gt;&lt;DIV&gt;1. Is it good approach to process files like this?&lt;/DIV&gt;&lt;DIV&gt;2. If files size is more(each files 1GB) we get OOM(Out Of Memory issue) - cluster config: driver: i3.4xlarge(16 GB) and 4 worker nodes with same size. How we need to process files in this case?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;</description>
    <pubDate>Thu, 07 Sep 2023 06:28:53 GMT</pubDate>
    <dc:creator>Policepatil</dc:creator>
    <dc:date>2023-09-07T06:28:53Z</dc:date>
    <item>
      <title>Is it good to process files in multithreading?</title>
      <link>https://community.databricks.com/t5/get-started-discussions/is-it-good-to-process-files-in-multithreading/m-p/43911#M5783</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I need to process nearly 30 files from different locations and insert records to RDS.&lt;/P&gt;&lt;P&gt;I am using multi-threading to process these files parallelly like below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;def&amp;nbsp;process_files(file_path):&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;lt;process files here&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; 1. Find bad records based on field validation&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; 2. Find good records based on field validation&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; 3. Insert only good records to the RDS&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; 4. Write good records to COMPLETED folder and bad records to ERROR folder (These files should be written to the same location where original file is present)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;pool = ThreadPool(len(files_list))&lt;BR /&gt;pool.map(process_files, ((file_path) for file_path in files_list))&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Questions:&lt;/DIV&gt;&lt;DIV&gt;1. Is it good approach to process files like this?&lt;/DIV&gt;&lt;DIV&gt;2. If files size is more(each files 1GB) we get OOM(Out Of Memory issue) - cluster config: driver: i3.4xlarge(16 GB) and 4 worker nodes with same size. How we need to process files in this case?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Thu, 07 Sep 2023 06:28:53 GMT</pubDate>
      <guid>https://community.databricks.com/t5/get-started-discussions/is-it-good-to-process-files-in-multithreading/m-p/43911#M5783</guid>
      <dc:creator>Policepatil</dc:creator>
      <dc:date>2023-09-07T06:28:53Z</dc:date>
    </item>
  </channel>
</rss>

