MCPcopy Create free account
hub / github.com/InsForge/InsForge / cmd_log

Function cmd_log

examples/python-ml-experiment-tracker/tracker/cli.py:202–231  ·  view source on GitHub ↗

Log a new experiment run with hyperparameters and metrics.

(
    experiment: str,
    run_name: str | None,
    params: tuple[str, ...],
    metrics: tuple[str, ...],
    notes: str | None,
    started_at: str | None,
    finished_at: str | None,
)

Source from the content-addressed store, hash-verified

200@click.option("--finished-at", default=None, help="ISO-8601 finish time (default: now)")
201@handle_errors
202def cmd_log(
203 experiment: str,
204 run_name: str | None,
205 params: tuple[str, ...],
206 metrics: tuple[str, ...],
207 notes: str | None,
208 started_at: str | None,
209 finished_at: str | None,
210) -> None:
211 """Log a new experiment run with hyperparameters and metrics."""
212 parsed_params = parse_kv_pairs(params)
213 parsed_metrics = parse_kv_pairs(metrics)
214 ts = now_iso()
215 started_at = started_at or ts
216 finished_at = finished_at or ts
217
218 with InsForgeClient() as client:
219 exp = client.get_or_create_experiment(experiment)
220 run = client.create_run(
221 experiment_id=exp.id,
222 experiment_name=exp.name,
223 run_name=run_name,
224 params=parsed_params,
225 metrics=parsed_metrics,
226 notes=notes,
227 started_at=started_at,
228 finished_at=finished_at,
229 )
230
231 _print_run_panel(run)
232
233
234# ── tracker runs ──────────────────────────────────────────────────────────

Callers

nothing calls this directly

Calls 6

InsForgeClientClass · 0.90
parse_kv_pairsFunction · 0.85
now_isoFunction · 0.85
_print_run_panelFunction · 0.85
create_runMethod · 0.80

Tested by

no test coverage detected