Skip to content
Snippets Groups Projects
Commit b0c87cce625d authored by jfp's avatar jfp
Browse files

Update Queue.format_status method, return a comma separated for all flags set

parent e5deb545076b
Branches
No related tags found
No related merge requests found
......@@ -181,7 +181,6 @@
from ovms.ssdef import SS__NOPRIV
from ovms.rtl.lib import format_sogw_prot, get_accnam
from datetime import datetime
import types
VMSError = OSError
......@@ -193,16 +192,16 @@
date = s[:11]
tm = s[12:].strip()
lst = [
'JAN',
'FEB',
'MAR',
'APR',
'MAY',
'JUN',
'JUL',
'AUG',
'SEP',
'OCT',
'NOV',
'DEC',
"JAN",
"FEB",
"MAR",
"APR",
"MAY",
"JUN",
"JUL",
"AUG",
"SEP",
"OCT",
"NOV",
"DEC",
]
......@@ -208,6 +207,6 @@
]
fld = date.split('-')
flt = tm.split(':')
fld = date.split("-")
flt = tm.split(":")
if len(flt[2]) == 2:
micro = 0
elif len(flt[2]) == 4:
......@@ -223,7 +222,7 @@
int(flt[2][:2]),
micro,
)
except:
except Exception:
return None
......@@ -234,5 +233,5 @@
if isinstance(d, str):
return d.encode()
if sub == 0:
subsec = ''
subsec = ""
elif sub == 1:
......@@ -238,3 +237,3 @@
elif sub == 1:
subsec = '.%1d' % (d.microsecond / 100000,)
subsec = ".%1d" % (d.microsecond / 100000,)
elif sub == 2:
......@@ -240,3 +239,3 @@
elif sub == 2:
subsec = '.%02d' % (d.microsecond / 10000,)
subsec = ".%02d" % (d.microsecond / 10000,)
else:
......@@ -242,6 +241,6 @@
else:
raise ValueError('invalid sub value: %s' % (sub,))
return d.strftime('%d-%b-%Y %H:%M:%S' + subsec)
raise ValueError("invalid sub value: %s" % (sub,))
return d.strftime("%d-%b-%Y %H:%M:%S" + subsec)
class Queue(object):
......@@ -296,7 +295,7 @@
executing_job_count: None
form_name: bytes
form_stock: bytes
generic_target: List['Queue'] | None
generic_target: List["Queue"] | None
holding_job_count: int
job_limit: int
job_reset_modules: bytes
......@@ -325,7 +324,7 @@
elif isinstance(arg, bytes):
darg, sec = self._getqui(arg)
else:
raise ValueError('arg should be str or bytes')
raise ValueError("arg should be str or bytes")
self._fill(darg, sec)
def _fill(self, res, sec) -> None:
......@@ -343,9 +342,7 @@
else None
)
self.cpu_limit = (
res[QUI__CPU_LIMIT]
if (self.queue_flags & QUI_M_QUEUE_CPU_LIMIT)
else None
res[QUI__CPU_LIMIT] if (self.queue_flags & QUI_M_QUEUE_CPU_LIMIT) else None
)
self.default_form_name = res[QUI__DEFAULT_FORM_NAME]
self.default_form_stock = res[QUI__DEFAULT_FORM_STOCK]
......@@ -373,8 +370,6 @@
self.scsnode_name = res[QUI__SCSNODE_NAME]
self.timed_release_job_count = res[QUI__TIMED_RELEASE_JOB_COUNT]
self.wsdefault = (
res[QUI__WSDEFAULT]
if (self.queue_flags & QUI_M_QUEUE_WSDEFAULT)
else None
res[QUI__WSDEFAULT] if (self.queue_flags & QUI_M_QUEUE_WSDEFAULT) else None
)
self.wsextent = (
......@@ -379,7 +374,5 @@
)
self.wsextent = (
res[QUI__WSEXTENT]
if (self.queue_flags & QUI_M_QUEUE_WSEXTENT)
else None
res[QUI__WSEXTENT] if (self.queue_flags & QUI_M_QUEUE_WSEXTENT) else None
)
self.wsquota = (
......@@ -384,7 +377,5 @@
)
self.wsquota = (
res[QUI__WSQUOTA]
if (self.queue_flags & QUI_M_QUEUE_WSQUOTA)
else None
res[QUI__WSQUOTA] if (self.queue_flags & QUI_M_QUEUE_WSQUOTA) else None
)
......@@ -389,6 +380,6 @@
)
if self.generic_target == b'':
if self.generic_target == b"":
self.generic_target = None
else:
self.generic_target = [
......@@ -392,7 +383,7 @@
self.generic_target = None
else:
self.generic_target = [
Queue(name) for name in self.generic_target.split(b',')
Queue(name) for name in self.generic_target.split(b",")
] # type: ignore
if sec is not None:
......@@ -430,5 +421,5 @@
not retreived.
"""
if self.owner_uic is None:
return 'Access to security information denied.'
return "Access to security information denied."
try:
......@@ -434,5 +425,5 @@
try:
return '[%s]' % (idtoasc(self.owner_uic)[1].decode(),)
except:
return "[%s]" % (idtoasc(self.owner_uic)[1].decode(),)
except Exception:
high_word = int(self.owner_uic / 65536)
low_word = int(self.owner_uic - (high_word * 65536))
......@@ -437,6 +428,6 @@
high_word = int(self.owner_uic / 65536)
low_word = int(self.owner_uic - (high_word * 65536))
return '[%s, %s]' % (high_word, low_word)
return "[%s, %s]" % (high_word, low_word)
def format_protection(self) -> str:
"""Returns the protection as string, or
......@@ -444,9 +435,9 @@
not retreived.
"""
if self.protection is None:
return 'Access to security information denied.'
accnam = get_accnam(b'QUEUE')[1]
return '(%s)' % (
return "Access to security information denied."
accnam = get_accnam(b"QUEUE")[1]
return "(%s)" % (
format_sogw_prot(self.protection, access_names=accnam)[1].decode(),
)
......@@ -456,13 +447,13 @@
not retreived.
"""
if self.protection is None:
return 'Access to security information denied.'
accnam = get_accnam(b'QUEUE')[1]
v = self.acl if self.acl is not None else b''
acl = ''
while v != b'':
return "Access to security information denied."
accnam = get_accnam(b"QUEUE")[1]
v = self.acl if self.acl is not None else b""
acl = ""
while v != b"":
acl += format_acl(v, accnam=accnam)[1].decode()
v = v[ord(v[0]) :]
return acl
def format_status(self) -> str:
......@@ -464,12 +455,13 @@
acl += format_acl(v, accnam=accnam)[1].decode()
v = v[ord(v[0]) :]
return acl
def format_status(self) -> str:
"""Returns the queue status as string, the returned value is none of:
"""Returns the queue status as string, the returned value is a string
comma separated of the values:
'Aligning', 'Autostart inactive', 'Available', 'Busy',
'Closed', 'Disabled', 'Idle', 'Lowercase', 'Paused',
'Pausing', 'Remote', 'Resetting', 'Resuming', 'Server',
'Stalled', 'Starting', 'Pending', 'Stopped', 'Stopping',
'Unavailable'
"""
......@@ -470,48 +462,36 @@
'Aligning', 'Autostart inactive', 'Available', 'Busy',
'Closed', 'Disabled', 'Idle', 'Lowercase', 'Paused',
'Pausing', 'Remote', 'Resetting', 'Resuming', 'Server',
'Stalled', 'Starting', 'Pending', 'Stopped', 'Stopping',
'Unavailable'
"""
if self.queue_status & QUI_M_QUEUE_ALIGNING:
return 'Aligning'
elif self.queue_status & QUI_M_QUEUE_AUTOSTART_INACTIVE:
return 'Autostart inactive'
elif self.queue_status & QUI_M_QUEUE_AVAILABLE:
return 'Available'
elif self.queue_status & QUI_M_QUEUE_BUSY:
return 'Busy'
elif self.queue_status & QUI_M_QUEUE_CLOSED:
return 'Closed'
elif self.queue_status & QUI_M_QUEUE_DISABLED:
return 'Disabled'
elif self.queue_status & QUI_M_QUEUE_IDLE:
return 'Idle'
elif self.queue_status & QUI_M_QUEUE_LOWERCASE:
return 'Lowercase'
elif self.queue_status & QUI_M_QUEUE_PAUSED:
return 'Paused'
elif self.queue_status & QUI_M_QUEUE_PAUSING:
return 'Pausing'
elif self.queue_status & QUI_M_QUEUE_REMOTE:
return 'Remote'
elif self.queue_status & QUI_M_QUEUE_RESETTING:
return 'Resetting'
elif self.queue_status & QUI_M_QUEUE_RESUMING:
return 'Resuming'
elif self.queue_status & QUI_M_QUEUE_SERVER:
return 'Server'
elif self.queue_status & QUI_M_QUEUE_STALLED:
return 'Stalled'
elif self.queue_status & QUI_M_QUEUE_STARTING:
return 'Starting'
elif self.queue_status & QUI_M_QUEUE_STOP_PENDING:
return 'Pending'
elif self.queue_status & QUI_M_QUEUE_STOPPED:
return 'Stopped'
elif self.queue_status & QUI_M_QUEUE_STOPPING:
return 'Stopping'
elif self.queue_status & QUI_M_QUEUE_UNAVAILABLE:
return 'Unavailable'
else:
st2str = [
(QUI_M_QUEUE_ALIGNING, "Aligning"),
(QUI_M_QUEUE_AUTOSTART_INACTIVE, "Autostart inactive"),
(QUI_M_QUEUE_AVAILABLE, "Available"),
(QUI_M_QUEUE_BUSY, "Busy"),
(QUI_M_QUEUE_CLOSED, "Closed"),
(QUI_M_QUEUE_DISABLED, "Disabled"),
(QUI_M_QUEUE_IDLE, "Idle"),
(QUI_M_QUEUE_LOWERCASE, "Lowercase"),
(QUI_M_QUEUE_PAUSED, "Paused"),
(QUI_M_QUEUE_PAUSING, "Pausing"),
(QUI_M_QUEUE_REMOTE, "Remote"),
(QUI_M_QUEUE_RESETTING, "Resetting"),
(QUI_M_QUEUE_RESUMING, "Resuming"),
(QUI_M_QUEUE_SERVER, "Server"),
(QUI_M_QUEUE_STALLED, "Stalled"),
(QUI_M_QUEUE_STARTING, "Starting"),
(QUI_M_QUEUE_STOP_PENDING, "Pending"),
(QUI_M_QUEUE_STOPPED, "Stopped"),
(QUI_M_QUEUE_STOPPING, "Stopping"),
(QUI_M_QUEUE_UNAVAILABLE, "Unavailable"),
]
lstatus: List[str] = []
queue_status = self.queue_status
for fl, s in st2str:
if queue_status & fl:
lstatus.append(s)
queue_status ^= fl
if queue_status != 0:
raise Exception(
......@@ -517,4 +497,3 @@
raise Exception(
'Unknown Queue status: %s queue %s'
% (self.queue_status, self.queue_name)
"Unknown Queue status: %s queue %s" % (queue_status, self.queue_name)
)
......@@ -520,2 +499,3 @@
)
return ", ".join(lstatus)
......@@ -521,5 +501,5 @@
def jobs(self) -> Generator['Job', None, None]:
def jobs(self) -> Generator["Job", None, None]:
"""Returns a iterator for all jobs in the queue, example:
for job in myqueue.jobs():
print job.job_name
......@@ -527,9 +507,7 @@
qinfo = [
itemList(code=QUI__QUEUE_NAME, dtype=il_string),
itemList(code=QUI__QUEUE_FLAGS, dtype=il_unsignedLong),
itemList(
code=QUI__SEARCH_NAME, value=self.queue_name, dtype=il_string
),
itemList(code=QUI__SEARCH_NAME, value=self.queue_name, dtype=il_string),
itemList(
code=QUI__SEARCH_FLAGS,
value=QUI_M_SEARCH_WILDCARD,
......@@ -549,9 +527,7 @@
# stat, ctxt, res = getquiw(EFN_C_ENF, QUI__CANCEL_OPERATION, -1, qinfo)
ctxt = -1
try:
stat, ctxt, res = getquiw(
EFN_C_ENF, QUI__DISPLAY_QUEUE, ctxt, qinfo
)
stat, ctxt, res = getquiw(EFN_C_ENF, QUI__DISPLAY_QUEUE, ctxt, qinfo)
except VMSError as e:
if e.errno == JBC__NOMOREQUE:
return
......@@ -559,9 +535,7 @@
raise
while True:
try:
stat, ctxt, res = getquiw(
EFN_C_ENF, QUI__DISPLAY_JOB, ctxt, jinfo
)
stat, ctxt, res = getquiw(EFN_C_ENF, QUI__DISPLAY_JOB, ctxt, jinfo)
except VMSError as e:
if e.errno in (JBC__NOMOREJOB, JBC__NOSUCHJOB):
return
......@@ -574,9 +548,7 @@
# what info to get on queue
#
qinfo = Queue.Itm[:]
qinfo.append(
itemList(code=QUI__SEARCH_NAME, value=qname, dtype=il_string)
)
qinfo.append(itemList(code=QUI__SEARCH_NAME, value=qname, dtype=il_string))
# stat, ctxt, res = getquiw(EFN_C_ENF, QUI__CANCEL_OPERATION, -1, qinfo)
ctxt = -1
try:
......@@ -580,11 +552,9 @@
# stat, ctxt, res = getquiw(EFN_C_ENF, QUI__CANCEL_OPERATION, -1, qinfo)
ctxt = -1
try:
stat, ctxt, res = getquiw(
EFN_C_ENF, QUI__DISPLAY_QUEUE, ctxt, qinfo
)
stat, ctxt, res = getquiw(EFN_C_ENF, QUI__DISPLAY_QUEUE, ctxt, qinfo)
except VMSError as e:
if e.errno == JBC__NOMOREQUE:
raise
else:
raise
......@@ -586,12 +556,12 @@
except VMSError as e:
if e.errno == JBC__NOMOREQUE:
raise
else:
raise
accnam = get_accnam(b'QUEUE')[1]
accnam = get_accnam(b"QUEUE")[1]
itm = (
itemList(OSS__ACL_READ),
itemList(OSS__PROTECTION, dtype=il_unsignedWord),
itemList(OSS__OWNER, dtype=il_unsignedLong),
)
try:
......@@ -592,10 +562,10 @@
itm = (
itemList(OSS__ACL_READ),
itemList(OSS__PROTECTION, dtype=il_unsignedWord),
itemList(OSS__OWNER, dtype=il_unsignedLong),
)
try:
s, ctxt, sec = get_security(b'QUEUE', qname, itmlst=itm)
s, ctxt, sec = get_security(b"QUEUE", qname, itmlst=itm)
except VMSError as e:
sec = None
if e.errno != SS__NOPRIV:
......@@ -603,7 +573,7 @@
return res, sec
def requeue_all_jobs(self, destination: 'Queue | bytes') -> int:
def requeue_all_jobs(self, destination: "Queue | bytes") -> int:
"""Requeues all jobs in the queue to the queue specified by
the parameter destination. The execution of current jobs is unaffected.
"""
......@@ -612,12 +582,10 @@
destination = destination.queue_name
lst = (
itemList(SJC__QUEUE, value=self.queue_name, dtype=il_string),
itemList(
SJC__DESTINATION_QUEUE, value=destination, dtype=il_string
),
itemList(SJC__DESTINATION_QUEUE, value=destination, dtype=il_string),
)
s = sndjbcw(func=SJC__MERGE_QUEUE, itmlst=lst)[0]
return s
def generate_qualifier(self) -> Generator[str, None, None]:
if self.autostart_on:
......@@ -618,9 +586,9 @@
)
s = sndjbcw(func=SJC__MERGE_QUEUE, itmlst=lst)[0]
return s
def generate_qualifier(self) -> Generator[str, None, None]:
if self.autostart_on:
yield f'/autostart_on=({self.autostart_on.decode()})'
yield f'/base_priority={self.base_priority}'
yield f"/autostart_on=({self.autostart_on.decode()})"
yield f"/base_priority={self.base_priority}"
if self.cpu_default:
......@@ -626,3 +594,3 @@
if self.cpu_default:
yield f'/cpu_default={self.cpu_default}'
yield f"/cpu_default={self.cpu_default}"
if self.cpu_limit:
......@@ -628,4 +596,4 @@
if self.cpu_limit:
yield f'/cpumaximum={self.cpu_limit}'
yield f"/cpumaximum={self.cpu_limit}"
yield f'/description="{self.queue_description.decode()}"'
if self.job_size_minimum and self.job_size_maximum:
......@@ -630,4 +598,4 @@
yield f'/description="{self.queue_description.decode()}"'
if self.job_size_minimum and self.job_size_maximum:
yield f'/block_limit=({self.job_size_minimum},{self.job_size_maximum})'
yield f"/block_limit=({self.job_size_minimum},{self.job_size_maximum})"
elif self.job_size_maximum:
......@@ -633,5 +601,5 @@
elif self.job_size_maximum:
yield f'/block_limit=({self.job_size_maximum})'
yield f"/block_limit=({self.job_size_maximum})"
elif self.job_size_minimum:
yield f'/block_limit=({self.job_size_minimum},"")'
if self.is_printer():
......@@ -635,5 +603,5 @@
elif self.job_size_minimum:
yield f'/block_limit=({self.job_size_minimum},"")'
if self.is_printer():
yield '/device=printer'
yield "/device=printer"
elif self.is_server():
......@@ -639,3 +607,3 @@
elif self.is_server():
yield '/device=server'
yield "/device=server"
elif self.is_terminal():
......@@ -641,3 +609,3 @@
elif self.is_terminal():
yield '/device=terminal'
yield "/device=terminal"
if self.queue_flags & QUI_M_QUEUE_SWAP == 0:
......@@ -643,3 +611,3 @@
if self.queue_flags & QUI_M_QUEUE_SWAP == 0:
yield '/disable_swapping'
yield "/disable_swapping"
if self.queue_flags & QUI_M_QUEUE_GENERIC_SELECTION == 0:
......@@ -645,3 +613,3 @@
if self.queue_flags & QUI_M_QUEUE_GENERIC_SELECTION == 0:
yield '/noenable_generic'
yield "/noenable_generic"
if self.form_name:
......@@ -647,6 +615,6 @@
if self.form_name:
yield f'/form_mounted={self.form_name.decode()}'
yield f"/form_mounted={self.form_name.decode()}"
if self.is_generic():
if self.generic_target:
yield f"/generic=({','.join([q.queue_name.decode() for q in self.generic_target])})"
else:
......@@ -649,6 +617,6 @@
if self.is_generic():
if self.generic_target:
yield f"/generic=({','.join([q.queue_name.decode() for q in self.generic_target])})"
else:
yield '/generic'
yield "/generic"
if self.is_batch():
......@@ -654,3 +622,3 @@
if self.is_batch():
yield f'/job_limit={self.job_limit}'
yield f"/job_limit={self.job_limit}"
if self.device_name:
......@@ -656,5 +624,5 @@
if self.device_name:
yield f'/on={self.device_name.decode()}'
yield f'/own={self.format_UIC()}'
yield f'/protection={self.format_protection()}'
yield f"/on={self.device_name.decode()}"
yield f"/own={self.format_UIC()}"
yield f"/protection={self.format_protection()}"
if self.processor:
......@@ -660,3 +628,3 @@
if self.processor:
yield f'/processor={self.processor.decode()}'
yield f"/processor={self.processor.decode()}"
if not self.is_batch() and not self.queue_flags & QUI_M_QUEUE_JOB_SIZE_SCHED:
......@@ -662,4 +630,4 @@
if not self.is_batch() and not self.queue_flags & QUI_M_QUEUE_JOB_SIZE_SCHED:
yield '/SCHEDULE=NOSIZE'
yield "/SCHEDULE=NOSIZE"
if self.is_batch():
if self.wsdefault is not None:
......@@ -664,4 +632,4 @@
if self.is_batch():
if self.wsdefault is not None:
yield f'/WSDEFAULT={self.wsdefault}'
yield f"/WSDEFAULT={self.wsdefault}"
if self.wsquota is not None:
......@@ -667,3 +635,3 @@
if self.wsquota is not None:
yield f'/WSQUOTA={self.wsquota}'
yield f"/WSQUOTA={self.wsquota}"
if self.wsextent is not None:
......@@ -669,4 +637,4 @@
if self.wsextent is not None:
yield f'/WSEXTEND={self.wsextent}'
yield f"/WSEXTEND={self.wsextent}"
# /characteristics, /default /initial_ff not yet implemented
......@@ -671,5 +639,5 @@
# /characteristics, /default /initial_ff not yet implemented
def string_initialize(self, separator=' ') -> str:
def string_initialize(self, separator=" ") -> str:
"""Return the DCL initialize command to create this queue"""
lst = [
......@@ -674,5 +642,5 @@
"""Return the DCL initialize command to create this queue"""
lst = [
f'initialize/queue {self.queue_name.decode()}:',
f"initialize/queue {self.queue_name.decode()}:",
]
if self.is_batch():
......@@ -677,8 +645,8 @@
]
if self.is_batch():
lst.append('/batch')
lst.append("/batch")
for qual in self.generate_qualifier():
lst.append(qual)
return separator.join(lst)
@staticmethod
......@@ -680,9 +648,9 @@
for qual in self.generate_qualifier():
lst.append(qual)
return separator.join(lst)
@staticmethod
def from_name(name) -> 'Queue':
def from_name(name) -> "Queue":
"""Static method, returns a Queue object using the queue name."""
qinfo = [
itemList(code=QUI__SEARCH_NAME, value=name, dtype=il_string),
......@@ -700,7 +668,7 @@
qinfo = [
itemList(code=QUI__QUEUE_NAME, dtype=il_string),
itemList(code=QUI__QUEUE_FLAGS, dtype=il_unsignedLong),
itemList(code=QUI__SEARCH_NAME, value=b'*', dtype=il_string),
itemList(code=QUI__SEARCH_NAME, value=b"*", dtype=il_string),
]
if searchFlags is not None:
......@@ -718,9 +686,7 @@
# Get queues until you drop
while True:
try:
stat, ctxt, res = getquiw(
EFN_C_ENF, QUI__DISPLAY_QUEUE, ctxt, qinfo
)
stat, ctxt, res = getquiw(EFN_C_ENF, QUI__DISPLAY_QUEUE, ctxt, qinfo)
except VMSError as e:
if e.errno in (JBC__NOMOREQUE, JBC__NOSUCHQUE):
return
......@@ -821,7 +787,7 @@
wsdefault: bytes
wsextent: bytes
wsquota: bytes
files: List['File']
files: List["File"]
def __init__(self, res: Dict[int, int | str | bytes]) -> None:
self.account_name = res[QUI__ACCOUNT_NAME] # type: ignore
......@@ -889,9 +855,7 @@
def delete(self) -> int:
"""Delete a job from the queue"""
lst = (
itemList(
SJC__ENTRY_NUMBER, value=self.entry_number, dtype=il_signedLong
),
itemList(SJC__ENTRY_NUMBER, value=self.entry_number, dtype=il_signedLong),
itemList(SJC__QUEUE, value=self.queue_name, dtype=il_string),
)
s = sndjbcw(func=SJC__DELETE_JOB, itmlst=lst)[0]
......@@ -902,9 +866,7 @@
sndjbcw (when it successed) and the job completion status.
"""
lst = (
itemList(
SJC__ENTRY_NUMBER, value=self.entry_number, dtype=il_signedLong
),
itemList(SJC__ENTRY_NUMBER, value=self.entry_number, dtype=il_signedLong),
itemList(SJC__JOB_COMPLETION_STATUS, dtype=il_signedLong),
)
s, jcs = sndjbcw(func=SJC__SYNCHRONIZE_JOB, itmlst=lst)
......@@ -923,11 +885,7 @@
]
if requeue is not None:
lst.append(itemList(SJC__REQUEUE, dtype=il_boolean))
lst.append(
itemList(
SJC__DESTINATION_QUEUE, value=requeue, dtype=il_string
)
)
lst.append(itemList(SJC__DESTINATION_QUEUE, value=requeue, dtype=il_string))
s = sndjbcw(func=SJC__ABORT_JOB, itmlst=lst)[0] # type: ignore
return s
......@@ -931,9 +889,7 @@
s = sndjbcw(func=SJC__ABORT_JOB, itmlst=lst)[0] # type: ignore
return s
def alter(
self, queue: Queue | None = None, hold: bool | None = None
) -> int:
def alter(self, queue: Queue | None = None, hold: bool | None = None) -> int:
"""Alters the parameters of an existing job that is not currently
executing.
Currently, only the queue and the hold parameter can be updated.
......@@ -944,9 +900,7 @@
itemList(SJC__QUEUE, value=self.queue_name, dtype=il_string),
]
if queue is not None:
lst.append(
itemList(SJC__DESTINATION_QUEUE, value=queue, dtype=il_string)
)
lst.append(itemList(SJC__DESTINATION_QUEUE, value=queue, dtype=il_string))
if hold is not None:
if hold:
lst.append(itemList(SJC__HOLD, dtype=il_boolean))
......@@ -962,5 +916,5 @@
'Timed release'
"""
if self.job_status & QUI_M_JOB_ABORTING:
return 'Aborting'
return "Aborting"
elif self.job_status & QUI_M_JOB_EXECUTING:
......@@ -966,3 +920,3 @@
elif self.job_status & QUI_M_JOB_EXECUTING:
return 'Executing'
return "Executing"
elif self.job_status & QUI_M_JOB_HOLDING:
......@@ -968,3 +922,3 @@
elif self.job_status & QUI_M_JOB_HOLDING:
return 'Holding'
return "Holding"
elif self.job_status & QUI_M_JOB_INACCESSIBLE:
......@@ -970,3 +924,3 @@
elif self.job_status & QUI_M_JOB_INACCESSIBLE:
return 'Inaccessible'
return "Inaccessible"
elif self.job_status & QUI_M_JOB_PENDING:
......@@ -972,3 +926,3 @@
elif self.job_status & QUI_M_JOB_PENDING:
return 'Pending'
return "Pending"
elif self.job_status & QUI_M_JOB_REFUSED:
......@@ -974,3 +928,3 @@
elif self.job_status & QUI_M_JOB_REFUSED:
return 'Refused'
return "Refused"
elif self.job_status & QUI_M_JOB_RETAINED:
......@@ -976,3 +930,3 @@
elif self.job_status & QUI_M_JOB_RETAINED:
return 'Retained'
return "Retained"
elif self.job_status & QUI_M_JOB_STALLED:
......@@ -978,3 +932,3 @@
elif self.job_status & QUI_M_JOB_STALLED:
return 'Stalled'
return "Stalled"
elif self.job_status & QUI_M_JOB_STARTING:
......@@ -980,3 +934,3 @@
elif self.job_status & QUI_M_JOB_STARTING:
return 'Starting'
return "Starting"
elif self.job_status & QUI_M_JOB_SUSPENDED:
......@@ -982,3 +936,3 @@
elif self.job_status & QUI_M_JOB_SUSPENDED:
return 'Suspended'
return "Suspended"
elif self.job_status & QUI_M_JOB_TIMED_RELEASE:
......@@ -984,4 +938,4 @@
elif self.job_status & QUI_M_JOB_TIMED_RELEASE:
return 'Timed release'
return "Timed release"
else:
raise Exception(
......@@ -986,6 +940,5 @@
else:
raise Exception(
'Unknown Job status: %s Entry %s'
% (self.job_status, self.entry_number)
"Unknown Job status: %s Entry %s" % (self.job_status, self.entry_number)
)
......@@ -990,6 +943,6 @@
)
def _files(self) -> Generator['File', None, None]:
def _files(self) -> Generator["File", None, None]:
"""Returns a iterator for all files in the job.
Used in the __init__ function
"""
......@@ -1012,9 +965,7 @@
finfo = File.Itm
while True:
try:
stat, ctxt, res = getquiw(
EFN_C_ENF, QUI__DISPLAY_FILE, ctxt, finfo
)
stat, ctxt, res = getquiw(EFN_C_ENF, QUI__DISPLAY_FILE, ctxt, finfo)
except VMSError as e:
if e.errno in (JBC__NOMOREFILE, JBC__NOSUCHFILE):
break
......@@ -1023,7 +974,7 @@
yield File(res)
@staticmethod
def from_entry(entry) -> 'Job':
def from_entry(entry) -> "Job":
"""Static method, returns a Job object using the job entry."""
jinfo = Job.Itm[:]
jinfo.append(
......@@ -1027,9 +978,7 @@
"""Static method, returns a Job object using the job entry."""
jinfo = Job.Itm[:]
jinfo.append(
itemList(
code=QUI__SEARCH_NUMBER, value=entry, dtype=il_unsignedLong
)
itemList(code=QUI__SEARCH_NUMBER, value=entry, dtype=il_unsignedLong)
)
ctxt = None
stat, ctxt, res = getquiw(EFN_C_ENF, QUI__DISPLAY_ENTRY, ctxt, jinfo)
......@@ -1076,5 +1025,5 @@
'', 'Checkpointed', 'Executing'
"""
if self.status == 0:
return ''
return ""
elif self.status & QUI_M_FILE_CHECKPOINTED:
......@@ -1080,3 +1029,3 @@
elif self.status & QUI_M_FILE_CHECKPOINTED:
return 'Checkpointed'
return "Checkpointed"
elif self.status & QUI_M_FILE_EXECUTING:
......@@ -1082,4 +1031,4 @@
elif self.status & QUI_M_FILE_EXECUTING:
return 'Executing'
return "Executing"
else:
raise Exception(
......@@ -1084,5 +1033,4 @@
else:
raise Exception(
'Unknown File status: %s File %s'
% (self.status, self.specification)
"Unknown File status: %s File %s" % (self.status, self.specification)
)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment