Python API#
cloudai.api lets a Python program validate or run a scenario and find its saved results.
Prepare the Fio environment from Run your first experiment first. For integration patterns, see Automate experiments.
Pass configuration file paths as pathlib.Path objects:
from pathlib import Path
import cloudai.api
system = Path("standalone.toml")
scenario = Path("conf/experimental/quickstart/fio.toml")
cloudai.api.validate_scenario(scenario, system)
experiment = cloudai.api.run_experiment(scenario, system)
print(experiment.status, experiment.path)
Validate a scenario#
validate_scenario(scenario, system) performs the same configuration loading checks as execution.
Returns
Noneon success; raises configuration errors on failure.Creates no runner, installs no dependencies, and submits no jobs.
Accepts
tests_dirfor referenced definitions andhook_dirfor custom hooks.Does not check cluster availability or guarantee workload success.
Run an experiment#
run_experiment(scenario, system) waits for completion and returns an Experiment with the data saved in experiment.json.
Workload failures appear in the experiment status.
Configuration and setup errors raise exceptions.
on_startreceives the initial experiment and cancellation function after the result file is created, before execution begins.Execution remains synchronous after the callback.
Option |
Use |
|---|---|
|
Generate commands without running workloads. |
|
Execute through one Slurm allocation. |
|
Select a custom hook directory. |
|
Connect experiment startup and cancellation to your application. |
Find saved experiments#
Call |
Result |
Errors or omissions |
|---|---|---|
|
|
Skips directories without |
|
An |
Invalid IDs and missing, unreadable, or malformed files raise |
|
An |
The same file validation applies. |