Skip to content
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

[RELEASE] v0.11.0 #197

Merged
merged 4 commits into from
Jun 3, 2024
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 ci/release/update-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@ function sed_runner() {
sed -i.bak ''"$1"'' $2 && rm -f ${2}.bak
}

jq -e --arg tag "$NEXT_FULL_TAG" '.version=$tag' package.json > package.json.tmp
jq --indent 4 -e --arg tag "$NEXT_FULL_TAG" '.version=$tag' package.json > package.json.tmp
mv package.json.tmp package.json
7 changes: 6 additions & 1 deletion jupyterlab_nvdashboard/apps/utils.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
from tornado.websocket import WebSocketHandler
from jupyter_server.base.handlers import JupyterHandler
import tornado
import json


class CustomWebSocketHandler(WebSocketHandler):
class CustomWebSocketHandler(JupyterHandler, WebSocketHandler):
def open(self):
if not self.current_user:
self.write_message(json.dumps({"error": "Unauthorized access"}))
self.close()
return
self.write_message(json.dumps({"status": "connected"}))
self.set_nodelay(True)
# Start a periodic callback to send data every 50ms
Expand Down
5 changes: 5 additions & 0 deletions jupyterlab_nvdashboard/tests/test_cpu_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ def handler_args():
with patch("tornado.web.Application") as mock_application, patch(
"tornado.httputil.HTTPServerRequest"
) as mock_request:
# Mock the settings to return appropriate values
mock_settings = {
"base_url": "/",
}
mock_application.settings = mock_settings
yield mock_application, mock_request


Expand Down
5 changes: 5 additions & 0 deletions jupyterlab_nvdashboard/tests/test_gpu_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ def handler_args():
with patch("tornado.web.Application") as mock_application, patch(
"tornado.httputil.HTTPServerRequest"
) as mock_request:
# Mock the settings to return appropriate values
mock_settings = {
"base_url": "/",
}
mock_application.settings = mock_settings
yield mock_application, mock_request


Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jupyterlab-nvdashboard",
"version": "0.10.0",
"version": "0.11.0",
"description": "A JupyterLab extension for displaying GPU usage dashboards",
"keywords": [
"jupyter",
Expand Down
2 changes: 1 addition & 1 deletion src/charts/PciThroughputChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const PciThroughputChart: React.FC<IChartProps> = ({ settingRegistry }) => {
// Load settings and initialize WebSocket connection
loadSettingRegistry(settingRegistry, setUpdateFrequency, setIsSettingsLoaded);
useWebSocket<IPCIThroughputProps>(
'nvlink_throughput',
'pci_stats',
false,
updateFrequency,
setPciStats,
Expand Down
10 changes: 7 additions & 3 deletions src/handler.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
import { URLExt } from '@jupyterlab/coreutils';
import { ServerConnection } from '@jupyterlab/services';

/**
* Connect to a WebSocket API endpoint
*
* @param endPoint WebSocket endpoint for the extension
* @returns A WebSocket object connected to the endpoint
*/
export function connectToWebSocket(endPoint = '') {
const baseUrl = document.location.origin.replace(/^http/, 'ws');
const wsUrl = new URL(`nvdashboard/${endPoint}`, baseUrl);
const settings = ServerConnection.makeSettings();
const baseUrl = settings.baseUrl.replace(/^http/, 'ws');
const wsUrl = URLExt.join(baseUrl, 'nvdashboard', endPoint);

const ws = new WebSocket(wsUrl.href);
const ws = new WebSocket(wsUrl);

ws.onopen = () => {
console.log(`WebSocket connected to ${endPoint}`);
Expand Down
Loading