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
fix(sdk): add support for service running in a pex based environment #4440
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #4440 +/- ##
=======================================
Coverage 83.03% 83.03%
=======================================
Files 258 258
Lines 32870 32875 +5
=======================================
+ Hits 27292 27299 +7
+ Misses 5578 5576 -2
Flags with carried forward coverage won't be shown. Click here to find out more.
|
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.
Nice
wandb/sdk/wandb_settings.py
Outdated
# one special case here is running inside a PEX environment, | ||
# see https://pex.readthedocs.io/en/latest/index.html for more info about PEX | ||
settings["_executable"] = ( | ||
self._executable or os.environ.get("PEX") or sys.executable |
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 was just looking at the official docs and sys.executable can return empty string or None. I imagine it makes more sense to fall back to "python"
as the executable if we can't get an absolute path...
wandb/sdk/service/service.py
Outdated
@@ -82,7 +85,8 @@ def _launch_server(self) -> None: | |||
fname = os.path.join(tmpdir, f"port-{pid}.txt") | |||
|
|||
pid_str = str(os.getpid()) | |||
exec_cmd_list = [sys.executable, "-m"] | |||
executable = self._python_executable or sys.executable |
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 think or "python"
would be reasonable here. There are other places in the codebase where we assume sys.executable
will be a python interpreter that we should fix as well so maybe a util / helper is appropriate.
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.
ah good catch, will do!
…4440) * fix pex * python_executable -> settings * add a test * fix(sdk): pex pex pex * fix config * oomny v goroo ne poidyot * oomny v goroo ne poidyot * oora my lomim gnutsya shvedy * oora my lomim gnutsya shvedy * oora my lomim gnutsya shvedy * oora my lomim gnutsya shvedy * oora my lomim gnutsya shvedy * oora my lomim gnutsya shvedy * replace borky yea test with a (borky) circle job * clean up * lint Co-authored-by: Dmitry Duev <dima@wandb.com> Co-authored-by: Dmitry Duev <dmitryduev@users.noreply.github.com>
Fixes WB-11018
Description
What does the PR do?
Based on this discussion in the pex repo: pex-tool/pex#626 (comment) it seems that the correct way to use an executable when running with pex is the use the
sys.argv
and based on this PR the way to find out if you are in a pex environment is based on this environment variable: pex-tool/pex#1495Testing
How was this PR tested?
Checklist