Skip to main content

Python package with widget to simplify work with many processes in jupyter

Project description

GitHub last commit GitHub license<space><space> https://travis-ci.org/stas-prokopiev/jupyter_process_manager.svg?branch=master PyPI PyPI - Python Version

Overview.

This is a library which helps working with many processes in a jupyter notebook in a very simple way.

Installation via pip:

pip install jupyter_process_manager

Usage examples

How to create create and start processes for jupyter_process_manager

from jupyter_process_manager import JupyterProcessManager
process_manager = JupyterProcessManager(".")  # "." - path where to store outputs of the processes

# And functions for processing
process_manager.add_function_to_processing(
    func1, *func1_args,**func1_kwargs)
process_manager.add_function_to_processing(
    func2, *func2_args,**func2_kwargs)

WARNING: Please do NOT try to use functions defined inside jupyter notebook, they won’t work.

JupyterProcessManager arguments:

  1. str_dir_for_output: Directory where to store processes outputs

  2. is_to_delete_previous_outputs=True: Flag If you want to delete outputs for all previous processes in the directory

Usage in Jupyter Notebook

After processes were added, you can check what is happening with them.

process_manager

Showing the JupyterProcessManager widget won’t block execution so you can run the code in other cells

images/2.PNG

How to check output for the processes

Select the process for which you want to see the output.
Select which output you want to see.
The output will get updated every 2 seconds.

How to add more processes

You can add as many processes as you want
by running the code below in any other jupyter notebook cell
process_manager.add_function_to_processing(
    func_new, *func_new_args,**func_new_kwargs)

How to stop a process

To stop the process, select it and press the orange button to stop it

When the button to stop the selected process is pushed.
KeyboardInterrupt Exception is called for the process
If within 5 seconds process is not finished then the process will be killed.

How to do a debug run without a new process creation

# arguments are the same as in **add_function_to_processing(...)**
process_manager.debug_run_of_1_function(func_to_process, *args, **kwargs)

Other methods available within running processes for JPM

Clear stdout output from the process

from jupyter_process_manager import clear_output
clear_output()

Get stdout output for the process

from jupyter_process_manager import read_stdout
stdout_content = read_stdout()

Usage in a console

process_manager.wait_till_all_processes_are_over()

You will see the output like shown below

images/1.PNG

Contacts

License

This project is licensed under the MIT License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jupyter_process_manager-0.1.16.tar.gz (13.7 kB view details)

Uploaded Source

Built Distribution

jupyter_process_manager-0.1.16-py3-none-any.whl (14.6 kB view details)

Uploaded Python 3

File details

Details for the file jupyter_process_manager-0.1.16.tar.gz.

File metadata

  • Download URL: jupyter_process_manager-0.1.16.tar.gz
  • Upload date:
  • Size: 13.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.9.12 Windows/10

File hashes

Hashes for jupyter_process_manager-0.1.16.tar.gz
Algorithm Hash digest
SHA256 8f8572673a84f44511514fdc90cd98dcf9daccee9f70b5f4d3361f5906d1352b
MD5 765ff37aa85260fb88a80d98ceb1e969
BLAKE2b-256 2f096da3fd6f21b0fd8259fe4d56528e6abd2b0e91dd72338e2c3841162e9564

See more details on using hashes here.

Provenance

File details

Details for the file jupyter_process_manager-0.1.16-py3-none-any.whl.

File metadata

File hashes

Hashes for jupyter_process_manager-0.1.16-py3-none-any.whl
Algorithm Hash digest
SHA256 817b27aa777d91e70dc5a80b5d8d10414419d64a2a8b02b75e4cda0a96dafde5
MD5 2b19ac704f13e9429a383e5e8cc7bf38
BLAKE2b-256 03796ffb3e98d3c25721093a1ed2706d41fa079aa93537d0dc26fea941b6f7d7

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page