spectre.tools.Status.Status

Functions

fetch_job_data(fields, user[, allusers, ...])

Query Slurm 'sacct' to get metadata of recent jobs on the machine.

fetch_status([show_deleted, show_all_segments])

Fetches job data and processes it for display.

get_executable_name(comment, input_file_path)

Determine the executable name of a job.

get_input_file(comment, work_dir)

Find the input file corresponding to a job.

input_column_callback(ctx, param, value)

render_status(show_paths, show_unidentified, ...)

spectre.tools.Status.Status.fetch_job_data(fields: Sequence[str], user: str | None, allusers: bool = False, state: str | None = None, starttime: str | None = None) DataFrame

Query Slurm ‘sacct’ to get metadata of recent jobs on the machine.

Parameters:
  • fields – List of Slurm fields that ‘sacct –format’ accepts. Run ‘sacct –helpformat’ to print all available fields.

  • user – Slurm user IDs or names, or None for the current user. See documentation for ‘sacct -u’ for details.

  • allusers – Fetch data for all users. See documentation for ‘sacct -a’ for details.

  • state – Fetch only jobs with this state. See documentation for ‘sacct -s’ for details.

  • starttime – Fetch only jobs after this time. See documentation for ‘sacct -S’ for details.

Returns: Pandas DataFrame with the job data.

spectre.tools.Status.Status.fetch_status(show_deleted=False, show_all_segments=False, **kwargs)

Fetches job data and processes it for display.

See ‘fetch_job_data’ for how jobs are fetched. This function processes the data to make it more human-readable and filters it, e.g. related to deleted jobs and segments.

Parameters:
  • show_deleted – Show jobs that ran in directories that are now deleted. (default: False)

  • show_all_segments – Show all segments as individual jobs instead of just the latest. (default: False)

  • kwargs – Arguments to pass to ‘fetch_job_data’.

Returns: Pandas DataFrame with the job data sorted by JobID (most recently

submitted job first).

spectre.tools.Status.Status.get_executable_name(comment: str | None, input_file_path: str | None) str | None

Determine the executable name of a job.

Parameters:
  • comment – The Slurm comment field. The executable name is extracted from it if it includes a line like “SPECTRE_EXECUTABLE=path/to/executable”.

  • input_file_path – Path to input file. If no executable name was found in the Slurm comment, we try to extract it from the input file.

Returns: Executable name, or None.

spectre.tools.Status.Status.get_input_file(comment: str | None, work_dir: str) str | None

Find the input file corresponding to a job.

Parameters:
  • comment – The Slurm comment field. The input file is extracted from it if it includes a line like “SPECTRE_INPUT_FILE=path/to/input/file”.

  • work_dir – The working directory of the job. If no input file was found in the Slurm comment, we see if there’s a single YAML file in the work dir and assume that’s the input file.

Returns: Path to the input file, or None.

spectre.tools.Status.Status.input_column_callback(ctx, param, value)
spectre.tools.Status.Status.render_status(show_paths, show_unidentified, state_styles, columns, **kwargs)