Introduction
PySlurm (aka SlurPy) is a Python/Pyrex
module to allow access to the Simple Linux Utility for Resource Management (SLURM).
Example Code
Below is a PySlurm example that calls some simple slurm API functions.
>>> from pyslurm import *
>>> print slurm_api_version()
(10, 0, 0)
>>> print slurm_strerror(2000)
Invalid partition name specified
>>> err_code, part_ptr = slurm_load_partitions()
>>> slurm_print_partition_info_msg(part_ptr)
Partition data as of 12/28-18:07:28, record count 1
PartitionName=debug TotalNodes=1 TotalCPUs=1 RootOnly=NO
Default=YES Shared=NO State=UP MaxTime=UNLIMITED Hidden=NO
MinNodes=1 MaxNodes=UNLIMITED AllowGroups=ALL
Nodes=makalu NodeIndices=0-0
>>> slurm_free_partition_info_msg(part_ptr)
>>> err_code, job_ptr = slurm_load_jobs()
>>> slurm_print_job_info_msg(job_ptr)
Job data as of 12/28-18:02:25, record count 1
JobId=5 UserId=mark(1002) GroupId=users(100)
Name=myscript
Priority=4294901756 Partition=debug BatchFlag=1
AllocNode:Sid=makalu:23482 TimeLimit=UNLIMITED ExitCode=0:0
JobState=SUSPENDED StartTime=11/10-20:10:36 EndTime=NONE
NodeList=makalu NodeListIndices=0-0
AllocCPUs=1
ReqProcs=1 ReqNodes=1 ReqS:C:T=0
Shared=0 Contiguous=0 CPUs/task=0
MinProcs=0 MinSockets=0 MinCores=0 MinThreads=0
MinMemory=0 MinTmpDisk=0 Features=(null)
Dependency=0 Account=(null) Reason=None Network=(null)
ReqNodeList=(null) ReqNodeListIndices=
ExcNodeList=(null) ExcNodeListIndices=
SubmitTime=11/10-20:10:36 SuspendTime=11/10-21:17:02 PreSusTime=171
>>> slurm_free_job_info_msg(job_ptr)
Last modified 28th December 2006
|