Nuria has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/182350

Change subject: [WIP] How to send job results via email using oozie
......................................................................

[WIP] How to send job results via email using oozie

Oozie's email schema does not allow attachments so
we need to "cat" the result file we are interesting on seeing,
store its contents and send it on the body of the e-mail.

Proof of concept (working). This code is to be generalized.

Change-Id: I2b928fbebfb7707cc4d408ee2b6b4da017a6a090
---
M oozie/mobile-apps/generate_daily_uniques/workflow.xml
1 file changed, 36 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/analytics/refinery 
refs/changes/50/182350/1

diff --git a/oozie/mobile-apps/generate_daily_uniques/workflow.xml 
b/oozie/mobile-apps/generate_daily_uniques/workflow.xml
index c10c79b..e7e184d 100644
--- a/oozie/mobile-apps/generate_daily_uniques/workflow.xml
+++ b/oozie/mobile-apps/generate_daily_uniques/workflow.xml
@@ -96,9 +96,44 @@
                 <move source="${source_directory}/${wf:id()}/*.gz" 
target="${archive_directory}/uniques/${year}/${month}/${day}/${hour}/${archive_file}"/>
                 <delete path="${source_directory}/${wf:id()}/"/>
             </fs>
-        <ok to="end"/>
+        <ok to="shell-action"/>
         <error to="archive-fail"/>
     </action>
+
+
+    <action name="shell-action">
+        <shell xmlns="uri:oozie:shell-action:0.1">
+            <job-tracker>${job_tracker}</job-tracker>
+            <name-node>${name_node}</name-node>
+            <configuration>
+                <property>
+                  <name>mapreduce.job.queuename</name>
+                  <value>${queue_name}</value>
+                </property>
+            </configuration>
+            <exec>cat_file.sh</exec>
+            
<argument>${archive_directory}/uniques/${year}/${month}/${day}/${hour}/${archive_file}</argument>
        
+            <file>cat_file.sh#cat_file.sh</file>
+            <capture-output/>
+        </shell>
+    <ok to="send-report"/>
+    <error to="archive-fail"/>
+    </action>
+
+
+    <action name="send-report">
+        <email xmlns="uri:oozie:email-action:0.1">
+              <to>[email protected]</to>
+              <subject>Daily mobile apps unique users </subject>
+              <body> ${wf:actionData('shell-action')}</body>
+          </email>
+        <ok to="end"/>
+        <error to="end"/>
+    </action>
+
+
+
+
     <kill name="archive-fail"> 
                    <message>Archive of mobile apps daily unques failed, error 
                         
message[${wf:errorMessage(wf:lastErrorNode())}]</message> 

-- 
To view, visit https://gerrit.wikimedia.org/r/182350
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2b928fbebfb7707cc4d408ee2b6b4da017a6a090
Gerrit-PatchSet: 1
Gerrit-Project: analytics/refinery
Gerrit-Branch: master
Gerrit-Owner: Nuria <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to