-
Notifications
You must be signed in to change notification settings - Fork 0
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
Add reduce functionality and example #284
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Top qual boii
dipla/server/task_queue.py
Outdated
self.task_item.instructions, | ||
self.task_item.machine_type, | ||
arguments, | ||
signals=[x for x in self.task_item.signals]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer list(self.task_item.signals)
but it's a nitpick 🇱🇾
dipla/server/task_queue.py
Outdated
"Attempted to read input from an empty source") | ||
arguments = [] | ||
|
||
for i in range(self.reduce_group_size): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Convention is for _ in qwertyuiop
if you're not using the actual value 🇱🇾
examples/reduce.py
Outdated
|
||
input_data = [word.lower() for word in communist_manifesto.split() if len(word) > 0] | ||
|
||
@Dipla.reduce_distributable(n = 6) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know we don't PEP8 the examples... but qwerty(n=6)
Connects to #266.
This creates a
@Dipla.reduce_distributable
decorator. You can see its use inexamples/reduce.py
, which finds the word with the most vowels in the opening of the communist manifesto by a reduce function.The decorator takes a parameter,
n
. This is the number of inputs to take in one go. A normal reduce takes 2 inputs, however it was suggested that this number could be raised to get better performance by reducing the number of requests sent across the wire. This is left up to the user.It is a little over the 150 line limit, but that is probably caused by the inclusion of the example.
Let me know what you think xoxo