Job¶
See Jobs and executors for command-line and Python examples.
JobRequest¶
Bases: BaseModel
Typed parameters for submitting a project job.
command class-attribute instance-attribute ¶
command: list[str] = Field(
min_length=1,
description="Command as an argv list; each item is one literal argument.",
examples=[
"uv",
"run",
"my_script.py",
"--option",
"value",
],
)
executor class-attribute instance-attribute ¶
executor: Literal[
"local", "slurm", "local-detached", "renku"
] = Field(
default="local-detached",
description="Registered PSI/J executor name.",
)
record_id class-attribute instance-attribute ¶
record_id: str | None = Field(
default=None,
description="Record ID to attribute this job to; omit for no attribution.",
)
executor_url class-attribute instance-attribute ¶
executor_url: str | None = Field(
default=None,
description="Optional URL for the selected executor.",
)
custom_attributes class-attribute instance-attribute ¶
custom_attributes: dict[str, str] | None = Field(
default=None,
description="Optional executor-specific string attributes.",
)
directory class-attribute instance-attribute ¶
directory: str | None = Field(
default=None,
description="Optional working directory for the command.",
)
launcher class-attribute instance-attribute ¶
launcher: str | None = Field(
default=None,
description="Optional registered PSI/J launcher name.",
)
Submission¶
Bases: BaseModel
Validated submission metadata persisted independently of execution.
executor_work_directory class-attribute instance-attribute ¶
from_psi_job classmethod ¶
Copy accepted job metadata without executing or writing anything.
get_psi_job ¶
Attach a native job without waiting, syncing, or saving metadata.
sync ¶
Copy native status, allowing a fresh Slurm attachment time to poll.
logs ¶
Read available stdout and stderr files without observing the job.
cancel ¶
Cancel the native job and persist its resulting status.
load classmethod ¶
Read validated history without contacting an executor.
from_prefix classmethod ¶
Load the unique submission matching a UUID or nonempty prefix.
list classmethod ¶
Read history newest first, warning and continuing past corrupt entries.
Functions¶
get_executor ¶
Create an executor with an explicit auxiliary storage directory.
prepare_job ¶
prepare_job(
command: Sequence[str],
*,
project: Project,
record_id: str | None = None,
env: Mapping[str, str] | None = None,
attributes: JobAttributes | None = None,
resources: ResourceSpec | None = None,
directory: Path | None = None,
launcher: str | None = None,
) -> psij.Job
Construct a native PSI/J job with explicit research attribution.
Does not submit or write project history. Paths and resource requests describe the execution environment.
run_local ¶
Submit locally, stream output, and return the native final status.
Output uses temporary files unless the caller supplied output paths. Records the submission and its final native status in the project.
observe_submission ¶
Return current submission data, saving observations of nonfinal jobs.
Observation failures return UNKNOWN and an error without changing history. Callers own warning reporting; storage failures propagate.