Documentation for App Module¶
ConnectionManager
¶
Manages WebSocket client connections, broadcasts messages to all connected clients, and retains a history of exchanged messages.
Attributes:
Name | Type | Description |
---|---|---|
historic_messages |
dict[str, dict]
|
Stores each received or broadcast message keyed by timestamp (formatted as "%Y-%m-%d %H:%M:%S"). |
active_connections |
list[WebSocket]
|
List of currently open WebSocket connections. |
Methods:
Name | Description |
---|---|
async connect |
WebSocket): Accepts a new WebSocket connection, registers it, and broadcasts a control message indicating the new client count. |
disconnect |
WebSocket): Removes the specified WebSocket from the active connections list if present. |
add_message |
str): Parses the incoming JSON-formatted message string, timestamps it, and adds it to historic_messages. |
async send_personal_message |
str, websocket: WebSocket): Sends a text message to a single WebSocket; on connection closure, cleans up the connection. |
async broadcast |
str): Logs the message via add_message, then iterates through active_connections to send the message to all clients; collects and removes any connections that have been closed or error out, logging exceptions as needed. |
get_historic |
Returns the full history of timestamped messages. |
Source code in nebula/frontend/app.py
145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 |
|
Settings
¶
Configuration settings for the Nebula application, loaded from environment variables with sensible defaults.
Attributes:
Name | Type | Description |
---|---|---|
controller_host |
str
|
Hostname or IP address of the Nebula controller service. |
controller_port |
int
|
Port on which the Nebula controller listens (default: 5000). |
resources_threshold |
float
|
Threshold for resource usage alerts (default: 0.0). |
port |
int
|
Port for the Nebula frontend service (default: 6060). |
production |
bool
|
Whether the application is running in production mode. |
gpu_available |
bool
|
Whether GPU resources are available. |
advanced_analytics |
bool
|
Whether advanced analytics features are enabled. |
host_platform |
str
|
Underlying host operating platform (e.g., 'unix'). |
log_dir |
str
|
Directory path where application logs are stored. |
config_dir |
str
|
Directory path for general configuration files. |
cert_dir |
str
|
Directory path for SSL/TLS certificates. |
root_host_path |
str
|
Root path on the host for volume mounting. |
config_frontend_dir |
str
|
Subdirectory for frontend-specific configuration (default: 'config'). |
env_file |
str
|
Path to the environment file to load additional variables (default: '.env'). |
statistics_port |
int
|
Port for the statistics/metrics endpoint (default: 8080). |
PERMANENT_SESSION_LIFETIME |
timedelta
|
Duration for session permanence (default: 60 minutes). |
templates_dir |
str
|
Directory name containing template files (default: 'templates'). |
frontend_log |
str
|
File path for the frontend log output. |
Source code in nebula/frontend/app.py
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
|
UserData
¶
Holds runtime state and synchronization events for user-specific scenario execution.
Attributes:
Name | Type | Description |
---|---|---|
nodes_registration |
dict
|
Mapping of node identifiers to their registration data. |
scenarios_list |
list
|
Ordered list of scenario identifiers or objects to be executed. |
scenarios_list_length |
int
|
Total number of scenarios in scenarios_list. |
scenarios_finished |
int
|
Count of scenarios that have completed execution. |
nodes_finished |
list
|
List of node identifiers that have finished processing. |
stop_all_scenarios_event |
Event
|
Event used to signal all scenarios should be halted. |
finish_scenario_event |
Event
|
Event used to signal a single scenario has finished. |
Source code in nebula/frontend/app.py
313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 |
|
add_global_context(request)
¶
Add global context variables for template rendering.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
request
|
Request
|
The incoming request object. |
required |
Returns:
Type | Description |
---|---|
dict[str, bool]: is_production: Flag indicating if the application is running in production mode. |
Source code in nebula/frontend/app.py
280 281 282 283 284 285 286 287 288 289 290 291 292 293 |
|
add_user(user, password, role)
async
¶
Create a new user via the controller endpoint.
Parameters: - user (str): The username for the new user. - password (str): The password for the new user. - role (str): The role assigned to the new user.
Returns: - None
Source code in nebula/frontend/app.py
784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 |
|
assign_available_gpu(scenario_data, role)
async
¶
Assign available GPU(s) or default to CPU for a scenario based on system resources and user role.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
scenario_data
|
dict
|
Scenario configuration dict to be updated with accelerator settings. |
required |
role
|
str
|
User role ('user', 'admin', or other). |
required |
Returns:
Name | Type | Description |
---|---|---|
dict |
Updated scenario_data including 'accelerator' and 'gpu_id' fields. |
Source code in nebula/frontend/app.py
1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 |
|
check_enough_resources()
async
¶
Check if the host's memory usage is below the configured threshold.
Returns:
Name | Type | Description |
---|---|---|
bool |
True if sufficient resources are available (or threshold is 0.0), False otherwise. |
Source code in nebula/frontend/app.py
1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 |
|
check_scenario_with_role(role, scenario_name)
async
¶
Check if a specific scenario is allowed for the session's role.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
session
|
dict
|
Session data containing at least a 'role' key. |
required |
scenario_name
|
str
|
Name of the scenario to check. |
required |
Returns:
Name | Type | Description |
---|---|---|
bool |
True if the scenario is allowed for the role, False otherwise. |
Raises:
Type | Description |
---|---|
HTTPException
|
If the underlying HTTP GET request fails. |
Source code in nebula/frontend/app.py
575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 |
|
controller_get(url)
async
¶
Fetch JSON data from a remote controller endpoint via asynchronous HTTP GET.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
url
|
str
|
The full URL of the controller API endpoint. |
required |
Returns:
Name | Type | Description |
---|---|---|
Any |
Parsed JSON response when the HTTP status code is 200. |
Raises:
Type | Description |
---|---|
HTTPException
|
If the response status is not 200, raises with the response status code and an error detail. |
Source code in nebula/frontend/app.py
389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 |
|
controller_post(url, data=None)
async
¶
Asynchronously send a JSON payload via HTTP POST to a controller endpoint and parse the response.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
url
|
str
|
The full URL of the controller API endpoint. |
required |
data
|
Any
|
JSON-serializable payload to include in the POST request (default: None). |
None
|
Returns:
Name | Type | Description |
---|---|---|
Any |
Parsed JSON response when the HTTP status code is 200. |
Raises:
Type | Description |
---|---|
HTTPException
|
If the response status is not 200, with the status code and an error detail. |
Source code in nebula/frontend/app.py
410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 |
|
custom_http_exception_handler(request, exc)
async
¶
Custom HTTP exception handler for Starlette applications.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
request
|
Request
|
The incoming HTTP request object. |
required |
exc
|
HTTPException
|
The HTTP exception instance containing the status code to handle. |
required |
Functionality
- Builds a context dict with the request and its session.
- For specific HTTP status codes (401, 403, 404, 405, 413), returns a TemplateResponse rendering the corresponding error page and status.
- For all other status codes, delegates to the application's default exception handler.
Returns:
Name | Type | Description |
---|---|---|
Response |
Either a TemplateResponse for the matched error code or the default exception handler’s response. |
Source code in nebula/frontend/app.py
358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 |
|
datetimeformat(value, format='%B %d, %Y %H:%M')
¶
Formats a datetime string into a specified output format.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
value
|
str
|
Input datetime string in "%Y-%m-%d %H:%M:%S" format. |
required |
format
|
str
|
Desired output datetime format (default: "%B %d, %Y %H:%M"). |
'%B %d, %Y %H:%M'
|
Returns:
Name | Type | Description |
---|---|---|
str |
The datetime string formatted according to the provided format. |
Source code in nebula/frontend/app.py
266 267 268 269 270 271 272 273 274 275 276 277 |
|
delete_user(user)
async
¶
Delete an existing user via the controller endpoint.
Parameters: - user (str): The username of the user to delete.
Returns: - None
Source code in nebula/frontend/app.py
818 819 820 821 822 823 824 825 826 827 828 829 830 |
|
deploy_scenario(scenario_data, role, user)
async
¶
Deploy a new scenario on the controller with the given parameters.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
scenario_data
|
Any
|
Data payload describing the scenario to run. |
required |
role
|
str
|
Role identifier for the scenario execution. |
required |
user
|
str
|
Username initiating the deployment. |
required |
Returns:
Name | Type | Description |
---|---|---|
Any |
Parsed JSON response confirming scenario deployment. |
Raises:
Type | Description |
---|---|
HTTPException
|
If the underlying HTTP POST request fails. |
Source code in nebula/frontend/app.py
460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 |
|
get_available_gpus()
async
¶
Fetch the list of available GPUs from the controller service.
Returns:
Name | Type | Description |
---|---|---|
Any |
Parsed JSON response containing available GPU information. |
Raises:
Type | Description |
---|---|
HTTPException
|
If the underlying HTTP request fails. |
Source code in nebula/frontend/app.py
432 433 434 435 436 437 438 439 440 441 442 443 |
|
get_config_for_scenario(scenario_name)
async
¶
Load configuration for a specific scenario from the filesystem.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
scenario_name
|
str
|
Name of the scenario to load configuration for. |
required |
Returns:
Name | Type | Description |
---|---|---|
JSONResponse |
{"status": "success", "config": } if successful, or error message if file not found or invalid JSON. |
Source code in nebula/frontend/app.py
995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 |
|
get_host_resources()
async
¶
Retrieve host resource usage data from the controller endpoint.
Returns:
Name | Type | Description |
---|---|---|
dict |
Parsed JSON resource metrics on success, or {'error': |
|
None |
If the HTTP response status is not 200. |
Source code in nebula/frontend/app.py
1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 |
|
get_least_memory_gpu()
async
¶
Fetch the GPU with the least memory usage from the controller service.
Returns:
Name | Type | Description |
---|---|---|
Any |
Parsed JSON response with details of the GPU having the least memory usage. |
Raises:
Type | Description |
---|---|
HTTPException
|
If the underlying HTTP request fails. |
Source code in nebula/frontend/app.py
446 447 448 449 450 451 452 453 454 455 456 457 |
|
get_notes(scenario_name)
async
¶
Fetch saved notes for a specific scenario.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
scenario_name
|
str
|
Name of the scenario to retrieve notes for. |
required |
Returns:
Name | Type | Description |
---|---|---|
Any |
Parsed JSON response containing the notes. |
Raises:
Type | Description |
---|---|
HTTPException
|
If the underlying HTTP GET request fails. |
Source code in nebula/frontend/app.py
705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 |
|
get_notes_for_scenario(scenario_name)
async
¶
Retrieve saved notes for a specific scenario.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
scenario_name
|
str
|
Name of the scenario to retrieve notes for. |
required |
Returns:
Name | Type | Description |
---|---|---|
JSONResponse |
{"status": "success", "notes": |
Source code in nebula/frontend/app.py
976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 |
|
get_running_scenarios(get_all=False)
async
¶
Retrieve a list of currently running scenarios.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
get_all
|
bool
|
If True, include all running scenarios; if False, apply default filtering. |
False
|
Returns:
Name | Type | Description |
---|---|---|
Any |
Parsed JSON response listing running scenarios. |
Raises:
Type | Description |
---|---|
HTTPException
|
If the underlying HTTP GET request fails. |
Source code in nebula/frontend/app.py
613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 |
|
get_scenario_by_name(scenario_name)
async
¶
Fetch the details of a scenario by name from the controller.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
scenario_name
|
str
|
Name of the scenario to retrieve. |
required |
Returns:
Name | Type | Description |
---|---|---|
Any |
Parsed JSON response with scenario details. |
Raises:
Type | Description |
---|---|
HTTPException
|
If the underlying HTTP GET request fails. |
Source code in nebula/frontend/app.py
596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 |
|
get_scenarios(user, role)
async
¶
Retrieve all scenarios available for a specific user and role.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
user
|
str
|
Username to query scenarios for. |
required |
role
|
str
|
Role identifier to filter scenarios. |
required |
Returns:
Name | Type | Description |
---|---|---|
Any |
Parsed JSON response listing available scenarios. |
Raises:
Type | Description |
---|---|
HTTPException
|
If the underlying HTTP GET request fails. |
Source code in nebula/frontend/app.py
505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 |
|
get_session(request)
¶
Retrieve the session data associated with the incoming request.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
request
|
Request
|
The HTTP request object containing session information. |
required |
Returns:
Name | Type | Description |
---|---|---|
dict |
dict
|
The session data dictionary stored in the request. |
Source code in nebula/frontend/app.py
300 301 302 303 304 305 306 307 308 309 310 |
|
get_user_by_scenario_name(scenario_name)
async
¶
Fetch user data for a given scenario from the controller.
Parameters: - scenario_name (str): The name of the scenario whose user data to retrieve.
Returns: - dict: The user data associated with the specified scenario.
Source code in nebula/frontend/app.py
770 771 772 773 774 775 776 777 778 779 780 781 |
|
index()
async
¶
Handle root path by redirecting to the platform home page.
Returns:
Name | Type | Description |
---|---|---|
RedirectResponse |
Redirects client to the '/platform' endpoint. |
Source code in nebula/frontend/app.py
849 850 851 852 853 854 855 856 857 |
|
list_nodes_by_scenario_name(scenario_name)
async
¶
List all nodes associated with a given scenario.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
scenario_name
|
str
|
Name of the scenario to list nodes for. |
required |
Returns:
Name | Type | Description |
---|---|---|
Any |
Parsed JSON response containing node details. |
Raises:
Type | Description |
---|---|
HTTPException
|
If the underlying HTTP GET request fails. |
Source code in nebula/frontend/app.py
630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 |
|
list_users(allinfo=True)
async
¶
Retrieves the list of users by calling the controller endpoint.
Parameters: - all_info (bool): If True, retrieves detailed information for each user.
Returns: - A list of users, as provided by the controller.
Source code in nebula/frontend/app.py
753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 |
|
metrics_proxy(path=None, request=None)
async
¶
Proxy experiment metric requests to the platform statistics endpoint.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path
|
str
|
The dynamic path segment to append to the statistics URL. |
None
|
request
|
Request
|
FastAPI request object containing query parameters. |
None
|
Returns:
Name | Type | Description |
---|---|---|
RedirectResponse |
Redirects the client to the corresponding platform statistics experiment URL. |
Source code in nebula/frontend/app.py
1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 |
|
monitor_resources()
async
¶
Continuously monitor host resources and, if usage exceeds the threshold, stop the last running scenario after broadcasting a message, then wait for resources to recover.
Returns:
Type | Description |
---|---|
None |
Source code in nebula/frontend/app.py
1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 |
|
nebula_add_user(request, session=Depends(get_session), user=Form(...), password=Form(...), role=Form(...))
async
¶
Add a new user to the system via form submission, available only to admin users, with basic username validation.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
request
|
Request
|
FastAPI request object. |
required |
session
|
dict
|
Session data extracted via dependency. |
Depends(get_session)
|
user
|
str
|
Username provided in form data. |
Form(...)
|
password
|
str
|
Password provided in form data. |
Form(...)
|
role
|
str
|
Role provided in form data. |
Form(...)
|
Returns:
Name | Type | Description |
---|---|---|
RedirectResponse |
Redirects client to '/platform/admin' with status 303 on success. |
Raises:
Type | Description |
---|---|
HTTPException
|
401 Unauthorized if the current user is not an admin. |
Source code in nebula/frontend/app.py
1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 |
|
nebula_admin(request, session=Depends(get_session))
async
¶
Render the admin interface showing a list of users for admin role.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
request
|
Request
|
FastAPI request object. |
required |
session
|
dict
|
Session data extracted via dependency. |
Depends(get_session)
|
Returns:
Name | Type | Description |
---|---|---|
HTMLResponse |
Rendered 'admin.html' template with user table context. |
Raises:
Type | Description |
---|---|
HTTPException
|
401 Unauthorized if the user is not an admin. |
Source code in nebula/frontend/app.py
918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 |
|
nebula_dashboard(request, session=Depends(get_session))
async
¶
Render or return the dashboard view or API data for the current user.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
request
|
Request
|
FastAPI request object. |
required |
session
|
dict
|
Session data extracted via dependency. |
Depends(get_session)
|
Returns:
Name | Type | Description |
---|---|---|
TemplateResponse |
Rendered 'dashboard.html' for HTML endpoint. |
|
JSONResponse |
List of scenario dictionaries or status message for API endpoint. |
Raises:
Type | Description |
---|---|
HTTPException
|
401 Unauthorized for invalid path access. |
Source code in nebula/frontend/app.py
1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 |
|
nebula_dashboard_deployment(request, session=Depends(get_session))
async
¶
Render the deployment dashboard with running scenarios and GPU availability.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
request
|
Request
|
FastAPI request object. |
required |
session
|
dict
|
Session data extracted via dependency. |
Depends(get_session)
|
Returns:
Name | Type | Description |
---|---|---|
HTMLResponse |
Rendered 'deployment.html' template with scenario and GPU context. |
Source code in nebula/frontend/app.py
1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 |
|
nebula_dashboard_deployment_run(request, background_tasks, session=Depends(get_session))
async
¶
Handle incoming deployment requests to run one or more scenarios, enqueue them, and trigger background execution.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
request
|
Request
|
FastAPI request object containing a JSON list of scenarios to run. |
required |
background_tasks
|
BackgroundTasks
|
Instance for scheduling tasks. |
required |
session
|
dict
|
Session data extracted via dependency. |
Depends(get_session)
|
Returns:
Name | Type | Description |
---|---|---|
RedirectResponse |
Redirects to '/platform/dashboard' on successful enqueue. |
Raises:
Type | Description |
---|---|
HTTPException
|
401 Unauthorized if the user is not logged in or content type is invalid. |
HTTPException
|
503 Service Unavailable if resources are insufficient. |
Source code in nebula/frontend/app.py
2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 |
|
nebula_dashboard_download_logs_metrics(scenario_name, request, session=Depends(get_session))
async
¶
Package scenario logs and configuration into a zip archive and stream it to the client.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
scenario_name
|
str
|
Name of the scenario whose files are to be downloaded. |
required |
request
|
Request
|
FastAPI request object. |
required |
session
|
dict
|
Session data extracted via dependency. |
Depends(get_session)
|
Returns:
Name | Type | Description |
---|---|---|
StreamingResponse |
A zip file containing the scenario’s logs and configuration. |
Raises:
Type | Description |
---|---|
HTTPException
|
401 Unauthorized if the user is not logged in. |
HTTPException
|
404 Not Found if the log or config folder does not exist. |
Source code in nebula/frontend/app.py
1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 |
|
nebula_dashboard_monitor(scenario_name, request, session=Depends(get_session))
async
¶
Display or return monitoring information for a specific scenario, including node statuses.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
scenario_name
|
str
|
Name of the scenario to monitor. |
required |
request
|
Request
|
FastAPI request object. |
required |
session
|
dict
|
Session data extracted via dependency. |
Depends(get_session)
|
Returns:
Name | Type | Description |
---|---|---|
TemplateResponse |
Rendered 'monitor.html' for HTML endpoint. |
|
JSONResponse |
JSON object containing scenario status, node list, and scenario metadata. |
Raises:
Type | Description |
---|---|
HTTPException
|
401 Unauthorized for invalid path access. |
Source code in nebula/frontend/app.py
1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 |
|
nebula_dashboard_private(request, scenario_name, session=Depends(get_session))
async
¶
Render the private scenario dashboard for authenticated users.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
request
|
Request
|
FastAPI request object. |
required |
scenario_name
|
str
|
Name of the scenario to display. |
required |
session
|
dict
|
Session data extracted via dependency. |
Depends(get_session)
|
Returns:
Name | Type | Description |
---|---|---|
HTMLResponse |
Rendered 'private.html' template with scenario context. |
Raises:
Type | Description |
---|---|
HTTPException
|
401 Unauthorized if the user is not authenticated. |
Source code in nebula/frontend/app.py
896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 |
|
nebula_dashboard_runningscenario(session=Depends(get_session))
async
¶
Get information about currently running scenario(s) for the authenticated user or admin.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
session
|
dict
|
Session data extracted via dependency. |
Depends(get_session)
|
Returns:
Name | Type | Description |
---|---|---|
JSONResponse |
JSON object containing running scenario details and status, or {"scenario_status": "not running"}. |
Source code in nebula/frontend/app.py
1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 |
|
nebula_dashboard_statistics(request, scenario_name=None)
async
¶
Render the TensorBoard statistics page for all experiments or filter by scenario.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
request
|
Request
|
FastAPI request object. |
required |
scenario_name
|
str
|
Scenario name to filter statistics by; defaults to None. |
None
|
Returns:
Name | Type | Description |
---|---|---|
TemplateResponse |
Rendered 'statistics.html' with the appropriate URL parameter for TensorBoard. |
Source code in nebula/frontend/app.py
1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 |
|
nebula_delete_user(user, request, session=Depends(get_session))
async
¶
Delete a specified user account via admin privileges, preventing deletion of 'ADMIN' or self.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
user
|
str
|
Username of the account to delete. |
required |
request
|
Request
|
FastAPI request object. |
required |
session
|
dict
|
Session data extracted via dependency. |
Depends(get_session)
|
Returns:
Name | Type | Description |
---|---|---|
RedirectResponse |
Redirects client to '/platform/admin' on success. |
Raises:
Type | Description |
---|---|
HTTPException
|
403 Forbidden if attempting to delete 'ADMIN' or the current user. |
Source code in nebula/frontend/app.py
1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 |
|
nebula_home(request)
async
¶
Render the Nebula platform home page.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
request
|
Request
|
FastAPI request object. |
required |
Returns:
Name | Type | Description |
---|---|---|
HTMLResponse |
Rendered 'index.html' template with alerts context. |
Source code in nebula/frontend/app.py
860 861 862 863 864 865 866 867 868 869 870 871 872 873 |
|
nebula_login(request, session=Depends(get_session), user=Form(...), password=Form(...))
async
¶
Authenticate a user and initialize session data.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
request
|
Request
|
FastAPI request object. |
required |
session
|
dict
|
Session data extracted via dependency. |
Depends(get_session)
|
user
|
str
|
Username provided in form data. |
Form(...)
|
password
|
str
|
Password provided in form data. |
Form(...)
|
Returns:
Name | Type | Description |
---|---|---|
JSONResponse |
{"message": "Login successful"} with HTTP 200 status on success. |
Source code in nebula/frontend/app.py
1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 |
|
nebula_logout(request, session=Depends(get_session))
async
¶
Log out the authenticated user and redirect to the platform home.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
request
|
Request
|
FastAPI request object. |
required |
session
|
dict
|
Session data extracted via dependency. |
Depends(get_session)
|
Returns:
Name | Type | Description |
---|---|---|
RedirectResponse |
Redirects client to the '/platform' endpoint. |
Source code in nebula/frontend/app.py
1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 |
|
nebula_monitor_image(scenario_name)
async
¶
Serve the topology image for a given scenario if available.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
scenario_name
|
str
|
Name of the scenario. |
required |
Returns:
Name | Type | Description |
---|---|---|
FileResponse |
The topology.png image for the scenario. |
Raises:
Type | Description |
---|---|
HTTPException
|
404 Not Found if the topology image does not exist. |
Source code in nebula/frontend/app.py
1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 |
|
nebula_relaunch_scenario(scenario_name, background_tasks, session=Depends(get_session))
async
¶
Relaunch a previously run scenario by loading its configuration, enqueuing it, and starting execution in the background.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
scenario_name
|
str
|
Name of the scenario to relaunch. |
required |
background_tasks
|
BackgroundTasks
|
FastAPI BackgroundTasks instance for deferred execution. |
required |
session
|
dict
|
Session data extracted via dependency. |
Depends(get_session)
|
Returns:
Name | Type | Description |
---|---|---|
RedirectResponse |
Redirects to the '/platform/dashboard' endpoint. |
Raises:
Type | Description |
---|---|
HTTPException
|
401 Unauthorized if the user is not authenticated or lacks permission. |
Source code in nebula/frontend/app.py
1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 |
|
nebula_remove_scenario(scenario_name, session=Depends(get_session))
async
¶
Remove a scenario for the authenticated user and redirect back to the dashboard.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
scenario_name
|
str
|
Name of the scenario to remove. |
required |
session
|
dict
|
Session data extracted via dependency. |
Depends(get_session)
|
Returns:
Name | Type | Description |
---|---|---|
RedirectResponse |
Redirects to the '/platform/dashboard' endpoint. |
Raises:
Type | Description |
---|---|
HTTPException
|
401 Unauthorized if the user is not authenticated or lacks permission. |
Source code in nebula/frontend/app.py
1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 |
|
nebula_stop_scenario(scenario_name, stop_all, request, session=Depends(get_session))
async
¶
Stop one or all scenarios for the current user and redirect to the dashboard.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
scenario_name
|
str
|
Name of the scenario to stop. |
required |
stop_all
|
bool
|
If True, stop all scenarios; otherwise stop only the specified one. |
required |
request
|
Request
|
FastAPI request object. |
required |
session
|
dict
|
Session data extracted via dependency. |
Depends(get_session)
|
Returns:
Name | Type | Description |
---|---|---|
RedirectResponse |
Redirects to the '/platform/dashboard' endpoint. |
Raises:
Type | Description |
---|---|
HTTPException
|
401 Unauthorized if the user is not authenticated or lacks permission. |
Source code in nebula/frontend/app.py
1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 |
|
nebula_update_node(scenario_name, request)
async
¶
Process a node update request for a scenario and broadcast the updated node information.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
scenario_name
|
str
|
Name of the scenario. |
required |
request
|
Request
|
FastAPI request object containing a JSON payload with node update data. |
required |
Returns:
Name | Type | Description |
---|---|---|
JSONResponse |
{"message": "Node updated", "status": "success"} on success. |
Raises:
Type | Description |
---|---|
HTTPException
|
400 Bad Request if the content type is not application/json. |
Source code in nebula/frontend/app.py
1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 |
|
nebula_update_user(request, session=Depends(get_session), user=Form(...), password=Form(...), role=Form(...))
async
¶
Update an existing user's credentials and role via form submission, accessible only to admin users.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
request
|
Request
|
FastAPI request object. |
required |
session
|
dict
|
Session data extracted via dependency. |
Depends(get_session)
|
user
|
str
|
Username provided in form data. |
Form(...)
|
password
|
str
|
New password provided in form data. |
Form(...)
|
role
|
str
|
New role provided in form data. |
Form(...)
|
Returns:
Name | Type | Description |
---|---|---|
RedirectResponse |
Redirects client to '/platform/admin' on success, or to '/platform' if unauthorized. |
Source code in nebula/frontend/app.py
1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 |
|
nebula_ws_historic(session=Depends(get_session))
async
¶
Retrieve historical data for admin users.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
session
|
dict
|
Session data extracted via dependency. |
Depends(get_session)
|
Returns:
Name | Type | Description |
---|---|---|
JSONResponse |
Historical data if available, otherwise an error message. |
Source code in nebula/frontend/app.py
876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 |
|
node_stopped(scenario_name, request)
async
¶
Handle notification that a node has finished its task; mark the node as finished, stop the scenario if all nodes are done, and signal scenario completion.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
scenario_name
|
str
|
Name of the scenario. |
required |
request
|
Request
|
FastAPI request object containing a JSON payload with the finished node index. |
required |
Returns:
Name | Type | Description |
---|---|---|
JSONResponse |
Message indicating node completion status or scenario completion. |
Raises:
Type | Description |
---|---|
HTTPException
|
400 Bad Request if the content type is not application/json. |
Source code in nebula/frontend/app.py
1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 |
|
remove_nodes_by_scenario_name(scenario_name)
async
¶
Remove all nodes associated with a scenario from the controller records.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
scenario_name
|
str
|
Name of the scenario whose nodes should be removed. |
required |
Raises:
Type | Description |
---|---|
HTTPException
|
If the underlying HTTP POST request fails. |
Source code in nebula/frontend/app.py
690 691 692 693 694 695 696 697 698 699 700 701 702 |
|
remove_note(scenario_name)
async
¶
Remove notes for a specific scenario from the controller.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
scenario_name
|
str
|
Name of the scenario whose notes should be removed. |
required |
Raises:
Type | Description |
---|---|
HTTPException
|
If the underlying HTTP POST request fails. |
Source code in nebula/frontend/app.py
738 739 740 741 742 743 744 745 746 747 748 749 750 |
|
remove_scenario(scenario_name=None, user=None)
async
¶
Remove all data and resources associated with a scenario, including nodes, notes, and files.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
scenario_name
|
str
|
Name of the scenario to remove. |
None
|
user
|
str
|
Username associated with the scenario. |
None
|
Returns:
Type | Description |
---|---|
None |
Source code in nebula/frontend/app.py
1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 |
|
remove_scenario_by_name(scenario_name)
async
¶
Remove a scenario by name from the controller’s records.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
scenario_name
|
str
|
Name of the scenario to remove. |
required |
Raises:
Type | Description |
---|---|
HTTPException
|
If the underlying HTTP POST request fails. |
Source code in nebula/frontend/app.py
560 561 562 563 564 565 566 567 568 569 570 571 572 |
|
run_scenario(scenario_data, role, user)
async
¶
Deploy a single scenario: assign resources, register it, and start its participants.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
scenario_data
|
dict
|
The scenario configuration data. |
required |
role
|
str
|
The role of the user initiating the scenario. |
required |
user
|
str
|
Username associated with the scenario. |
required |
Returns:
Type | Description |
---|---|
None |
Source code in nebula/frontend/app.py
1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 |
|
run_scenarios(role, user)
async
¶
Sequentially execute all enqueued scenarios for a user, waiting for each to complete and for sufficient resources before starting the next.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
role
|
str
|
The role of the user initiating the scenarios. |
required |
user
|
str
|
Username associated with the scenarios. |
required |
Returns:
Type | Description |
---|---|
None |
Source code in nebula/frontend/app.py
2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 |
|
save_note_for_scenario(scenario_name, request, session=Depends(get_session))
async
¶
Save notes for a specific scenario for authenticated users.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
scenario_name
|
str
|
Name of the scenario. |
required |
request
|
Request
|
FastAPI request object containing JSON payload. |
required |
session
|
dict
|
Session data extracted via dependency. |
Depends(get_session)
|
Returns:
Name | Type | Description |
---|---|---|
JSONResponse |
{"status": "success"} on success, or error message on failure. |
Source code in nebula/frontend/app.py
947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 |
|
save_notes(scenario_name, notes)
async
¶
Save or update notes for a specific scenario on the controller.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
scenario_name
|
str
|
Name of the scenario to attach notes to. |
required |
notes
|
Any
|
Content of the notes to be saved. |
required |
Raises:
Type | Description |
---|---|
HTTPException
|
If the underlying HTTP POST request fails. |
Source code in nebula/frontend/app.py
722 723 724 725 726 727 728 729 730 731 732 733 734 735 |
|
scenario_set_status_to_finished(scenario_name, all=False)
async
¶
Mark one or all scenarios as finished on the controller.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
scenario_name
|
str
|
Name of the scenario to update. |
required |
all
|
bool
|
If True, mark all scenarios as finished; otherwise only the named one. |
False
|
Raises:
Type | Description |
---|---|
HTTPException
|
If the underlying HTTP POST request fails. |
Source code in nebula/frontend/app.py
544 545 546 547 548 549 550 551 552 553 554 555 556 557 |
|
scenario_update_record(scenario_name, start_time, end_time, scenario, status, role, username)
async
¶
Update the record of a scenario’s execution status on the controller.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
scenario_name
|
str
|
Unique name of the scenario. |
required |
start_time
|
str
|
ISO-formatted start timestamp. |
required |
end_time
|
str
|
ISO-formatted end timestamp. |
required |
scenario
|
Any
|
Scenario payload or identifier. |
required |
status
|
str
|
New status value (e.g., 'running', 'finished'). |
required |
role
|
str
|
Role associated with the scenario. |
required |
username
|
str
|
User who ran or updated the scenario. |
required |
Raises:
Type | Description |
---|---|
HTTPException
|
If the underlying HTTP POST request fails. |
Source code in nebula/frontend/app.py
523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 |
|
signal_handler(signal, frame)
async
¶
Asynchronous signal handler for Ctrl+C (SIGINT) in the frontend.
Logs the interrupt event, schedules all scenarios to be marked as finished by creating an asyncio task for scenario_set_status_to_finished(all=True)
, and then exits the process.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
signal
|
int
|
The signal number received (e.g., signal.SIGINT). |
required |
frame
|
FrameType
|
The current stack frame at the moment the signal was handled. |
required |
Source code in nebula/frontend/app.py
340 341 342 343 344 345 346 347 348 349 350 351 352 |
|
statistics_proxy(request, path=None, session=Depends(get_session))
async
¶
Proxy requests to the TensorBoard backend to fetch experiment statistics, rewriting URLs and filtering headers as needed.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
request
|
Request
|
FastAPI request object with original headers, cookies, and body. |
required |
path
|
str
|
Specific TensorBoard sub-path to proxy; defaults to None. |
None
|
session
|
dict
|
Session data extracted via dependency. |
Depends(get_session)
|
Returns:
Name | Type | Description |
---|---|---|
Response |
The proxied TensorBoard response with adjusted headers and content. |
Raises:
Type | Description |
---|---|
HTTPException
|
401 Unauthorized if the user is not authenticated. |
Source code in nebula/frontend/app.py
1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 |
|
stop_scenario_by_name(scenario_name, username, all=False)
async
¶
Stops a running scenario via the NEBULA controller.
This function sends an HTTP POST request to the controller to stop a specific scenario. It can stop only the nodes associated with a particular user, or all nodes in the scenario if specified.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
scenario_name
|
str
|
The name of the scenario to be stopped. |
required |
username
|
str
|
The username requesting the scenario to be stopped. |
required |
all
|
bool
|
If True, stops all nodes in the scenario regardless of the user. Defaults to False. |
False
|
Returns:
Name | Type | Description |
---|---|---|
dict |
Response from the controller indicating the result of the operation. |
Raises:
Type | Description |
---|---|
HTTPException
|
If the request to the controller fails or returns an error. |
Source code in nebula/frontend/app.py
480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 |
|
update_node_record(uid, idx, ip, port, role, neighbors, latitude, longitude, timestamp, federation, round_number, scenario_name, run_hash, malicious)
async
¶
Update the record of a node’s state on the controller.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
uid
|
str
|
Unique node identifier. |
required |
idx
|
int
|
Node index within the scenario. |
required |
ip
|
str
|
Node IP address. |
required |
port
|
int
|
Node port number. |
required |
role
|
str
|
Node role in the scenario. |
required |
neighbors
|
Any
|
Neighboring node references. |
required |
latitude
|
float
|
Node’s latitude coordinate. |
required |
longitude
|
float
|
Node’s longitude coordinate. |
required |
timestamp
|
str
|
ISO-formatted timestamp of the update. |
required |
federation
|
str
|
Federation identifier. |
required |
round_number
|
int
|
Current round number in the scenario. |
required |
scenario_name
|
str
|
Name of the scenario. |
required |
run_hash
|
str
|
Unique hash for this scenario run. |
required |
malicious
|
bool
|
Flag indicating if the node is malicious. |
required |
Raises:
Type | Description |
---|---|
HTTPException
|
If the underlying HTTP POST request fails. |
Source code in nebula/frontend/app.py
647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 |
|
update_user(user, password, role)
async
¶
Update an existing user's credentials and role via the controller endpoint.
Parameters: - user (str): The username of the user to update. - password (str): The new password for the user. - role (str): The new role to assign to the user.
Returns: - None
Source code in nebula/frontend/app.py
801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 |
|
verify_user(user, password)
async
¶
Verify a user's credentials against the controller.
Parameters: - user (str): The username to verify. - password (str): The password to verify for the user.
Returns: - dict: The verification result from the controller, typically including authentication status.
Source code in nebula/frontend/app.py
833 834 835 836 837 838 839 840 841 842 843 844 845 846 |
|
wait_for_enough_ram()
async
¶
Asynchronously wait until the host's memory usage falls below 80% of its initial measurement.
Returns:
Type | Description |
---|---|
None |
Source code in nebula/frontend/app.py
1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 |
|
websocket_endpoint(websocket, client_id)
async
¶
WebSocket endpoint for real-time chat at /platform/ws/{client_id}.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
websocket
|
WebSocket
|
The client’s WebSocket connection instance. |
required |
client_id
|
int
|
Unique identifier for the connecting client. |
required |
Functionality
- On connection: registers the client via manager.connect(websocket).
- Message loop: awaits incoming text frames, wraps each in a control message including the client_id, and broadcasts to all active clients using manager.broadcast().
- On WebSocketDisconnect: deregisters the client via manager.disconnect(websocket) and broadcasts a “client left” control message.
- Error handling: logs exceptions during broadcast or any unexpected WebSocket errors, ensuring the connection is cleaned up on failure.
Source code in nebula/frontend/app.py
224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 |
|
zipdir(path, ziph)
¶
Recursively add all files from a directory into a zip archive.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path
|
str
|
The root directory whose contents will be zipped. |
required |
ziph
|
ZipFile
|
An open ZipFile handle to which files will be written. |
required |
Returns:
Type | Description |
---|---|
None |
Source code in nebula/frontend/app.py
1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 |
|