(LOGO.JPG) Python for OpenVMS

(go to: table of contents, index, list of vms_sys, prev: SETEF, next: SETPRN)


SETPRI - Set Priority


Changes the base priority of the process. The base priority is used to determine the order in which executable processes are to run.

@@ SETPRI - Argument 4 not tested yet (23-MAY-1998) on OpenVMS Alpha.

Format:

    targpid, previous_priority, previous_policy = vms_sys.setpri \
        ([pid], [prcnam], priority [, policy])
Returns:
targpid
Process identification of process for which the priority has been changed.
The targed PID (targpid) is always returned - it is as if you have specified a '0' value for the 'pidadr' argument. If an error happens, then vms_sys.setpri() raises a Python exception.
previous_priority
Previous process base priority.
previous_policy
Previous process policy (Alpha only - on VAX the function always returns 0 for consistency).
Arguments:
pid
Process identification of the process for which the priority and / or policy is to be changed and / or retrieved.
prcnam
Process name of the process for which the priority and / or policy is to be changed and / or retrieved.
priority
New base priority for the target process.
policy
New scheduling policy for the target process.
(Alpha only - this argument is ignored on VAX)
Examples:
>>> import vms_sys

>>> # lower priority using explicit PID
>>> print vms_sys.setpri (91,None,3)
(91, 4, 0)

>>> # set back old priority using default PID
>>> vms_sys.setpri (0,None,4)
(91, 3, 0)

>>> vms_sys.setpri (None,None,3)
(91, 4, 0)

>>> vms_sys.setpri (None,"TARG_PRC",3)
(93, 4, 0)
 ^^ <-- PID of target process returned even if name was given

>>> vms_sys.setpri ()
Traceback (innermost last):
  File "<stdin>", line 1, in ?
TypeError: function requires at least 3 arguments; 0 given

>>> vms_sys.setpri (0,None)
Traceback (innermost last):
  File "<stdin>", line 1, in ?
TypeError: function requires at least 3 arguments; 2 given

>>> vms_sys.setpri (1,2,3)
Traceback (innermost last):
  File "<stdin>", line 1, in ?
TypeError: argument 2: expected read-only buffer, int found

>>> nonexist_pid = 9999
>>> vms_sys.setpri (nonexist_pid,None,4)
Traceback (innermost last):
  File "<stdin>", line 1, in ?
vms_sys.error: (2280, '%SYSTEM-W-NONEXPR, nonexistent process')

>>> vms_sys.setpri (None,'NONEXPRC',4)
Traceback (innermost last):
  File "<stdin>", line 1, in ?
vms_sys.error: (2280, '%SYSTEM-W-NONEXPR, nonexistent process')

>>> vms_sys.setpri (__name__,'X',4)
Traceback (innermost last):
  File "<stdin>", line 1, in ?
TypeError: argument 1: pidadr - must be integer or None
>>>

(go to: table of contents, index, list of vms_sys, prev: SETEF, next: SETPRN)

28-SEP-1998 ZE.