Skip to content

First Workflow: Analyze a Small Table

Run a local job, inspect its outputs, and repeat the same execution from Python. This example uses 30 invented numeric values. It needs no GPU, external engine, downloaded model, or molecular structures.

Prepare the environment and files

See installation for release availability and source installation. In a compatible environment, install caddforge-datascience; it installs core automatically:

python -m pip install caddforge-datascience
caddforge list-tools
caddforge show-config datascience distribution-diagnostics

Download values.csv, diagnostics.yaml, and run.py into one new directory. Run commands from that directory. Keep CSV and YAML filenames unchanged. Downloaded .py and .yaml links may open as text; save them using the browser's save command.

The configuration selects backend: local, a fixed seed, and ten histogram bins. Relative workflow input paths resolve from the submission working directory.

caddforge run datascience distribution-diagnostics --config diagnostics.yaml

The terminal prints a job ID. Substitute that ID in:

caddforge status <job-id>
caddforge logs <job-id>
caddforge list-jobs

Keep the same working directory for these commands so they use the same default registry. Job status should be COMPLETED. Under the job's runs/<date>/<job-id>/results/, expect:

File Meaning
distribution_report.json Distribution report; counts.n_total is 30
distribution_diagnostics.png Histogram and Q–Q plot
result_record.json Canonical job result and named output paths

The configuration gives the scientific report its own filename, separate from canonical result records. Load reports through their named result paths. Normality p-values and recommendations describe this toy sample; they do not validate an assay or establish a scientific distribution. The values are dimensionless.

Run from Python

The supplied script uses the same configuration and core submission helpers:

python run.py
from caddforge.core.execution import load_result_for_job, submit_workflow
from caddforge.core.job import JobStatus
from caddforge.plugins import get_tool

spec = get_tool("datascience", "distribution-diagnostics")
cfg = spec.config_cls.from_yaml("diagnostics.yaml")
workflow = spec.workflow_cls(cfg)
job = submit_workflow(
    workflow, cfg, backend_name=cfg.backend,
    input_ports=tuple(getattr(spec.plugin, "input_ports", ())),
)
result = load_result_for_job(job)
if result is None or result.status != JobStatus.COMPLETED:
    raise RuntimeError(f"Job {job.id} failed; inspect its logs")
print(job.id)
print(result.paths["report_json"])
print(result.metrics["n_total"])

This creates a second job. Local submission waits for the workflow by default; asynchronous or Slurm submission requires checking completion before loading results. Continue with a small pipeline, or consult troubleshooting if a step fails.