Skip to content

Commit 937648c

Browse files
fix(cli): keep metadata generation non-fatal in init/run
1 parent b593e8e commit 937648c

2 files changed

Lines changed: 28 additions & 14 deletions

File tree

concore_cli/commands/init.py

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,16 +89,25 @@ def init_project(name, template, console):
8989
with open(readme_file, "w") as f:
9090
f.write(README_TEMPLATE.format(project_name=name))
9191

92-
metadata_path = write_study_metadata(
93-
project_path, generated_by="concore init", workflow_file=workflow_file
94-
)
92+
metadata_info = ""
93+
try:
94+
metadata_path = write_study_metadata(
95+
project_path,
96+
generated_by="concore init",
97+
workflow_file=workflow_file,
98+
)
99+
metadata_info = f"Metadata:\n {metadata_path.name}\n\n"
100+
except Exception as exc:
101+
# Metadata is additive, so project creation should still succeed on failure.
102+
console.print(
103+
f"[yellow]Warning:[/yellow] Failed to write study metadata: {exc}"
104+
)
95105

96106
console.print()
97107
console.print(
98108
Panel.fit(
99109
f"[green]✓[/green] Project created successfully!\n\n"
100-
f"Metadata:\n"
101-
f" {metadata_path.name}\n\n"
110+
f"{metadata_info}"
102111
f"Next steps:\n"
103112
f" cd {name}\n"
104113
f" concore validate workflow.graphml\n"

concore_cli/commands/run.py

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -70,18 +70,23 @@ def run_workflow(workflow_file, source, output, exec_type, auto_build, console):
7070
if result.stdout:
7171
console.print(result.stdout)
7272

73-
metadata_path = write_study_metadata(
74-
output_path,
75-
generated_by="concore run",
76-
workflow_file=workflow_path,
77-
)
78-
7973
console.print(
8074
f"[green]✓[/green] Workflow generated in [cyan]{output_path}[/cyan]"
8175
)
82-
console.print(
83-
f"[green]✓[/green] Metadata written to [cyan]{metadata_path}[/cyan]"
84-
)
76+
try:
77+
metadata_path = write_study_metadata(
78+
output_path,
79+
generated_by="concore run",
80+
workflow_file=workflow_path,
81+
)
82+
console.print(
83+
f"[green]✓[/green] Metadata written to [cyan]{metadata_path}[/cyan]"
84+
)
85+
except Exception as exc:
86+
# Metadata is additive, so workflow generation should still succeed on failure.
87+
console.print(
88+
f"[yellow]Warning:[/yellow] Failed to write study metadata for [cyan]{output_path}[/cyan]: {exc}"
89+
)
8590

8691
except subprocess.CalledProcessError as e:
8792
progress.stop()

0 commit comments

Comments
 (0)