Skip to content

Jobs

blackfish.server.job

Job dataclass

Bases: ABC

Abstract job class.

LocalJob dataclass

Bases: Job

A light-weight local job dataclass.

LocalJobConfig dataclass

Job configuration for running a service locally.

SlurmJob dataclass

Bases: Job

A light-weight Slurm job dataclass.

cancel() -> None async

Cancel a Slurm job by issuing the scancel command on the remote host.

This method logs a warning if the update fails, but does not raise an exception.

fetch_node() -> Optional[str] async

Attempt to update the job node from Slurm accounting and return the new node (or the current node if the update fails).

This method logs a warning if the update fails, but does not raise an exception.

fetch_port() -> Optional[int] async

Attempt to update the job port and return the new port (or the current port if the update fails)

The job port is stored as a directory in the remote Blackfish home when a port is assigned to a service container.

This method logs a warning if the update fails, but does not raise an exception.

update(verbose: bool = False) -> Optional[str] async

Attempt to update the job state from Slurm accounting and return the new state (or current state if the update fails).

If the job state switches from PENDING or MISSING to RUNNING, also update the job node and port.

This method logs a warning if the update fails, but does not raise an exception.

SlurmJobConfig dataclass

Job configuration for running a service as a Slurm job.

format_state(status: JobState | str | None) -> str

Format job status for display.