-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_jobs.js
154 lines (122 loc) · 3.51 KB
/
test_jobs.js
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
'use strict';
var mkdirp = require('mkdirp');
var gcloud = require('gcloud');
var gcs = gcloud.storage({
projectId: 'dola-gis-server',
keyFilename: 'root/dola-gis-server-79665239667c.json'
});
var data_bucket = gcs.bucket('co-publicdata');
var db_bucket = gcs.bucket('dola-db-dump');
mkdirp('data', function(err) {
if(err) console.log(err);
});
mkdirp('db', function(err) {
if(err) console.log(err);
});
// Require Custom Modules
var sd = require('./modules/special_districts.js');
var dump_dola_database = require('./modules/dump_database.js');
var bls_data_pipeline = require('./modules/bls_data_pipeline.js');
var grants_data_pipeline = require('./modules/grants_data_pipeline.js');
var dola_data_upload = require('./modules/dola_data_upload.js');
const readline = require('readline');
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
console.log('');
console.log('1: Backup DOLA Database');
console.log('2: BLS Data Pipeline');
console.log('3: DOLA Data Upload lg2cnty');
console.log('4: DOLA Data Upload lgbasic');
console.log('5: DOLA Data Upload lginfo');
console.log('6: DOLA Data Upload limlevy');
console.log('7: Grants Pipeline geopts');
console.log('8: Grants Pipeline grants');
console.log('9: Export Districts: dlmetro');
console.log('10: Export Districts: dlpark');
console.log('11: Export Districts: dlfire');
console.log('12: Export Districts: dlhospital');
console.log('13: Export Districts: dlwatersan');
console.log('14: Export Districts: dllibrary');
console.log('15: Export Districts: dlschool');
console.log('16: Export Districts: dlsoil');
console.log('17: Export Districts: dlcemetary');
console.log('18: Export Districts: dlall');
console.log('');
rl.question('Which Job Would you like to Test? ', (answer) => {
console.log('');
if(answer==="1"){
console.log('Running Task #1');
dump_dola_database(db_bucket);
}
if(answer==="2"){
console.log('Running Task #2');
bls_data_pipeline(data_bucket);
}
if(answer==="3"){
console.log('Running Task #3');
dola_data_upload.lg2cnty();
}
if(answer==="4"){
console.log('Running Task #4');
dola_data_upload.lgbasic();
}
if(answer==="5"){
console.log('Running Task #5');
dola_data_upload.lginfo();
}
if(answer==="6"){
console.log('Running Task #6');
dola_data_upload.limlevy();
}
if(answer==="7"){
console.log('Running Task #7');
grants_data_pipeline.geopts(data_bucket);
}
if(answer==="8"){
console.log('Running Task #8');
grants_data_pipeline.fsgrants(data_bucket);
}
if(answer==="9"){
console.log('Running Task #9');
sd.metro_districts(data_bucket);
}
if(answer==="10"){
console.log('Running Task #10');
sd.park_districts(data_bucket);
}
if(answer==="11"){
console.log('Running Task #11');
sd.fire_districts(data_bucket);
}
if(answer==="12"){
console.log('Running Task #12');
sd.hospital_districts(data_bucket);
}
if(answer==="13"){
console.log('Running Task #13');
sd.watsan_districts(data_bucket);
}
if(answer==="14"){
console.log('Running Task #14');
sd.library_districts(data_bucket);
}
if(answer==="15"){
console.log('Running Task #15');
sd.school_districts(data_bucket);
}
if(answer==="16"){
console.log('Running Task #16');
sd.soil_districts(data_bucket);
}
if(answer==="17"){
console.log('Running Task #17');
sd.cemetary_districts(data_bucket);
}
if(answer==="18"){
console.log('Running Task #18');
sd.all_districts(data_bucket);
}
rl.close();
});