Skip to content

WIP - Stop using exec - #8230

Closed
Karthik Nadig (karthiknadig) wants to merge 2 commits into
microsoft:masterfrom
karthiknadig:issue7697
Closed

Karthik Nadig (karthiknadig) wants to merge 2 commits into
microsoft:masterfrom
karthiknadig:issue7697

Conversation

@karthiknadig

Copy link
Copy Markdown
Member

For #7697

  • Pull request represents a single change (i.e. not fixing disparate/unrelated things in a single PR)
  • Title summarizes what is changing
  • Has a news entry file (remember to thank yourself!)
  • Appropriate comments and documentation strings in the code
  • Has sufficient logging.
  • Has telemetry for enhancements.
  • Unit tests & system/integration tests are added/updated

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Now, we shouldn't be changing everything to use python process factory (sooner places can have severe perf implications, specially in Windows, major differences).

return processService.exec(pythonPath, ['--version'], { mergeStdOutErr: true })
const processService = await this.pythonServiceFactory.create({ pythonPath: pythonPath });
return processService.exec(['--version'], { mergeStdOutErr: true })
.then(output => output.stdout.splitLines()[0])

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

For version info, I'd use the process service. This is used in a number of contexts and for optimization we shouldn't use python process, as that information might not be available.
Basically for perf don't change.

const processService = await this.pythonServiceFactory.create({ pythonPath: options.command });
const args = Array.isArray(options.args) ? options.args : [];
return processService.exec(options.command, args.concat(['-c', 'import sys;print(sys.executable)']), {})
return processService.exec(args.concat(['-c', 'import sys;print(sys.executable)']), {})

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This is required to build interpreter information. I.e. python Execution factory friends on this

@karthiknadig

Copy link
Copy Markdown
Member Author

Don Jayamanne (@DonJayamanne) See my comments here #7697 (comment)

Definitely like your feed back there. I need to push one more PR to match the exact updates in the comment i made on the issue.

@DonJayamanne

Copy link
Copy Markdown

Please don't update src/client/interpreter/interpreterVersion.ts for perf reasons.
Getting brain does not require paths, etc. Hence using simple process execution is much faster, previous perf related comments apply.

@lock lock Bot locked as resolved and limited conversation to collaborators Nov 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants