refactor: improve dialog rendering and logging setup for stability and configurability

This commit is contained in:
Shine1i 2026-02-23 20:16:03 +01:00
commit 91cbb0e933
3 changed files with 17 additions and 13 deletions

View file

@ -66,19 +66,8 @@ def run_job_process(
event_queue.put({"type": "job.started", "ts": time.time()})
try:
# Importing data_designer.interface.* triggers DataDesigner logging setup (it clears root handlers),
# so attach our queue handler after that import.
from data_designer.config.run_config import RunConfig
import data_designer.interface.data_designer # noqa: F401
handler = _QueueLogHandler(event_queue)
handler.setLevel(logging.INFO)
root = logging.getLogger()
root.addHandler(handler)
root.setLevel(logging.INFO)
logging.getLogger("data_designer").setLevel(logging.INFO)
rows = int(run.get("rows") or 1000)
dataset_name = str(run.get("dataset_name") or "dataset")
artifact_path_raw = run.get("artifact_path")
@ -90,6 +79,15 @@ def run_job_process(
builder = build_config_builder(recipe)
designer = create_data_designer(recipe, artifact_path=artifact_path)
# DataDesigner configures root logging in DataDesigner.__init__.
# Attach queue logger directly to `data_designer` so parser events survive root resets.
handler = _QueueLogHandler(event_queue)
handler.setLevel(logging.INFO)
data_designer_logger = logging.getLogger("data_designer")
data_designer_logger.addHandler(handler)
data_designer_logger.setLevel(logging.INFO)
data_designer_logger.propagate = True
if run_config_raw:
designer.set_run_config(RunConfig.model_validate(run_config_raw))

View file

@ -188,7 +188,12 @@ function parseJobEvent(rawEvent: string): JobEvent | null {
if (dataLines.length === 0) {
return null;
}
const payload = JSON.parse(dataLines.join("\n")) as Record<string, unknown>;
let payload: Record<string, unknown>;
try {
payload = JSON.parse(dataLines.join("\n")) as Record<string, unknown>;
} catch {
return null;
}
return {
event: eventName,
id,

View file

@ -18,6 +18,7 @@ import { UuidDialog } from "../dialogs/samplers/uuid-dialog";
export function renderBlockDialog(
config: NodeConfig | null,
open: boolean,
categoryOptions: SamplerConfig[],
modelConfigAliases: string[],
modelProviderOptions: string[],
@ -34,7 +35,7 @@ export function renderBlockDialog(
switch (definition.dialogKey) {
case "seed":
return config.kind === "seed" ? (
<SeedDialog config={config} onUpdate={update} />
<SeedDialog config={config} onUpdate={update} open={open} />
) : null;
case "category":
return config.kind === "sampler" && config.sampler_type === "category" ? (