Package: experimaestro
Experimaestro helps in designing and managing complex workflows. It allows for the definition of tasks and their dependencies, ensuring that each step in a workflow is executed in the correct order. Some key aspects of Experimaestro are:Task Automation: The tool automates repetitive tasks, making it easier to run large-scale experiments. It's particularly useful in scenarios where experiments need to be repeated with different parameters or datasets.Resource Management: It efficiently manages computational resources, which is critical when dealing with data-intensive tasks or when running multiple experiments in parallel.Extensibility: Experimaestro is designed to be flexible and extensible, allowing users to integrate it with various programming languages and tools commonly used in data science and research.Reproducibility: By keeping a detailed record of experiments, including parameters and environments, it aids in ensuring the reproducibility of scientific experiments, which is a fundamental requirement in research.User Interface: While primarily a back-end tool, Experimaestro also offers a user interface to help in managing and visualizing workflows.The full documentation can be read by going to the following URL:https://experimaestro-python.readthedocs.ioInstallWith pipYou can then install the package usingpip install experimaestroDevelopCheckout the git directory, thenpip install -e .ExampleThis very simple example shows how to submit two tasks that concatenate two strings.
Under the curtain,A directory is created for each task (inworkdir/jobs/helloworld.add/HASHID)
based on a unique ID computed from the parametersTwo processes forSayare launched (there are no dependencies, so they will be run in parallel)A tagyis created for the main task# --- Task and types definitionsimportlogginglogging.basicConfig(level=logging.DEBUG)frompathlibimportPathfromexperimaestroimportTask,Param,experiment,progressimportclickimporttimeimportosfromtypingimportList# --- Just to be able to monitor the tasksdefslowdown(sleeptime:int,N:int):logging.info("Sleeping%ds after each step",sleeptime)foriinrange(N):time.sleep(sleeptime)progress((i+1)/N)# --- Define the tasksclassSay(Task):word:Param[str]sleeptime:Param[float]defexecute(self):slowdown(self.sleeptime,len(self.word))print(self.word.upper(),)classConcat(Task):strings:Param[List[Say]]sleeptime:Param[float]defexecute(self):says=[]slowdown(self.sleeptime,len(self.strings))forstringinself.strings:withopen(string.__xpm_stdout__)asfp: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()defcli(port,workdir,sleeptime):"""Runs an experiment"""# Sets the working directory and the name of the xpwithexperiment(workdir,"helloworld",port=port)asxp:# Submit the taskshello=Say(word="hello",sleeptime=sleeptime).submit()world=Say(word="world",sleeptime=sleeptime).submit()# Concat will depend on the two first tasksConcat(strings=[hello,world],sleeptime=sleeptime).tag("y",1).submit()if__name__=="__main__":cli()which can be launched withpython test.py /tmp/helloworld-workdir