Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to launch more than one reducer to execute a job? #2181

Open
ParadoxZW opened this issue Jun 22, 2020 · 0 comments
Open

How to launch more than one reducer to execute a job? #2181

ParadoxZW opened this issue Jun 22, 2020 · 0 comments

Comments

@ParadoxZW
Copy link

ParadoxZW commented Jun 22, 2020

I wrote following code to do a words sort task

#!/usr/bin/python
# -*- coding: utf-8 -*-
from mrjob.job import MRJob
import re

class MRwordCount(MRJob):
    def mapper(self, in_key, in_value):
        bins = {chr(i):[] for i in range(97,123)}
        for word in in_value.split(' '):
            key_j = word[0]
            bins[key_j].append(word)
        for key_j, value_j in bins.items():
            yield (key_j, sorted(value_j))


    def reducer(self, key, value_list):
        words = []
        for value in value_list:
            words += value
        words = sorted(words)
        yield (key, words)

if __name__ == '__main__':
    MRwordCount.run()

when I run this demo in Hadoop, only 1 reducer was launched. I'd like to know how to launch more than one reducer in mrjob?
I'm new in hadoop, so above question may be trivial. But I really appreciate if you can help me. Thx very much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant