kernelfoundry.gui.utils¶
Utility functions for the NiceGUI frontend, including database queries for jobs, kernels, and tasks.
Functions
|
Archive a job by marking it with a timestamp (soft delete). |
|
Set a job's status to CANCELED. |
|
Get the kernel ID from its UUID. |
|
Check if a job has status VALIDATED. |
|
Retrieve all logs for a job in chronological order. |
|
Retrieve paginated jobs with optional filtering by status and sorting. |
|
Retrieve all unique job names for a given operation/task. |
|
Backward-compatible wrapper: returns all jobs when user_id is empty. |
|
Retrieve a kernel by its ID. |
|
Retrieve all kernels for a specific job. |
|
Retrieve kernels for a specific operation and run name. |
|
Retrieve all unique operation/task names, optionally filtered by user. |
Retrieve reference profiler data and worker info for a job. |
|
|
Retrieve a task by its ID. |
|
Count total non-archived jobs, optionally filtered by status. |
|
Count total jobs for a user, optionally filtered by status. |
- kernelfoundry.gui.utils.get_jobs(statuses: list[str] | None = None, offset: int = 0, limit: int = 10, sort_by: str | None = None, descending: bool = True) list[Job][source]¶
Retrieve paginated jobs with optional filtering by status and sorting.
- kernelfoundry.gui.utils.get_total_jobs(statuses: list[str] | None = None) int[source]¶
Count total non-archived jobs, optionally filtered by status.
- kernelfoundry.gui.utils.get_jobs_by_user(user_id: str, statuses: list[str] | None = None, offset: int = 0, limit: int = 10, sort_by: str | None = None, descending: bool = True) list[Job][source]¶
Backward-compatible wrapper: returns all jobs when user_id is empty.
- kernelfoundry.gui.utils.get_total_jobs_by_user(user_id: str, statuses: list[str] | None = None) int[source]¶
Count total jobs for a user, optionally filtered by status.
- kernelfoundry.gui.utils.archive_job_by_id(job_id: int, requesting_username: str | None = None) bool | None | str[source]¶
Archive a job by marking it with a timestamp (soft delete).
- kernelfoundry.gui.utils.cancel_job_by_id(job_id: int, requesting_username: str | None = None) bool | None | str[source]¶
Set a job’s status to CANCELED.
- Parameters:
job_id – The ID of the job to cancel.
requesting_username – If provided, only cancel if job’s task_origin matches this username.
- Returns:
True if the job was found and canceled (or already canceled), None if the job was not found, “forbidden” if requesting_username does not own the job, or False on a database error.
- kernelfoundry.gui.utils.get_job_is_validate(job_id: int) bool[source]¶
Check if a job has status VALIDATED.
- kernelfoundry.gui.utils.get_job_logs_by_job_id(job_id: int) list[JobLog][source]¶
Retrieve all logs for a job in chronological order.
- kernelfoundry.gui.utils.get_id_by_uuid(uuid: str) int | None[source]¶
Get the kernel ID from its UUID.
- kernelfoundry.gui.utils.get_kernels_by_op_and_run(op: str, name: str, user_id: str | None = None)[source]¶
Retrieve kernels for a specific operation and run name.
- kernelfoundry.gui.utils.get_op_names(user_id: str | None = None) list[str][source]¶
Retrieve all unique operation/task names, optionally filtered by user.
- kernelfoundry.gui.utils.get_jobs_by_op(task_name: str, user_id: str | None = None) list[str][source]¶
Retrieve all unique job names for a given operation/task.
- kernelfoundry.gui.utils.get_kernels_by_job_id(job_id: int)[source]¶
Retrieve all kernels for a specific job.
- kernelfoundry.gui.utils.get_kernel_by_id(kernel_id: int) Kernel | None[source]¶
Retrieve a kernel by its ID.