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

How to figure out info about running server from python #15918

Open
paddymul opened this issue Mar 5, 2024 · 1 comment
Open

How to figure out info about running server from python #15918

paddymul opened this issue Mar 5, 2024 · 1 comment

Comments

@paddymul
Copy link

paddymul commented Mar 5, 2024

Problem

I want to figure out how to determine the running jupyter lab server from python. Then I want to determine the start time of that server.

Proposed Solution

what code do I need after this

from IPython import get_ipython
ip = get_ipython()

Additional context

Why?

I am a widget library author, and my users frequently get the "widget: model not found" error message and are then lost.

With the server uptime info, and figuring out the MTime of the widget package, I can determine if the package was installed after the server started, then recommend users restart their jupyter lab server to see the new extension in action.

@paddymul
Copy link
Author

paddymul commented Mar 5, 2024

The command I wanted was

    parent_process = psutil.Process().parent()
    server_start_time = dtdt.fromtimestamp(parent_process.create_time())

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants