Skip to content

Commit

Permalink
Add plot_paths to register_ln2_fill
Browse files Browse the repository at this point in the history
  • Loading branch information
albireox committed Sep 17, 2024
1 parent 6cfea77 commit 4433260
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/lvmapi/routers/spectrographs.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ class RegisterFillPostModel(BaseModel):
json_file: Annotated[str | None, Field(description="Path to the JSON file")]
configuration: Annotated[dict | None, Field(description="Configuration data")]
log_data: Annotated[list[dict] | None, Field(description="Log data in JSON format")]
plot_paths: Annotated[dict[str, str] | None, Field(description="Paths to plots")]


router = APIRouter(prefix="/spectrographs", tags=["spectrographs"])
Expand Down
6 changes: 4 additions & 2 deletions src/lvmapi/tools/spectrograph.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,7 @@ def register_ln2_fill(
json_file: str | None,
configuration: dict | None,
log_data: list[dict] | None,
plot_paths: dict[str, str] | None,
) -> int:
"""Registers LN2 fill data in the database."""

Expand All @@ -408,11 +409,11 @@ def register_ln2_fill(
INSERT INTO {table} (start_time, end_time, purge_start, purge_complete,
fill_start, fill_complete, fail_time, abort_time,
failed, aborted, error, action, log_file, json_file,
configuration, log_data)
configuration, log_data, plot_paths)
VALUES (%(start_time)s, %(end_time)s, %(purge_start)s, %(purge_complete)s,
%(fill_start)s, %(fill_complete)s, %(fail_time)s, %(abort_time)s,
%(failed)s, %(aborted)s, %(error)s, %(action)s, %(log_file)s,
%(json_file)s, %(configuration)s, %(log_data)s)
%(json_file)s, %(configuration)s, %(log_data)s, %(plot_paths)s)
RETURNING pk;
""",
{
Expand All @@ -432,6 +433,7 @@ def register_ln2_fill(
"json_file": json_file,
"configuration": json.dumps(configuration) if configuration else None,
"log_data": json.dumps(log_data) if log_data else None,
"plot_paths": json.dumps(plot_paths) if plot_paths else None,
},
)
conn.commit()
Expand Down

0 comments on commit 4433260

Please sign in to comment.