Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion .github/workflows/diff.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
- name: Install Argo Rollouts
run: |
kubectl create namespace argo-rollouts
kubectl apply -n argo-rollouts -f https://github.com/argoproj/argo-rollouts/releases/latest/download/install.yaml
kubectl apply -n argo-rollouts -f https://github.com/argoproj/argo-rollouts/releases/download/v1.9.2/install.yaml

- name: "Install latest released dev chart"
run: |
Expand Down
11 changes: 11 additions & 0 deletions binderhub/launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,17 @@ async def get_user_data(self, username):
body = json.loads(resp.body.decode("utf-8"))
return body

async def get_named_server_count(self, username):
"""Return the number of named servers for a given JupyterHub user."""
try:
user_data = await self.get_user_data(username)
except RuntimeError:
return 0
servers = user_data.get("servers", {})
if not isinstance(servers, dict):
return 0
return sum(1 for server_name in servers if server_name != "")

def unique_name_from_repo(self, repo_url):
"""Generate a unique name for a git repo url

Expand Down
21 changes: 18 additions & 3 deletions binderhub/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,32 @@ def initialize(self):
return super().initialize()

@authenticated
def get(self):
async def get(self):
repoproviders_display_config = [
repo_provider_class.display_config
for repo_provider_class in self.settings["repo_providers"].values()
]
running_environment_count = None
launcher = self.settings.get("launcher")
if launcher is not None:
try:
user = self.get_current_user()
username = user.get("name") if isinstance(user, dict) else user
if username:
running_environment_count = await launcher.get_named_server_count(
username
)
except Exception:
self.log.debug(
"Unable to determine current environment count", exc_info=True
)
self.page_config |= {
"baseUrl": self.settings["base_url"],
"badgeBaseUrl": self.get_badge_base_url(),
"logoUrl": self.static_url("logo.svg"),
"logoWidth": "320px",
"repoProviders": repoproviders_display_config,
"runningEnvironmentCount": running_environment_count,
"aboutMessage": self.settings["about_message"],
"bannerHtml": self.settings["banner_message"],
"binderVersion": binder_version,
Expand All @@ -58,7 +73,7 @@ def initialize(self, repo_provider):
return super().initialize()

@authenticated
def get(self, provider_id, _escaped_spec):
async def get(self, provider_id, _escaped_spec):
prefix = "/v2/" + provider_id
spec = self.get_spec_from_request(prefix)

Expand All @@ -75,7 +90,7 @@ def get(self, provider_id, _escaped_spec):
self.opengraph_title = (
f"{self.repo_provider.display_config['displayName']}: {spec}"
)
return super().get()
return await super().get()


class LegacyRedirectHandler(BaseHandler):
Expand Down
12 changes: 12 additions & 0 deletions binderhub/static/js/components/LinkGenerator.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { useEffect, useState } from "react";
import copy from "copy-to-clipboard";
import { PAGE_CONFIG } from "../App.jsx";

/**
* @typedef {object} ProviderSelectorProps
Expand Down Expand Up @@ -346,6 +347,17 @@ export function LinkGenerator({
→<a href="https://jdcat.jsps.go.jp/analysis-In-case-of-error.html" target="_blank" rel="noopener noreferrer">問い合わせ先/エラーが発生したときは</a><br/>
→<a href="https://jdcat.jsps.go.jp/analysis-In-case-of-error.html" target="_blank" rel="noopener noreferrer">Contact Information/Troubleshooting</a>
</div>
{PAGE_CONFIG.runningEnvironmentCount !== undefined &&
PAGE_CONFIG.runningEnvironmentCount !== null && (
<div style={{ textAlign: "right" }}>
<a href="https://jupyter.cs.rcos.nii.ac.jp/" target="_blank" rel="noreferrer" className="fw-semibold">
あなたは {PAGE_CONFIG.runningEnvironmentCount}個の解析環境を持っています
</a>
{PAGE_CONFIG.runningEnvironmentCount >= 10 && (
<><br /><span style={{ color: "red" }}>解析環境の数が上限に達しています</span></>
)}
</div>
)}
</form>
);
}
4 changes: 2 additions & 2 deletions helm-chart/binderhub/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Chart.yaml v2 reference: https://helm.sh/docs/topics/charts/#the-chartyaml-file
apiVersion: v2
name: binderhub
version: 0.2.5-20260304.3
version: 0.2.5-20261106
dependencies:
# Source code: https://github.com/jupyterhub/zero-to-jupyterhub-k8s
# Latest version: https://github.com/jupyterhub/zero-to-jupyterhub-k8s/tags
Expand All @@ -12,7 +12,7 @@ dependencies:
# and run "./dependencies freeze --upgrade".
#
- name: jupyterhub
version: "4.1.0-20260304.2"
version: "4.1.0-20261106"
repository: "https://rcosdp.github.io/CS-jhub-helm-chart/"
description: |-
BinderHub is like a JupyterHub that automatically builds environments for the
Expand Down
4 changes: 2 additions & 2 deletions helm-chart/images/binderhub/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ RUN mkdir -p -m 0755 /etc/apt/keyrings
RUN apt-get update
RUN curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
RUN chmod a+r /etc/apt/keyrings/nodesource.gpg
ENV NODE_MAJOR=21
ENV NODE_MAJOR=22
RUN echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | \
tee /etc/apt/sources.list.d/nodesource.list
RUN apt update
Expand Down Expand Up @@ -75,7 +75,7 @@ RUN mkdir -p -m 0755 /etc/apt/keyrings
RUN apt-get update
RUN curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
RUN chmod a+r /etc/apt/keyrings/nodesource.gpg
ENV NODE_MAJOR=21
ENV NODE_MAJOR=22
RUN echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | \
tee /etc/apt/sources.list.d/nodesource.list
RUN apt update
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/test_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ async def local_hub_local_binder(request):
)

url = f"http://127.0.0.1:{port}/services/binder/"
for i in range(10):
for i in range(30):
try:
resp = await async_requests.get(url)
if resp.status_code == 200:
Expand Down
Loading