Skip to content

Commit

Permalink
Handle missing ContainerConfig key
Browse files Browse the repository at this point in the history
  • Loading branch information
trungleduc committed Apr 3, 2024
1 parent 74a4e44 commit e716fd5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
1 change: 0 additions & 1 deletion jupyterhub_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

tljh_custom_jupyterhub_config(c)

c.JupyterHub.default_url = '/services/tljh_repo2docker/'

c.JupyterHub.authenticator_class = DummyAuthenticator

Expand Down
12 changes: 6 additions & 6 deletions tljh_repo2docker/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,12 @@ async def set_limits(self):
imagename = self.user_options.get("image")
async with Docker() as docker:
image = await docker.images.inspect(imagename)
mem_limit = image["ContainerConfig"]["Labels"].get(
"tljh_repo2docker.mem_limit", None
)
cpu_limit = image["ContainerConfig"]["Labels"].get(
"tljh_repo2docker.cpu_limit", None
)
config = image.get("ContainerConfig", None)
if not config:
config = image.get("Config", {})
label = config.get("Labels", {})
mem_limit = label.get("tljh_repo2docker.mem_limit", None)
cpu_limit = label.get("tljh_repo2docker.cpu_limit", None)

# override the spawner limits if defined in the image
if mem_limit:
Expand Down

0 comments on commit e716fd5

Please sign in to comment.