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 kept, with everything it produced. Nothing is deleted: clear workdir_root yourself before it fills your quota.

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

Metadata

Release files for haps-plugin-scheduler-runtime 0.5.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.5.1
File Size Uploaded Provenance Actions
haps_plugin_scheduler_runtime-0.5.1.tar.gz 19.2 kB Without provenance Details for haps_plugin_scheduler_runtime-0.5.1.tar.gz

Built distribution (wheel)

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

Total release size: 40.6 kB

Release files / haps_plugin_scheduler_runtime-0.5.1.tar.gz

Download URL haps_plugin_scheduler_runtime-0.5.1.tar.gz
Size 19.2 kB
Tags Source
SHA-256 checksum
How to use checksums
9ebef606d4159b26128e669060903b33c18c70eada60b9fdd73948946d8ef8c8
BLAKE2b-256 checksum
How to use checksums
117a37d7e3aee9984cc294f18e3f0d9d591f2b772d50692caad5d5c723a49276
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.5.1-py3-none-any.whl

Download URL haps_plugin_scheduler_runtime-0.5.1-py3-none-any.whl
Size 21.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
98cc62a8a4f04d14a4435af695886f3886b020b721b4c908b904deb1c329f207
BLAKE2b-256 checksum
How to use checksums
1d53d68cf3f68d650e64db6be528fcb96b2216ae1f8ffdcb511663562f7a22e4
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.5.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