Skip to content
This repository has been archived by the owner on Sep 24, 2020. It is now read-only.

app.wandb.ai => wandb.ai #223

Merged
merged 3 commits into from
Sep 17, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 1 addition & 12 deletions wandb/apis/internal_runqueue.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,18 +229,7 @@ def api_url(self):

@property
def app_url(self):
api_url = self.api_url
# Development
if api_url.endswith('.test') or self.settings().get("dev_prod"):
return 'http://app.wandb.test'
# On-prem VM
if api_url.endswith(':11001'):
return api_url.replace(':11001', ':11000')
# Normal
if api_url.startswith('https://api.'):
return api_url.replace('api.', 'app.')
# Unexpected
return api_url
return wandb.util.app_url(self.api_url)

def settings(self, key=None, section=None):
"""The settings overridden from the wandb/settings file.
Expand Down
1 change: 1 addition & 0 deletions wandb/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import os
import sys
import json
import wandb
from distutils.util import strtobool

CONFIG_PATHS = 'WANDB_CONFIG_PATHS'
Expand Down
13 changes: 1 addition & 12 deletions wandb/internal/internal_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,18 +235,7 @@ def api_url(self):

@property
def app_url(self):
api_url = self.api_url
# Development
if api_url.endswith('.test') or self.settings().get("dev_prod"):
return 'http://app.wandb.test'
# On-prem VM
if api_url.endswith(':11001'):
return api_url.replace(':11001', ':11000')
# Normal
if api_url.startswith('https://api.'):
return api_url.replace('api.', 'app.')
# Unexpected
return api_url
return wandb.util.app_url(self.api_url)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We don't need On-prem VM anymore, and my new logic covers the wandb.test case.


def settings(self, key=None, section=None):
"""The settings overridden from the wandb/settings file.
Expand Down
4 changes: 2 additions & 2 deletions wandb/lib/apikey.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def prompt_api_key( # noqa: C901
api = api or InternalApi()
anon_mode = _fixup_anon_mode(settings.anonymous)
jupyter = settings._jupyter or False
app_url = settings.base_url.replace("//api.", "//app.")
app_url = api.app_url

choices = [choice for choice in LOGIN_CHOICES]
if anon_mode == "never":
Expand All @@ -86,7 +86,7 @@ def prompt_api_key( # noqa: C901

if jupyter and 'google.colab' in sys.modules:
log_string = term.LOG_STRING_NOCOLOR
key = wandb.jupyter.attempt_colab_login(api.app_url)
key = wandb.jupyter.attempt_colab_login(app_url)
if key is not None:
write_key(settings, key)
return key
Expand Down
6 changes: 3 additions & 3 deletions wandb/sdk/wandb_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -875,14 +875,14 @@ def join(self, exit_code=None):
def _get_project_url(self):
s = self._settings
r = self._run_obj
app_url = s.base_url.replace("//api.", "//app.")
app_url = wandb.util.app_url(s.base_url)
url = "{}/{}/{}".format(app_url, url_quote(r.entity), url_quote(r.project))
return url

def _get_run_url(self):
s = self._settings
r = self._run_obj
app_url = s.base_url.replace("//api.", "//app.")
app_url = wandb.util.app_url(s.base_url)
url = "{}/{}/{}/runs/{}".format(
app_url, url_quote(r.entity), url_quote(r.project), url_quote(r.run_id)
)
Expand All @@ -901,7 +901,7 @@ def _get_sweep_url(self):
if not sweep_id:
return

app_url = self._settings.base_url.replace("//api.", "//app.")
app_url = wandb.util.app_url(self._settings.base_url)

return "{base}/{entity}/{project}/sweeps/{sweepid}".format(
base=app_url,
Expand Down
6 changes: 3 additions & 3 deletions wandb/sdk_py27/wandb_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -875,14 +875,14 @@ def join(self, exit_code=None):
def _get_project_url(self):
s = self._settings
r = self._run_obj
app_url = s.base_url.replace("//api.", "//app.")
app_url = wandb.util.app_url(s.base_url)
url = "{}/{}/{}".format(app_url, url_quote(r.entity), url_quote(r.project))
return url

def _get_run_url(self):
s = self._settings
r = self._run_obj
app_url = s.base_url.replace("//api.", "//app.")
app_url = wandb.util.app_url(s.base_url)
url = "{}/{}/{}/runs/{}".format(
app_url, url_quote(r.entity), url_quote(r.project), url_quote(r.run_id)
)
Expand All @@ -901,7 +901,7 @@ def _get_sweep_url(self):
if not sweep_id:
return

app_url = self._settings.base_url.replace("//api.", "//app.")
app_url = wandb.util.app_url(self._settings.base_url)

return "{base}/{entity}/{project}/sweeps/{sweepid}".format(
base=app_url,
Expand Down
7 changes: 7 additions & 0 deletions wandb/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,13 @@ def __getattr__(self, key):
VALUE_BYTES_LIMIT = 100000


def app_url(api_url):
if "wandb." in api_url and api_url.startswith('https://api.'):
return api_url.replace('api.', '')
# wandb/local
return api_url


def get_full_typename(o):
"""We determine types based on type names so we don't have to import
(and therefore depend on) PyTorch, TensorFlow, etc.
Expand Down