-
-
Notifications
You must be signed in to change notification settings - Fork 199
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
linted parallel.py #351
linted parallel.py #351
Conversation
I'm assigning this to Matt because Ingrid and I did a bit of code re-writing in order to pass the linter (see comment on the code itself). Matt, can you check that the code still does what you want it to? No rush. :) |
|
||
# Send each command in command_list to each of the types in agent_list to be run | ||
agent_list_out = Parallel(backend='multiprocessing',n_jobs=num_jobs)(delayed(runCommands)(*args) for args in zip(agent_list, len(agent_list)*[command_list])) | ||
delayed_commands = [delayed(runCommands)(*args) for args in zip(agent_list, len(agent_list)*[command_list])] |
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.
This is where Ingrid and I rewrote the code a little bit - it was the only way to keep from breaking the line length limits. I'm not 100% sure I didn't change the meaning of the code though. Your original syntax here is very novel to me.
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.
If no new line was added beyond that, then this won't do anything. It will just create a list of stuff to do, and then never do it.
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.
@mnwhite just to make sure - are you seeing line 96, with the code agent_list_out = Parallel(backend='multiprocessing', n_jobs=num_jobs)(delayed_commands)
? My understanding is that this runs the delayed commands, but you understand the code better than I.
This needs to be tested; @MridulS will test it in the context of the parallel problems with cstwMPC and either accept it or delete it. |
This will work but instead of creating a new var and storing it in memory, we can use the following version for the linted version agent_list_out = Parallel(n_jobs=num_jobs)(
delayed(runCommands)(*args)
for args in zip(agent_list, len(agent_list) * [command_list])
) |
Closing in favour of #465 |
No description provided.