<?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: How to synchronize two subjobs while using Multi Threaded execution in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/How-to-synchronize-two-subjobs-while-using-Multi-Threaded/m-p/2352288#M118707</link>
    <description>&lt;P&gt;hey,&lt;BR /&gt;You can try below step:&lt;BR /&gt;- create a master job(say Job4) and add your three sub jobs (say Job1,Job2 and Job3)&lt;BR /&gt;- In job4, go to Job&amp;gt;&amp;gt;Extra tab and Check "Multi thread operation".&lt;BR /&gt;In this way you can run multiple jobs in parallel&lt;/P&gt; 
&lt;P&gt;Master job Layout:&lt;/P&gt; 
&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="layout.PNG" style="width: 343px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009LsaA.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/134642iB9BD778680D26BFB/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009LsaA.png" alt="0683p000009LsaA.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;sample Subjob layout (which is to be run in parallel):&lt;/P&gt; 
&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="samplejob.png" style="width: 393px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009LsZf.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/149156i30F089DEA68213FF/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009LsZf.png" alt="0683p000009LsZf.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;Each sub job is same in this case, only sleep time is different (assuming each job has different execution time).&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Job1 has tsleep before it, and its sleep time would be "max(execution time of job3 and job2)". Here I kept it as 30 sec, as sleeptime/execution time for&amp;nbsp;job3 and job2 is 20 sec and 10 sec respectively.&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Create a context variable in master job say run_flag with integer type and initial value as 0.&lt;/P&gt; 
&lt;P&gt;Connect tjava after each subjob using OnComponentOk, here increment run_flag by 1.&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="flag plus.PNG" style="width: 590px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009LrZj.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/151040i15AAA6FE0886B9C5/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009LrZj.png" alt="0683p000009LrZj.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;As we want 2 jobs to run parallel and the run the last job.&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;so, 0+1+1= 2&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;This will be our condition for last job, i.e. if value of run_flag==2 (which means both the jobs ran) then run the last job using conditional trigger (run if).&lt;/P&gt; 
&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="conditional trigger.PNG" style="width: 445px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009LsZk.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/131960iFF15CAAE5B2C55A6/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009LsZk.png" alt="0683p000009LsZk.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;working-&lt;/P&gt; 
&lt;P&gt;all the three threads will start simultaneously. out of which two jobs will run and update the run_flag once each by 1. This will make total count in run_flag as 2. And the last one has the sleep time followed by conditional trigger which needs 2 in run_flag.&amp;nbsp;If run_flag has value 2, last job will run else wait it to become 2.&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;let me know if this works for you.&lt;/P&gt;</description>
    <pubDate>Tue, 13 Feb 2018 19:24:10 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2018-02-13T19:24:10Z</dc:date>
    <item>
      <title>How to synchronize two subjobs while using Multi Threaded execution</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-synchronize-two-subjobs-while-using-Multi-Threaded/m-p/2352285#M118704</link>
      <description>&lt;P&gt;I want to know how do we synchronize two subjobs which are executed in a job with multi threaded execution.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want to execute two child jobs parallelly, and only after these two jobs have finished execution, I want to execute a third job. Basically, execute Job3, only after Job1 and Job2 have finished execution.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I know I can use tParallelize to achieve this, but I'm not using Talend Enterprise edition.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There seems to be less light on this topic so any help would be appreciated.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 08:43:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-synchronize-two-subjobs-while-using-Multi-Threaded/m-p/2352285#M118704</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-11-16T08:43:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to synchronize two subjobs while using Multi Threaded execution</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-synchronize-two-subjobs-while-using-Multi-Threaded/m-p/2352286#M118705</link>
      <description>&lt;P&gt;you create a file dependency that once Job1 competed create file and same way for Job2,but in JOb3 has to execute once the files created as part of Job1 and Job2.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Feb 2018 12:44:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-synchronize-two-subjobs-while-using-Multi-Threaded/m-p/2352286#M118705</guid>
      <dc:creator>manodwhb</dc:creator>
      <dc:date>2018-02-09T12:44:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to synchronize two subjobs while using Multi Threaded execution</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-synchronize-two-subjobs-while-using-Multi-Threaded/m-p/2352287#M118706</link>
      <description>&lt;P&gt;as variant:&lt;/P&gt;&lt;P&gt;in 3rd Job - use loop, which (for example every 1 or 2 sec) check is 1 &amp;amp; 2 finished or not?&lt;BR /&gt;it could be database table with runtime and error code or simple local csv file&lt;BR /&gt;&lt;BR /&gt;if both here - run rest part of job (run-if trigger) and exit loop&lt;/P&gt;&lt;P&gt;if not both - next iteration with defined delay&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Feb 2018 12:51:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-synchronize-two-subjobs-while-using-Multi-Threaded/m-p/2352287#M118706</guid>
      <dc:creator>vapukov</dc:creator>
      <dc:date>2018-02-09T12:51:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to synchronize two subjobs while using Multi Threaded execution</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-synchronize-two-subjobs-while-using-Multi-Threaded/m-p/2352288#M118707</link>
      <description>&lt;P&gt;hey,&lt;BR /&gt;You can try below step:&lt;BR /&gt;- create a master job(say Job4) and add your three sub jobs (say Job1,Job2 and Job3)&lt;BR /&gt;- In job4, go to Job&amp;gt;&amp;gt;Extra tab and Check "Multi thread operation".&lt;BR /&gt;In this way you can run multiple jobs in parallel&lt;/P&gt; 
&lt;P&gt;Master job Layout:&lt;/P&gt; 
&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="layout.PNG" style="width: 343px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009LsaA.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/134642iB9BD778680D26BFB/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009LsaA.png" alt="0683p000009LsaA.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;sample Subjob layout (which is to be run in parallel):&lt;/P&gt; 
&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="samplejob.png" style="width: 393px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009LsZf.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/149156i30F089DEA68213FF/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009LsZf.png" alt="0683p000009LsZf.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;Each sub job is same in this case, only sleep time is different (assuming each job has different execution time).&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Job1 has tsleep before it, and its sleep time would be "max(execution time of job3 and job2)". Here I kept it as 30 sec, as sleeptime/execution time for&amp;nbsp;job3 and job2 is 20 sec and 10 sec respectively.&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Create a context variable in master job say run_flag with integer type and initial value as 0.&lt;/P&gt; 
&lt;P&gt;Connect tjava after each subjob using OnComponentOk, here increment run_flag by 1.&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="flag plus.PNG" style="width: 590px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009LrZj.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/151040i15AAA6FE0886B9C5/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009LrZj.png" alt="0683p000009LrZj.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;As we want 2 jobs to run parallel and the run the last job.&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;so, 0+1+1= 2&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;This will be our condition for last job, i.e. if value of run_flag==2 (which means both the jobs ran) then run the last job using conditional trigger (run if).&lt;/P&gt; 
&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="conditional trigger.PNG" style="width: 445px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009LsZk.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/131960iFF15CAAE5B2C55A6/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009LsZk.png" alt="0683p000009LsZk.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;working-&lt;/P&gt; 
&lt;P&gt;all the three threads will start simultaneously. out of which two jobs will run and update the run_flag once each by 1. This will make total count in run_flag as 2. And the last one has the sleep time followed by conditional trigger which needs 2 in run_flag.&amp;nbsp;If run_flag has value 2, last job will run else wait it to become 2.&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;let me know if this works for you.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Feb 2018 19:24:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-synchronize-two-subjobs-while-using-Multi-Threaded/m-p/2352288#M118707</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-02-13T19:24:10Z</dc:date>
    </item>
  </channel>
</rss>

