@@ -5546,7 +5546,18 @@ cdef class slurmdb_jobs:
55465546 def get (self , jobids = [], starttime = 0 , endtime = 0 ):
55475547 u """ Get Slurmdb information about some jobs.
55485548
5549- :param jobids: Ids of the jobs to search. [] for any id
5549+ Input formats for start and end times:
5550+ * today or tomorrow
5551+ * midnight, noon, teatime (4PM)
5552+ * HH:MM [AM|PM]
5553+ * MMDDYY or MM/DD/YY or MM.DD.YY
5554+ * YYYY-MM-DD[THH[:MM[:SS]]]
5555+ * now + count [minutes | hours | days | weeks]
5556+ *
5557+ Invalid time input results in message to stderr and return value of
5558+ zero.
5559+
5560+ :param jobids: Ids of the jobs to search. Defaults to all jobs.
55505561 :param starttime: Select jobs eligible after this timestamp
55515562 :param endtime: Select jobs eligible before this timestamp
55525563 :returns: Dictionary whose key is the JOBS ID
@@ -5558,11 +5569,32 @@ cdef class slurmdb_jobs:
55585569 cdef:
55595570 int i = 0
55605571 int listNum = 0
5561- dict J_dict = {}
55625572 int apiError = 0
5573+ dict J_dict = {}
55635574 slurm.List JOBSList
55645575 slurm.ListIterator iters = NULL
55655576
5577+ if jobids:
5578+ self .job_cond.step_list = slurm.slurm_list_create(NULL )
5579+ for _jobid in jobids:
5580+ if isinstance (_jobid, int ) or isinstance (_jobid, long ):
5581+ _jobid = str (_jobid).encode(" UTF-8" )
5582+ else :
5583+ _jobid = _jobid.encode(" UTF-8" )
5584+ slurm.slurm_addto_step_list(self .job_cond.step_list, _jobid)
5585+
5586+ if starttime:
5587+ self .job_cond.usage_start = slurm.slurm_parse_time(starttime, 1 )
5588+ errno = slurm.slurm_get_errno()
5589+ if errno == slurm.ESLURM_INVALID_TIME_VALUE:
5590+ raise ValueError (slurm.slurm_strerror(errno), errno)
5591+
5592+ if endtime:
5593+ self .job_cond.usage_end = slurm.slurm_parse_time(endtime, 1 )
5594+ errno = slurm.slurm_get_errno()
5595+ if errno == slurm.ESLURM_INVALID_TIME_VALUE:
5596+ raise ValueError (slurm.slurm_strerror(errno), errno)
5597+
55665598 JOBSList = slurm.slurmdb_jobs_get(self .db_conn, self .job_cond)
55675599
55685600 if JOBSList is NULL :
0 commit comments