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

linted parallel.py #351

Closed
wants to merge 2 commits into from
Closed

linted parallel.py #351

wants to merge 2 commits into from

Conversation

ibianka
Copy link
Contributor

@ibianka ibianka commented Jul 13, 2019

No description provided.

@shaunagm
Copy link
Contributor

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])]
Copy link
Contributor

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.

Copy link
Contributor

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.

Copy link
Contributor

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.

@llorracc
Copy link
Collaborator

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.

@MridulS
Copy link
Member

MridulS commented Jan 1, 2020

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])
    )

@MridulS MridulS mentioned this pull request Jan 1, 2020
@MridulS
Copy link
Member

MridulS commented Jan 1, 2020

Closing in favour of #465

@MridulS MridulS closed this Jan 1, 2020
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

Successfully merging this pull request may close these issues.

5 participants