Skip to main content

A tool for monitoring and managing asynchronous function execution.

Project description

functionmonitor

Demo

Python's standard function calls are synchronous and blocking, executing each function sequentially and waiting for each to complete before moving on. This design can be a limitation, especially with I/O-bound or long-running operations.

functionmonitor is designed specifically for use in Jupyter notebooks to enable easy, asynchronous function execution. By running functions in separate threads, you can manage multiple tasks concurrently within the interactive Jupyter environment, allowing for:

  • Concurrent function execution, freeing up the main thread to continue processing other tasks.
  • Real-time monitoring of each function's progress.
  • Automatic result assignment to variables in the global namespace for easy access as soon as functions complete.

Key Features

  • Execute Functions Concurrently: Run functions in separate threads, improving efficiency by enabling asynchronous execution.
  • Easy Result Access: Results are assigned to global variables with the same name as the task key if the create_variables parameter is enabled.
  • Supports Any Callable: Works with any callable (function, lambda, etc.), allowing for flexible function management.

Installation

To install functionmonitor, simply use pip:

pip install functionmonitor

Usage Overview

  1. Basic Structure
    functionmonitor behaves similarly to a dictionary, where each task is stored with a task name as the key and the result as the value. Once a task completes, its result is directly accessible.

  2. Using Callables
    Any callable can be assigned to functionmonitor, allowing functions, lambda expressions, and more to run asynchronously. Prefixing the callable with lambda prevents immediate execution, enabling background processing.

import functionmonitor
fm = functionmonitor.get_fm(create_variables=True)
fm[{var}] = lambda: {func()}

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

functionmonitor-0.1.6.tar.gz (16.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

functionmonitor-0.1.6-py3-none-any.whl (17.1 kB view details)

Uploaded Python 3

File details

Details for the file functionmonitor-0.1.6.tar.gz.

File metadata

  • Download URL: functionmonitor-0.1.6.tar.gz
  • Upload date:
  • Size: 16.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.9

File hashes

Hashes for functionmonitor-0.1.6.tar.gz
Algorithm Hash digest
SHA256 f1cf1e15110e6eeb034cfe04dd7bc687ea84a3263a8416808159252647eb6bb1
MD5 7f915e833238c39c1cee4e9be1800059
BLAKE2b-256 7682bc28c12717ed0767808677085cb0d8fa8ae041781b5e20e70423cbbf3d24

See more details on using hashes here.

File details

Details for the file functionmonitor-0.1.6-py3-none-any.whl.

File metadata

File hashes

Hashes for functionmonitor-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 1b5462a0d9a2102cc2f1041dddad15646624417a752336731384d8eaa55a4996
MD5 75d436a69a7db8e9c99b44e4c4da19ba
BLAKE2b-256 caa9baf1d7a39b511423135f9fb82b7e2fa7a60d86dde82954d5222ca5d68c7e

See more details on using hashes here.

Supported by

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