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.5.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.5-py3-none-any.whl (17.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: functionmonitor-0.1.5.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.5.tar.gz
Algorithm Hash digest
SHA256 668526fb610440dd80782b83c4bac551e4fde6299ca9010d5a44059d619aad83
MD5 eef64b2416f83620831323230621aae3
BLAKE2b-256 715e22cb2a85516a6c27a3404b6b7c6ad8b1b6e403f95f50074d0ebc5e21a8e2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for functionmonitor-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 3f2a87fa8c692a67d623201feaa84086e3e477c1b938187c5ed83542efbc125e
MD5 9c2f2c5ea93f5d1c0ba467a65fa613dc
BLAKE2b-256 1f34f67b504f47daa7ca11a29dc6cf3f83676f5b6a611663c200c6ddd4b833d5

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