Skip to main content

A Python framework for stateful functional task dispatching and execution

Project description

FunTask

PyPI - Version PyPI - Python Version


FunTask is a Python framework for stateful functional task dispatching and execution

  • lightweight and easy
  • scalable and distributed
  • stateful
  • task is just a function(status, ...args)
  • observable
from funtask import LocalFunTaskManager, StdLogger, TaskStatus
from typing import List
import asyncio

ft = LocalFunTaskManager(StdLogger())

# increase 10 worker(in different processes) with state: ['new_state']
workers = ft.increase_workers(lambda old_state: ['new_state'], 10)

def function_task(state: List[str], logger: StdLogger, *args):
    state.append("change and visit state in func task")
    logger.log(f"current state is {state}, args: '{' '.join(args)}'")
    return "I'm task result"

# will dispatch function_task to worker0
task = workers[0].dispatch_fun_task(function_task, "i'm", "arguments")

# async wait task result
task_result = asyncio.run(task.get_result())

assert task_result == "I'm task result"
assert task.status is TaskStatus.SUCCESS
print("end.")

Table of Contents

Installation

not support for now

pip install funtask

License

funtask is distributed under the terms of the MIT license.

Features

  • local multiprocessing scheduler
  • k8s + celeary task scheduler
  • flet webUI

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

funtask-0.0.4.tar.gz (21.1 MB view details)

Uploaded Source

Built Distribution

funtask-0.0.4-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

File details

Details for the file funtask-0.0.4.tar.gz.

File metadata

  • Download URL: funtask-0.0.4.tar.gz
  • Upload date:
  • Size: 21.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.6

File hashes

Hashes for funtask-0.0.4.tar.gz
Algorithm Hash digest
SHA256 85776ebebe7a62fa6b6bfaede87b19e8533fd12dbc937b8b5ba60b9da65300e0
MD5 642e74a543aae893cc6a06fcc1c901bd
BLAKE2b-256 0844e330a02535afc23fad7ce1a0ed585fadbecbdc0f624051449542cb3cf21e

See more details on using hashes here.

File details

Details for the file funtask-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: funtask-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 7.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.6

File hashes

Hashes for funtask-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 621e3be792d2605f067a54a9dc55e8a54bc942e3875b801a295ed04950293b1b
MD5 4407a1e16049ee4914d4eb59b4c583ed
BLAKE2b-256 98d4b0402eb1af153e2bdf8e201f57c80eda9772afdebb189ac519915f3dac1a

See more details on using hashes here.

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