Skip to content

Commit

Permalink
No public description
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 563819222
  • Loading branch information
metrizable authored and colaboratory-team committed Sep 14, 2023
1 parent 0fc4cfe commit 45ac64b
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion google/colab/_serverextension/_resource_monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,17 @@ def get_ram_usage(kernel_manager):
# is better performed in the frontend presentation layer. 2) was only a
# requirement for the split (KMC/K) container, a feature that was dropped
# (cl/470476143).
def get_pid(kernel):
# TODO(b/264409633): Eliminate this function after migration to
# jupyter-client 7.x is complete.
try:
pid = kernel.provisioner.pid
except AttributeError:
pid = kernel.kernel.pid
return str(pid)

pids_to_kernel_ids = {
str(kernel_manager.get_kernel(kernel_id).kernel.pid): kernel_id
get_pid(kernel_manager.get_kernel(kernel_id)): kernel_id
for kernel_id in kernel_manager.list_kernel_ids()
}

Expand Down

0 comments on commit 45ac64b

Please sign in to comment.