Skip to main content

Dynamic mutiprocess preprocessing task loader and dispatcher

Project description

Akasaka

Dynamic mutiprocess preprocessing task loader and dispatcher.

To be brief, akasaka enables you to write a task class and run it in parallel with a simple command. It features

  • Argument parsing through argparse
  • Cache management, i.e. you can override is_executed to check if the task is already executed
  • Automatic parallelization
  • Some helper functions to make your life easier (to be added later)

Install

pip install akasaka

Usage

$ akasaka -H
usage: akasaka [--num_process NUM_PROCESS] [--chunksize CHUNKSIZE] [--devices DEVICES [DEVICES ...]] [-h] [-H] module_path

Dynamically load a Python class from a module.

positional arguments:
  module_path           The module path in the format "module.submodule.ClassName"

optional arguments:
  --num_process NUM_PROCESS
                        Number of processes to use, for normal task (default: number of CPU cores)
  --chunksize CHUNKSIZE
                        Number of tasks to be sent to a worker process at a time, for normal task (default: 1)
  --devices DEVICES [DEVICES ...]
                        The devices to run the task on, for torch task (default: [])
  -h, --help            Show help message for task and exit
  -H, --hel-akasaka     Show Akasaka help message and exit

Write a task class of the subclass of AsakasaTask and implement needed methods. Take a look at the examples in the examples directory.

For PyTorch CUDA tasks, you would need to use AsakasaTorchTask as the base class. The number of processes is determined by the number of CUDA devices provided.

With akasaka installed, to run the examples, try following commands:

cd examples
# print.py
akasaka print.PrintTaskTest --test test_string
# directory_example/print.py
akasaka directory_example.print.PrintTaskTest --test test_string

Development

To install from source, clone the repository and run

pip install -e .

Known Issues

For torch (CUDA) task, you might need to wait for unexpected long time after model loaded before the task can start. Reason to be figured out.

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

akasaka-0.1.6.tar.gz (7.1 kB view details)

Uploaded Source

Built Distribution

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

akasaka-0.1.6-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: akasaka-0.1.6.tar.gz
  • Upload date:
  • Size: 7.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.2

File hashes

Hashes for akasaka-0.1.6.tar.gz
Algorithm Hash digest
SHA256 7b44a664277af5bc558dc94503f80f3bf07626000219050bc0979fd616145394
MD5 6e16876fc4a6bfc8af81a9c128d8af2b
BLAKE2b-256 5d18072666ee47dc068182f5babb1ae235f92a3bf3536d6c9e5cc31181acedbd

See more details on using hashes here.

File details

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

File metadata

  • Download URL: akasaka-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 8.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.2

File hashes

Hashes for akasaka-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 db5448f9d555dce029f01a32a4b577ac49aaad287081eaff890d286d0fc933d1
MD5 9862a42458417c7c2870b3dda96ca22c
BLAKE2b-256 9cf711bf84c8f89bf6a7cc7fb0a3230aea58b537dd1f1d3a85f8440e46eae4d6

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