<?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>question Re: Can I have an oozie coordinator that runs once per hour trigger a particular action only once per day? in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Can-I-have-an-oozie-coordinator-that-runs-once-per-hour/m-p/97856#M11330</link>
    <description>&lt;P&gt;Moved the question to "Governance and Lifecycle" track. &lt;/P&gt;</description>
    <pubDate>Fri, 04 Dec 2015 04:57:10 GMT</pubDate>
    <dc:creator>bsaini</dc:creator>
    <dc:date>2015-12-04T04:57:10Z</dc:date>
    <item>
      <title>Can I have an oozie coordinator that runs once per hour trigger a particular action only once per day?</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Can-I-have-an-oozie-coordinator-that-runs-once-per-hour/m-p/97854#M11328</link>
      <description>&lt;P&gt;For example, I have a coordinator with 2 actions, A and B.  The coordinator runs hourly. Once per day I want to run action A followed by action B.  The other 23 times of the day I just want to run action B.&lt;/P&gt;&lt;P&gt;Is there an elegant way to orchestrate that with a single oozie coordinator?&lt;/P&gt;</description>
      <pubDate>Fri, 04 Dec 2015 03:55:40 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Can-I-have-an-oozie-coordinator-that-runs-once-per-hour/m-p/97854#M11328</guid>
      <dc:creator>Aaron_Dossett</dc:creator>
      <dc:date>2015-12-04T03:55:40Z</dc:date>
    </item>
    <item>
      <title>Re: Can I have an oozie coordinator that runs once per hour trigger a particular action only once per day?</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Can-I-have-an-oozie-coordinator-that-runs-once-per-hour/m-p/97855#M11329</link>
      <description>&lt;P&gt;There is no clean way to do this within the same oozie job. &lt;/P&gt;&lt;P&gt;If the time, when Step A and B have to be executed together, if fixed then IMHO it would be a better approach to set up two different oozie jobs - 1 with both steps that runs once a day and the other one with Step B only that runs 23 times. &lt;/P&gt;</description>
      <pubDate>Fri, 04 Dec 2015 04:10:26 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Can-I-have-an-oozie-coordinator-that-runs-once-per-hour/m-p/97855#M11329</guid>
      <dc:creator>bsaini</dc:creator>
      <dc:date>2015-12-04T04:10:26Z</dc:date>
    </item>
    <item>
      <title>Re: Can I have an oozie coordinator that runs once per hour trigger a particular action only once per day?</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Can-I-have-an-oozie-coordinator-that-runs-once-per-hour/m-p/97856#M11330</link>
      <description>&lt;P&gt;Moved the question to "Governance and Lifecycle" track. &lt;/P&gt;</description>
      <pubDate>Fri, 04 Dec 2015 04:57:10 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Can-I-have-an-oozie-coordinator-that-runs-once-per-hour/m-p/97856#M11330</guid>
      <dc:creator>bsaini</dc:creator>
      <dc:date>2015-12-04T04:57:10Z</dc:date>
    </item>
    <item>
      <title>Re: Can I have an oozie coordinator that runs once per hour trigger a particular action only once per day?</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Can-I-have-an-oozie-coordinator-that-runs-once-per-hour/m-p/97857#M11331</link>
      <description>&lt;P&gt;Thanks, &lt;A rel="user" href="https://community.cloudera.com/users/191/bsaini.html" nodeid="191"&gt;@bsaini&lt;/A&gt;.  I'd like to job to execute once an hour every hour of the day.  If I set up two different jobs, how could I specify that one of the jobs (running Step B only) skip one its runs?&lt;/P&gt;</description>
      <pubDate>Fri, 04 Dec 2015 06:48:24 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Can-I-have-an-oozie-coordinator-that-runs-once-per-hour/m-p/97857#M11331</guid>
      <dc:creator>Aaron_Dossett</dc:creator>
      <dc:date>2015-12-04T06:48:24Z</dc:date>
    </item>
    <item>
      <title>Re: Can I have an oozie coordinator that runs once per hour trigger a particular action only once per day?</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Can-I-have-an-oozie-coordinator-that-runs-once-per-hour/m-p/97858#M11332</link>
      <description>&lt;P&gt;Here is how I would do it but I am missing any requirement, please feel free to add more details (without revealing any secret sauce of your logic &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt; -&lt;/P&gt;&lt;P&gt;Assumptions first - &lt;/P&gt;&lt;UL&gt;
&lt;LI&gt;Job 1 - Executes Step A and Step B at 00:01 AM every morning (two step job) 
&lt;/LI&gt;&lt;LI&gt;Job 2 - Executes Step B every hour between 01:01 - 23:01 through out the day. (single step job)&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;Note&lt;/STRONG&gt;: The timings can obviously be adjusted but assumption here is that the time of execution of two step is fixed and is mutually exclusive with the other 23 executions of the single step job. These two steps could be any action supported by Oozie like Hive, Pig, Email, SSH etc. So the workflow definitions will have duplicate Step B action in both jobs. &lt;/P&gt;&lt;P&gt;Coordinator Definitions - The exact time of execution and frequency can be controlled by specifying the values of validity and frequency. &lt;/P&gt;&lt;P&gt;For Job1, &lt;/P&gt;&lt;UL&gt;
&lt;LI&gt;Validity = 00:00 hours of the day when you want the job to start executing. 
&lt;/LI&gt;&lt;LI&gt;Frequency = ${coord:days(int n)}&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;See section&lt;STRONG&gt; 4.4.1. The coord:days(int n) and coord:endOfDays(int n) EL functions&lt;/STRONG&gt;at - &lt;A href="http://oozie.apache.org/docs/4.2.0/CoordinatorFunctionalSpec.html" target="_blank"&gt;http://oozie.apache.org/docs/4.2.0/CoordinatorFunctionalSpec.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;For Job 2,&lt;/P&gt;&lt;UL&gt;
&lt;LI&gt;Validity = 01:00 hours of the same day as Job 1
&lt;/LI&gt;&lt;LI&gt;Frequency = frequency="* 1-23 * * *"&lt;/LI&gt;&lt;LI&gt;Note: that instead of using fixed frequency we are using cron type syntax, which is super cool&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;See section &lt;STRONG&gt;4.4.3. Cron syntax in coordinator frequency&lt;/STRONG&gt; at - &lt;A href="http://oozie.apache.org/docs/4.2.0/CoordinatorFunctionalSpec.html" target="_blank"&gt;http://oozie.apache.org/docs/4.2.0/CoordinatorFunctionalSpec.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Hope this helps. &lt;/P&gt;</description>
      <pubDate>Fri, 04 Dec 2015 09:09:08 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Can-I-have-an-oozie-coordinator-that-runs-once-per-hour/m-p/97858#M11332</guid>
      <dc:creator>bsaini</dc:creator>
      <dc:date>2015-12-04T09:09:08Z</dc:date>
    </item>
    <item>
      <title>Re: Can I have an oozie coordinator that runs once per hour trigger a particular action only once per day?</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Can-I-have-an-oozie-coordinator-that-runs-once-per-hour/m-p/97859#M11333</link>
      <description>&lt;P&gt;My response to your comment was longer than whats allowed for comments so adding as new answer. &lt;/P&gt;</description>
      <pubDate>Fri, 04 Dec 2015 09:09:28 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Can-I-have-an-oozie-coordinator-that-runs-once-per-hour/m-p/97859#M11333</guid>
      <dc:creator>bsaini</dc:creator>
      <dc:date>2015-12-04T09:09:28Z</dc:date>
    </item>
    <item>
      <title>Re: Can I have an oozie coordinator that runs once per hour trigger a particular action only once per day?</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Can-I-have-an-oozie-coordinator-that-runs-once-per-hour/m-p/97860#M11334</link>
      <description>&lt;P&gt;Terrific advice! I'll let you know how it goes in a couple of weeks.&lt;/P&gt;</description>
      <pubDate>Fri, 04 Dec 2015 22:16:19 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Can-I-have-an-oozie-coordinator-that-runs-once-per-hour/m-p/97860#M11334</guid>
      <dc:creator>Aaron_Dossett</dc:creator>
      <dc:date>2015-12-04T22:16:19Z</dc:date>
    </item>
    <item>
      <title>Re: Can I have an oozie coordinator that runs once per hour trigger a particular action only once per day?</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Can-I-have-an-oozie-coordinator-that-runs-once-per-hour/m-p/97861#M11335</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/191/bsaini.html" nodeid="191"&gt;@bsaini&lt;/A&gt; This is very nice! Wikify &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Dec 2015 22:21:04 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Can-I-have-an-oozie-coordinator-that-runs-once-per-hour/m-p/97861#M11335</guid>
      <dc:creator>nsabharwal</dc:creator>
      <dc:date>2015-12-04T22:21:04Z</dc:date>
    </item>
    <item>
      <title>Re: Can I have an oozie coordinator that runs once per hour trigger a particular action only once per day?</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Can-I-have-an-oozie-coordinator-that-runs-once-per-hour/m-p/97862#M11336</link>
      <description>&lt;P&gt;I implemented something similar to that, I wanted to run a data load every hour but load a dimension table from a database every 12 hours. I couldn't use two coordinators since the load would fail if the dimension table is loaded at the same time. So doing it in the same workflow was better.&lt;/P&gt;&lt;P&gt;Instead of having a coordinator that starts two workflows I have a parameter in the coordinator that is given to the workflow which contains the hour like this: &lt;/P&gt;&lt;P&gt;2015121503 ( 2015-12-15-03 ) &lt;/P&gt;&lt;PRE&gt;&amp;lt;property&amp;gt;
     &amp;lt;name&amp;gt;hour&amp;lt;/name&amp;gt;
     &amp;lt;value&amp;gt;${coord:formatTime(coord:nominalTime(), 'yyyyMMddHH')}&amp;lt;/value&amp;gt;
&amp;lt;/property&amp;gt;
&lt;/PRE&gt;&lt;P&gt;I then use a decision node in the workflow to only do the sqoop action every 12 hours ( in this case ) and do the load alone in all other cases . The sqoop action obviously continues with the load action.&lt;/P&gt;&lt;PRE&gt;&amp;lt;start to="decision"/&amp;gt;
    
    &amp;lt;decision name="decision"&amp;gt;
        &amp;lt;switch&amp;gt;
            &amp;lt;case to="sqoop"&amp;gt;
              ${( hour % 100) % 12 == 0}
            &amp;lt;/case&amp;gt;
            &amp;lt;default to="load"/&amp;gt;
        &amp;lt;/switch&amp;gt;
    &amp;lt;/decision&amp;gt;
    
&amp;lt;/decision&amp;gt;

&lt;/PRE&gt;</description>
      <pubDate>Thu, 17 Dec 2015 17:27:18 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Can-I-have-an-oozie-coordinator-that-runs-once-per-hour/m-p/97862#M11336</guid>
      <dc:creator>bleonhardi</dc:creator>
      <dc:date>2015-12-17T17:27:18Z</dc:date>
    </item>
  </channel>
</rss>

