OpenMAIC-React / eval /shared /run-dir.ts
muthuk1's picture
Add missing files: LICENSE, Dockerfile, .github, tests, e2e, eval, scripts, configs
a0ebf39 verified
import { mkdirSync } from 'fs';
import { join } from 'path';
/**
* Build and create a run directory under `<baseDir>/<sanitized-model>/<timestamp>/`.
* The model string is sanitized by replacing `:` and `/` with `-` so it is
* safe to use as a directory name. Timestamp is ISO-8601 with colons and dots
* replaced by dashes, truncated to second precision.
*/
export function createRunDir(baseDir: string, model: string): string {
const sanitizedModel = model.replace(/[:/]/g, '-');
const timestamp = new Date().toISOString().replace(/[:.]/g, '-').slice(0, 19);
const runDir = join(baseDir, sanitizedModel, timestamp);
mkdirSync(runDir, { recursive: true });
return runDir;
}