forked from marcelcaraciolo/recsys-mapreduce-mrjob
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrunner.py
25 lines (19 loc) · 756 Bytes
/
runner.py
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
#-*-coding: utf-8 -*-
import sys
from movies_count import MoviesCount
from moviesSimilarities import MoviesSimilarities
writer = open('teste.txt', 'w')
mr_job = MoviesCount(args=[sys.argv[1], '-r', 'emr'])
with mr_job.make_runner() as runner:
runner.run()
for line in runner.stream_output():
key, value = mr_job.parse_output_line(line)
writer.write(key.encode('utf-8') + '\n')
writer.close()
mr_job2 = MoviesSimilarities(args=['teste.txt', '--num-ec2-instances', '5', '-r', 'emr'])
#'--python-archive', 'Documents/Projects/articles/mapreduce/metrics.tar.gz'])
with mr_job2.make_runner() as runner:
runner.run()
for line in runner.stream_output():
key, value = mr_job2.parse_output_line(line)
print key