No project description provided
Project description
Exca - ⚔
Quick install
pip install exca
Full documentation
Documentation is available at https://facebookresearch.github.io/exca/
Basic overview
Consider you have one pydantic model/config (if you do not know pydantic, it is similar to dataclasses) that fully defines one processing to perform, for instance through a process method like below:
import numpy as np
import typing as tp
import pydantic
class TutorialTask(pydantic.BaseModel):
param: int = 12
def process(self) -> float:
return self.param * np.random.rand()
Updating process to enable caching of its output and running it on slurm only requires adding a TaskInfra sub-configuration and decorate the method:
import typing as tp
import exca as xk
class TutorialTask(pydantic.BaseModel):
param: int = 12
infra: xk.TaskInfra = xk.TaskInfra(version="1")
@infra.apply
def process(self) -> float:
return self.param * np.random.rand()
TaskInfra provides configuration for caching and computation, in particular providing a folder activates caching through the filesystem:
TaskInfra provides configuration for caching and computation, in particular providing a folder activates caching through the filesystem, and setting cluster="auto" triggers computation either on slurm cluster if available, or in a dedicated process otherwise.
task = TutorialTask(param=1, infra={"folder": tmp_path, "cluster": "auto"})
out = task.process() # runs on slurm if available
# calling process again will load the cache and not a new random number
assert out == task.process()
See the API reference for all the details
Contributing
See the CONTRIBUTING file for how to help out.
Citing
@misc{exca,
author = {J. Rapin and J.-R. King},
title = {{Exca - Execution and caching}},
year = {2024},
publisher = {GitHub},
journal = {GitHub repository},
howpublished = {\url{https://github.com/facebookresearch/exca}},
}
License
exca is MIT licensed, as found in the LICENSE file.
Also check-out Meto Open Source Terms of Use and Privacy Policy.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file exca-0.1.0.tar.gz.
File metadata
- Download URL: exca-0.1.0.tar.gz
- Upload date:
- Size: 57.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.10.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1d1dd0d48231b9069744c9ed6ab24e00b54345a4741a01236cb63dd1694b9cf3
|
|
| MD5 |
2935944cadb62ae3a0ba70780aeacdef
|
|
| BLAKE2b-256 |
2994ecff3c6f5d57daf3755b44e4da5e2ff31614686c486e749a2f449b0215e3
|
File details
Details for the file exca-0.1.0-py3-none-any.whl.
File metadata
- Download URL: exca-0.1.0-py3-none-any.whl
- Upload date:
- Size: 71.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.10.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
42535c8b348e937c32789d7a87bedd86ecac84928e7edfaf7f5a4e7653cfefed
|
|
| MD5 |
0001d8d0ffb6a7112a00808f6e0ddc59
|
|
| BLAKE2b-256 |
3d55f9827bc2f0a7f6c6cd80d5447c903472a3c02cd9cd67b0ba692e84c7dcdc
|