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

Capture-solver-log #525

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Conversation

Xemnas0
Copy link

@Xemnas0 Xemnas0 commented Mar 2, 2022

Asyncronously capture output of the solver and save it as a string.
Allows for both "msg" and "logPath" to be enabled.
Change applied only to class COIN_CMD

@CLAassistant
Copy link

CLAassistant commented Mar 2, 2022

CLA assistant check
All committers have signed the CLA.

@Xemnas0
Copy link
Author

Xemnas0 commented Mar 7, 2022

@pchtsp could you check this please?

@pchtsp
Copy link
Collaborator

pchtsp commented Mar 8, 2022

can you update with master again? the tests were failing for another reason. thanks.

@Xemnas0
Copy link
Author

Xemnas0 commented Mar 12, 2022

Ah I see, python 2.7 does not support type annotations

@Xemnas0 Xemnas0 marked this pull request as ready for review March 22, 2022 21:15
Copy link

@jerr0328 jerr0328 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this indeed does seem to solve #502, as the solver output would be in the solver_output variable, though I haven't tried running with this branch. I've put some comments since I noticed some things that might cause problems for us if merged as-is.

return_code = sub_process_runner.run(args)

if return_code != 0:
print(return_code)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should remove this, otherwise this can break standardized logging

if pipe:
pipe.close()

class SubProcessRunner:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not the maintainer of the project so this is just an opinion, but to make testing easier, this class could be split out at a higher level and tested independently, rather than having the class declared inline.

raise PulpSolverError(
"Pulp: Error while trying to execute, use msg=True for more details"
+ self.path
+ "return_code={}\noutput={}".format(

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exception would be hard to read with return code having no space before it, maybe newline here? Or remove this? I'd also suggest rewording the full exception, because the suggestion to use msg=True for more details would print to stdout but if you capture the output via other means, it will mislead developers thinking that msg=True will give more details than already provided.

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.

4 participants