"Experimaestro is a computer science experiment manager"
Project description
Experimaestro is a computer science experiment manager whose goals are:
- To decompose experiments into a set of parameterizable tasks
- Schedule tasks and handle dependencies between tasks
- Avoids to re-run the same task two times by computing unique task IDs dependending on the parameters
- Handle experimental parameters through tags
The full documentation can be read by going to the following URL: https://experimaestro-python.readthedocs.io
Install
With pip
You can then install the package using pip install experimaestro
Develop
Checkout the git directory, then
pip install -e .
Example
This very simple example shows how to submit two tasks that concatenate two strings. Under the curtain,
- A directory is created for each task (in
workdir/jobs/helloworld.add/HASHID) based on a unique ID computed from the parameters - Two processes for
Sayare launched (there are no dependencies, so they will be run in parallel) - A tag
yis created for the main task
# --- Task and types definitions
import logging
logging.basicConfig(level=logging.DEBUG)
from pathlib import Path
from experimaestro import Task, Param, experiment, progress
import click
import time
import os
from typing import List
# --- Just to be able to monitor the tasks
def slowdown(sleeptime: int, N: int):
logging.info("Sleeping %ds after each step", sleeptime)
for i in range(N):
time.sleep(sleeptime)
progress((i+1)/N)
# --- Define the tasks
class Say(Task):
word: Param[str]
sleeptime: Param[float]
def execute(self):
slowdown(self.sleeptime, len(self.word))
print(self.word.upper(),)
class Concat(Task):
strings: Param[List[Say]]
sleeptime: Param[float]
def execute(self):
says = []
slowdown(self.sleeptime, len(self.strings))
for string in self.strings:
with open(string.__xpm_stdout__) as fp:
says.append(fp.read().strip())
print(" ".join(says))
# --- Defines the experiment
@click.option("--port", type=int, default=12345, help="Port for monitoring")
@click.option("--sleeptime", type=float, default=2, help="Sleep time")
@click.argument("workdir", type=Path)
@click.command()
def cli(port, workdir, sleeptime):
"""Runs an experiment"""
# Sets the working directory and the name of the xp
with experiment(workdir, "helloworld", port=port) as xp:
# Submit the tasks
hello = Say(word="hello", sleeptime=sleeptime).submit()
world = Say(word="world", sleeptime=sleeptime).submit()
# Concat will depend on the two first tasks
Concat(strings=[hello, world], sleeptime=sleeptime).tag("y", 1).submit()
if __name__ == "__main__":
cli()
which can be launched with python test.py /tmp/helloworld-workdir
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 experimaestro-1.2.2.tar.gz.
File metadata
- Download URL: experimaestro-1.2.2.tar.gz
- Upload date:
- Size: 4.2 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.6.1 CPython/3.11.5 Linux/6.2.0-1012-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
96a752a0d6e70965f7804070f63863eeaba228e7669edf54edad3308b2c4ab01
|
|
| MD5 |
07e088829e1d80444b08c8fe4011f786
|
|
| BLAKE2b-256 |
59b1b35fe88dfe96d40a3c16e93728c87bbc659ac1eff72723ef8b17bd6e6ac3
|
File details
Details for the file experimaestro-1.2.2-py3-none-any.whl.
File metadata
- Download URL: experimaestro-1.2.2-py3-none-any.whl
- Upload date:
- Size: 4.3 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.6.1 CPython/3.11.5 Linux/6.2.0-1012-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
98fb77f2dee283bccd8dbc7e14b67e7ce6576c6451fcf690a6ed84dfdd198d3b
|
|
| MD5 |
9a63ffa5a64f854a26dbdb10f7ef16eb
|
|
| BLAKE2b-256 |
92ec6f5f7b02d7004add6239f3d431e338fac1bd0ab94d83a32359daaa90f98f
|