@@ -282,14 +282,19 @@ cdef class Jobs(dict):
282282 return jobs
283283
284284 @staticmethod
285- def modify (search_filter , db_connection = None , ** changes ):
285+ def modify (search_filter , Job changes , db_connection = None ):
286286 """ Modify Slurm database Jobs.
287287
288288 Implements the slurm_job_modify RPC.
289289
290290 Args:
291291 search_filter (Union[pyslurm.db.JobSearchFilter, pyslurm.db.Jobs]):
292292 A filter to decide which Jobs should be modified.
293+ changes (pyslurm.db.Job):
294+ Another [pyslurm.db.Job][] object that contains all the
295+ changes to apply. Check the `Other Parameters` of the
296+ [pyslurm.db.Job][] class to see which properties can be
297+ modified.
293298 db_connection (pyslurm.db.Connection):
294299 A Connection to the slurmdbd. By default, if no connection is
295300 supplied, one will automatically be created internally. This
@@ -306,25 +311,21 @@ cdef class Jobs(dict):
306311 be committed or rolled back by using the respective methods on
307312 the connection object. This way, you have a chance to see
308313 which Jobs were modified before you commit the changes.
309- **changes (Any):
310- Check the `Other Parameters` Section of [pyslurm.db.Job][] to
311- see what attributes can be modified.
312314
313315 Returns:
314316 (list[int]): A list of Jobs that were modified
315317
316318 Raises:
317- ValueError: When a parsing error occured or the Database
318- connection is not open
319319 RPCError: When a failure modifying the Jobs occurred.
320320
321321 Examples:
322322 In its simplest form, you can do something like this:
323323
324324 >>> import pyslurm
325+ >>>
325326 >>> search_filter = pyslurm.db.JobSearchFilter(ids=[9999])
326- >>> modified_jobs = pyslurm.db.Jobs.modify(
327- ... search_filter, comment="A comment for the job" )
327+ >>> changes = pyslurm.db.Job(comment="A comment for the job")
328+ >>> modified_jobs = pyslurm.db.Jobs.modify( search_filter, changes )
328329 >>> print(modified_jobs)
329330 >>> [9999]
330331
@@ -334,11 +335,13 @@ cdef class Jobs(dict):
334335 connection object:
335336
336337 >>> import pyslurm
337- >>> search_filter = pyslurm.db.JobSearchFilter(ids=[9999])
338+ >>>
338339 >>> db_conn = pyslurm.db.Connection.open()
340+ >>> search_filter = pyslurm.db.JobSearchFilter(ids=[9999])
341+ >>> changes = pyslurm.db.Job(comment="A comment for the job")
339342 >>> modified_jobs = pyslurm.db.Jobs.modify(
340- ... search_filter, db_conn,
341- ... comment="A comment for the job")
343+ ... search_filter, changes, db_conn)
344+ >>>
342345 >>> # Now you can first examine which Jobs have been modified
343346 >>> print(modified_jobs)
344347 >>> [9999]
@@ -348,7 +351,7 @@ cdef class Jobs(dict):
348351 """
349352
350353 cdef:
351- Job job = Job( ** changes)
354+ Job job = < Job> changes
352355 JobSearchFilter jfilter
353356 Connection conn = < Connection> db_connection
354357 SlurmList response
@@ -499,23 +502,25 @@ cdef class Job:
499502
500503 return out
501504
502- def modify (self , db_connection = None , ** changes ):
505+ def modify (self , changes , db_connection = None ):
503506 """ Modify a Slurm database Job.
504507
505508 Args:
509+ changes (pyslurm.db.Job):
510+ Another [pyslurm.db.Job][] object that contains all the
511+ changes to apply. Check the `Other Parameters` of the
512+ [pyslurm.db.Job][] class to see which properties can be
513+ modified.
506514 db_connection (pyslurm.db.Connection):
507515 A slurmdbd connection. See
508516 [pyslurm.db.Jobs.modify][pyslurm.db.job.Jobs.modify] for more
509- info
510- **changes (Any):
511- Check the `Other Parameters` Section of this class to see what
512- attributes can be modified.
517+ info on this parameter.
513518
514519 Raises:
515520 RPCError: When modifying the Job failed.
516521 """
517522 cdef JobSearchFilter jfilter = JobSearchFilter(ids = [self .id])
518- Jobs.modify(jfilter, db_connection, ** changes )
523+ Jobs.modify(jfilter, changes, db_connection )
519524
520525 @property
521526 def account (self ):
0 commit comments