forked from dsteinich/etl-storet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
93 lines (81 loc) · 3.78 KB
/
build.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<project name="QwStoretEtl" default="weeklyETL">
<property name="work.dir" value="/mnt/wqp_data/${instance}" />
<target name="weeklyETL" depends="buildPackageStage, scpScriptStage, dos2unixStage, pullStoretWData, weeklyImportViaDataPump, grantsOnStoretWTables, runWeeklyPackageStage, finishETL" />
<target name="devqaWeeklyETL" depends="weeklyETL">
<antcall target="setStopRun" />
</target>
<target name="buildPackageStage">
<echo>Rebuilding the ETL database package and body in ${stagingInstance}</echo>
<exec executable="sqlplus" failonerror="true">
<arg value="${wqp_storet_username}/${wqp_storet_password}@${stagingInstance}"/>
<arg value="@${basedir}/create_storet_objects_stage.sql"/>
</exec>
</target>
<target name="scpScriptStage">
<echo>Copy the script to ${storet_host}</echo>
<scp todir="storet_user:${storet_user_password}@${storet_host}:${work.dir}" trust="true">
<fileset dir=".">
<include name="storet_dump.sh" />
<include name="storet_finish.sh" />
</fileset>
</scp>
</target>
<target name="dos2unixStage">
<echo>Fix cr/lf in script at ${storet_host}</echo>
<sshexec host="${storet_host}"
trust="true"
username="storet_user"
password="${storet_user_password}"
command="dos2unix ${work.dir}/storet_dump.sh ${work.dir}/storet_finish.sh"
verbose="${verbose}"
/>
</target>
<target name="pullStoretWData">
<echo>Run the script at ${storet_host}</echo>
<sshexec host="${storet_host}"
trust="true"
failonerror="true"
username="storet_user"
password="${storet_user_password}"
command="bash -e -x ${work.dir}/storet_dump.sh ${work.dir}"
outputproperty="pullResult"
/>
</target>
<target name="setStopRun">
<echo>Check if we had changes and should continue</echo>
<condition property="stopRun">
<contains string="${pullResult}" substring="No new export to process." />
</condition>
</target>
<target name="weeklyImportViaDataPump" depends="setStopRun" unless="stopRun">
<echo>Using impdp to load the storetw schema in ${stagingInstance}</echo>
<exec executable="/usr/oracle/app/oracle/product/11.2.0/client_1/bin/impdp" failonerror="true">
<arg value="userid=storetw/${storetw_password}@${stagingInstance}"/>
<arg value="parfile=weekly_impdp.par"/>
</exec>
</target>
<target name="grantsOnStoretWTables" depends="setStopRun" unless="stopRun">
<echo>Grant select on the imported tables in ${stagingInstance}</echo>
<exec executable="sqlplus" failonerror="true">
<arg value="storetw/${storetw_password}@${stagingInstance}"/>
<arg value="@${basedir}/storetw_grants.sql"/>
</exec>
</target>
<target name="runWeeklyPackageStage" depends="setStopRun" unless="stopRun">
<echo>Running the weekly ETL Package in ${stagingInstance}</echo>
<exec executable="sqlplus" failonerror="true">
<arg value="${wqp_storet_username}/${wqp_storet_password}@${stagingInstance}"/>
<arg value="@${basedir}/runWeeklyPackageStage.sql"/>
</exec>
</target>
<target name="finishETL" depends="setStopRun" unless="stopRun">
<echo>Runs the finishing script at ${storet_host}</echo>
<sshexec host="${storet_host}"
trust="true"
failonerror="true"
username="storet_user"
password="${storet_user_password}"
command="bash -e -x ${work.dir}/storet_finish.sh ${work.dir}"
/>
</target>
</project>