{"id":18667265,"url":"https://github.com/killiansheriff/sbatchpy","last_synced_at":"2025-09-02T20:43:04.133Z","repository":{"id":56728788,"uuid":"524269323","full_name":"killiansheriff/SbatchPy","owner":"killiansheriff","description":"A python package that allows easy sbatch job script creation and submissions on hpc clusters, directly from python.","archived":false,"fork":false,"pushed_at":"2023-08-11T21:31:38.000Z","size":34,"stargazers_count":10,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-17T12:32:20.605Z","etag":null,"topics":["bash","hpc","python","sbatch","slurm"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/killiansheriff.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-08-13T01:33:47.000Z","updated_at":"2024-10-08T10:28:49.000Z","dependencies_parsed_at":"2024-11-07T08:39:54.113Z","dependency_job_id":"7001c53e-97a0-4ef7-a3a0-de126a95ee4f","html_url":"https://github.com/killiansheriff/SbatchPy","commit_stats":{"total_commits":6,"total_committers":1,"mean_commits":6.0,"dds":0.0,"last_synced_commit":"0b570d904249f773a988f167afc36d17fbf26f51"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/killiansheriff/SbatchPy","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/killiansheriff%2FSbatchPy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/killiansheriff%2FSbatchPy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/killiansheriff%2FSbatchPy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/killiansheriff%2FSbatchPy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/killiansheriff","download_url":"https://codeload.github.com/killiansheriff/SbatchPy/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/killiansheriff%2FSbatchPy/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273257819,"owners_count":25073532,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-02T02:00:09.530Z","response_time":77,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bash","hpc","python","sbatch","slurm"],"created_at":"2024-11-07T08:37:31.601Z","updated_at":"2025-09-02T20:43:04.120Z","avatar_url":"https://github.com/killiansheriff.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SbatchPy\n![PyPI Version](https://img.shields.io/pypi/v/sbatchpy.svg) ![PyPI Downloads](https://static.pepy.tech/badge/sbatchpy) \n\nA python package that allows easy ``sbatch`` job script creation and submissions on ``hpc clusters``, directly from ``python``. \n\n# Installation\n\n```bash\n# to install latest PyPI release\npip install sbatchpy\n\n# to install latest GitHub commit\npip install --upgrade git+https://github.com/killiansheriff/sbatchpy\n```\n\n# Usage\nAn example on how to run a python script called ``my_script.py`` taking 2 arguments ``var1`` and ``var2`` as inputs, and using the ``base`` environement is provided below. A complete example with outputs can be found [here](examples/).\n\n```python\nfrom sbatchpy import run\n\nconfig = {\n    \"mem\": \"1gb\",\n    \"time\": \"00:01:00\",\n    \"account\": \"myaccount\",\n    \"cpus-per-task\": \"5\",\n    \"partition\": \"shared\",\n    \"ntasks-per-node\": \"1\",\n    \"nodes\": \"1\",\n}\n\nfor var1, var2 in zip([1, 2, 3], [\"A\", \"B\", \"C\"]):\n\n    config[\"job-name\"] = f\"myjob_{var1}var1_{var2}var2.sh\"\n    config[\"output\"] = f\"out/myjob_{var1}var1_{var2}var2.out\"\n    run(\n        config,\n        code=f\"source activate base \\n python my_script.py {var1} {var2}\",\n    )\n\n```\nBy default, sbatchpy will check that ``config[\"output\"]``'s directory folder exists. If it doesn't, you will be notified and the job will not run. \n\nAdditionally, each sbatch submission script is saved inside the ``f\"{os.getcwd()}/.job\"`` folder. Another saving folder can be chosen by passing ``job_directory=my_saving_directory_path`` to the ``run`` function which is responsible of creating the submission script and running it using ``sbatch job_directory/config[\"job-name\"]``.\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkilliansheriff%2Fsbatchpy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkilliansheriff%2Fsbatchpy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkilliansheriff%2Fsbatchpy/lists"}