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

Uploaded Python 3

File details

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

File metadata

  • Download URL: functionmonitor-0.1.7.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.7.tar.gz
Algorithm Hash digest
SHA256 af57d2d89acfe46bf256cda3fe2500bb5b6772acd5fa6377fd5fd19ef23a934a
MD5 803cd80623c82623d5caac3121e97a00
BLAKE2b-256 9b81833f4b1f3cb7a4947b6b9d9077d6e849aaaa84a64ef6138fad40fe004072

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for functionmonitor-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 fc6667783fb70015ad0200974292f66f1707255e381d00ff38c084ed8d8b511a
MD5 aa1fbe5d2f5263f7fa39a2c30644ccc0
BLAKE2b-256 129d900cdcde0ffaa5cf632d6afd2533be93686dd8776f7c61c2bb443d03013d

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