Skip to main content

haps-plugin-scheduler-runtime

The maintainer's half of the HAPS scheduler plugin. It runs HAPS jobs on an HPC centre by submitting them to Slurm over SSH, with your account on that centre — the users who submit the jobs need none.

pip install haps-plugin-scheduler-runtime

What it does for you

For every job, SchedulerJob goes through:

connect → setup directories → fetch arguments → fetch ebuffer inputs
        → stage script → execute → push results → push ebuffer outputs

It creates a directory per job on the centre, writes the batch script, submits it, follows it with squeue / sacct, publishes Slurm's state on the HAPS job, cancels the Slurm job if the HAPS job is cancelled, and saves Slurm's stdout and stderr in buffers when the job ends.

What it cannot know is your application: what to run, and which files go in and out. That is the part you write.

1. Describe the centre and the resources

[hpc]
host         = "idris-ssh"                        # an entry of your ~/.ssh/config
user         = "abc1234"
passfile     = "/home/me/.vault/idris"            # chmod 600
workdir_root = "/path/on/the/centre/haps/run"     # written out in full, no $VARIABLE

[resources]
account       = "abc@cpu"
target        = "cpu_p1"                          # the partition
time          = "00:30:00"
nodes         = 1
ntasks        = 4
modules       = ["gromacs/2024.2-mpi"]
poll_interval = 15                                # seconds between two squeue

[hpc] also takes SSH timeouts; [resources] also takes cpus_per_task, qos, environment, and more. Anything misspelled is refused at startup.

2. Write the job

from pathlib import Path
from tempfile import TemporaryDirectory

from haps_plugin_scheduler_runtime import SchedulerJob


class Gromacs(SchedulerJob):
    def script_core(self) -> str:
        """What the batch script runs, after the #SBATCH header and the modules."""
        return f"{self.profile.launch_cmd} gmx_mpi mdrun -s md.tpr -deffnm md"

    def ebinput(self, index: int, name: str, buffer_uuid: str) -> None:
        """One input buffer -> one file in the job's directory on the centre."""
        with TemporaryDirectory() as folder:
            local = Path(folder) / name
            self.client.buffers.get(buffer_uuid).fetch(local)
            self.remotessh.put(local, self.workdir / name)

    def eboutput(self, index: int, name: str, buffer_uuid: str) -> None:
        """One file produced on the centre -> one output buffer."""
        with TemporaryDirectory() as folder:
            self.remotessh.get(self.workdir / name, Path(folder))
            self.client.buffers.get(buffer_uuid).fill(Path(folder) / name)

self.remotessh talks to the centre, self.workdir is this job's own directory there. Never put what a user sent into script_core: it would run under your account.

3. Start the daemon

from haps_plugin_scheduler_runtime import IdrisProfile, SchedulerConfig
from haps_runtime_executor import RuntimeService

config = SchedulerConfig.from_toml("idris.toml", profile=IdrisProfile)
# runtime: your HAPS runtime, found or created with haps_runtime.HapsClient
RuntimeService(runtime, Gromacs, config=config).start()

The profile is the centre: IdrisProfile, CinesProfile or TgccProfile (which speaks ccc_msub rather than sbatch). The same job class runs on all three.

Good to know

  • Dry run is supported: the script is checked with --test-only and nothing runs. Your eboutput is called as usual, on placeholder files.
  • At the end of a job, the job's directory on the centre is removed. Override remove_workdir() to keep it.

Built on haps-runtime-executor and haps-runtime-remotessh.

Metadata

Release files for haps-plugin-scheduler-runtime 0.4.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for haps-plugin-scheduler-runtime 0.4.1
File Size Uploaded Provenance Actions
haps_plugin_scheduler_runtime-0.4.1.tar.gz 19.3 kB Without provenance Details for haps_plugin_scheduler_runtime-0.4.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for haps-plugin-scheduler-runtime 0.4.1
File Interpreter ABI Platform Actions
haps_plugin_scheduler_runtime-0.4.1-py3-none-any.whl Python 3 none any Details for haps_plugin_scheduler_runtime-0.4.1-py3-none-any.whl

Total release size: 40.8 kB

Release files / haps_plugin_scheduler_runtime-0.4.1.tar.gz

Download URL haps_plugin_scheduler_runtime-0.4.1.tar.gz
Size 19.3 kB
Tags Source
SHA-256 checksum
How to use checksums
2d79141dfe8963e40eea14db50106bc0ed42660bc4120a9394e193c61fa5328f
BLAKE2b-256 checksum
How to use checksums
de5a4c96269f606d6a05b42f3b0cf7377fce520ea148705464e46d88f505c768
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / haps_plugin_scheduler_runtime-0.4.1-py3-none-any.whl

Download URL haps_plugin_scheduler_runtime-0.4.1-py3-none-any.whl
Size 21.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f9b42f54ea7d00d2f923598ebe095fa0b453247da519d25e10d743ff0fb0640f
BLAKE2b-256 checksum
How to use checksums
d5c464f0ea325f027f3f9aa786a72e000ce0ed14b59c09df92146782c06f61eb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Security for haps-plugin-scheduler-runtime 0.4.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page