source: trunk/src/pbs.py @ 144

Last change on this file since 144 was 144, checked in by bas, 17 years ago

Preparing for new release 2.9.4

  • Property svn:keywords set to Id
File size: 20.5 KB
Line 
1# This file was created automatically by SWIG.
2# Don't modify this file, modify the SWIG interface instead.
3# This file is compatible with both classic and new-style classes.
4
5import _pbs
6
7def _swig_setattr_nondynamic(self,class_type,name,value,static=1):
8    if (name == "this"):
9        if isinstance(value, class_type):
10            self.__dict__[name] = value.this
11            if hasattr(value,"thisown"): self.__dict__["thisown"] = value.thisown
12            del value.thisown
13            return
14    method = class_type.__swig_setmethods__.get(name,None)
15    if method: return method(self,value)
16    if (not static) or hasattr(self,name) or (name == "thisown"):
17        self.__dict__[name] = value
18    else:
19        raise AttributeError("You cannot add attributes to %s" % self)
20
21def _swig_setattr(self,class_type,name,value):
22    return _swig_setattr_nondynamic(self,class_type,name,value,0)
23
24def _swig_getattr(self,class_type,name):
25    method = class_type.__swig_getmethods__.get(name,None)
26    if method: return method(self)
27    raise AttributeError,name
28
29import types
30try:
31    _object = types.ObjectType
32    _newclass = 1
33except AttributeError:
34    class _object : pass
35    _newclass = 0
36del types
37
38
39
40new_attrl = _pbs.new_attrl
41
42new_attropl = _pbs.new_attropl
43
44new_batch_status = _pbs.new_batch_status
45
46get_error = _pbs.get_error
47ATTR_a = _pbs.ATTR_a
48ATTR_c = _pbs.ATTR_c
49ATTR_e = _pbs.ATTR_e
50ATTR_g = _pbs.ATTR_g
51ATTR_h = _pbs.ATTR_h
52ATTR_j = _pbs.ATTR_j
53ATTR_k = _pbs.ATTR_k
54ATTR_l = _pbs.ATTR_l
55ATTR_m = _pbs.ATTR_m
56ATTR_o = _pbs.ATTR_o
57ATTR_p = _pbs.ATTR_p
58ATTR_q = _pbs.ATTR_q
59ATTR_r = _pbs.ATTR_r
60ATTR_u = _pbs.ATTR_u
61ATTR_v = _pbs.ATTR_v
62ATTR_A = _pbs.ATTR_A
63ATTR_M = _pbs.ATTR_M
64ATTR_N = _pbs.ATTR_N
65ATTR_S = _pbs.ATTR_S
66ATTR_depend = _pbs.ATTR_depend
67ATTR_inter = _pbs.ATTR_inter
68ATTR_stagein = _pbs.ATTR_stagein
69ATTR_stageout = _pbs.ATTR_stageout
70ATTR_ctime = _pbs.ATTR_ctime
71ATTR_exechost = _pbs.ATTR_exechost
72ATTR_mtime = _pbs.ATTR_mtime
73ATTR_qtime = _pbs.ATTR_qtime
74ATTR_session = _pbs.ATTR_session
75ATTR_euser = _pbs.ATTR_euser
76ATTR_egroup = _pbs.ATTR_egroup
77ATTR_hashname = _pbs.ATTR_hashname
78ATTR_hopcount = _pbs.ATTR_hopcount
79ATTR_security = _pbs.ATTR_security
80ATTR_sched_hint = _pbs.ATTR_sched_hint
81ATTR_substate = _pbs.ATTR_substate
82ATTR_name = _pbs.ATTR_name
83ATTR_owner = _pbs.ATTR_owner
84ATTR_used = _pbs.ATTR_used
85ATTR_state = _pbs.ATTR_state
86ATTR_queue = _pbs.ATTR_queue
87ATTR_server = _pbs.ATTR_server
88ATTR_maxrun = _pbs.ATTR_maxrun
89ATTR_total = _pbs.ATTR_total
90ATTR_comment = _pbs.ATTR_comment
91ATTR_cookie = _pbs.ATTR_cookie
92ATTR_qrank = _pbs.ATTR_qrank
93ATTR_altid = _pbs.ATTR_altid
94ATTR_etime = _pbs.ATTR_etime
95ATTR_aclgren = _pbs.ATTR_aclgren
96ATTR_aclgroup = _pbs.ATTR_aclgroup
97ATTR_aclhten = _pbs.ATTR_aclhten
98ATTR_aclhost = _pbs.ATTR_aclhost
99ATTR_acluren = _pbs.ATTR_acluren
100ATTR_acluser = _pbs.ATTR_acluser
101ATTR_altrouter = _pbs.ATTR_altrouter
102ATTR_chkptmin = _pbs.ATTR_chkptmin
103ATTR_enable = _pbs.ATTR_enable
104ATTR_fromroute = _pbs.ATTR_fromroute
105ATTR_killdelay = _pbs.ATTR_killdelay
106ATTR_maxgrprun = _pbs.ATTR_maxgrprun
107ATTR_maxque = _pbs.ATTR_maxque
108ATTR_maxuserrun = _pbs.ATTR_maxuserrun
109ATTR_qtype = _pbs.ATTR_qtype
110ATTR_rescassn = _pbs.ATTR_rescassn
111ATTR_rescdflt = _pbs.ATTR_rescdflt
112ATTR_rescmax = _pbs.ATTR_rescmax
113ATTR_rescmin = _pbs.ATTR_rescmin
114ATTR_rndzretry = _pbs.ATTR_rndzretry
115ATTR_routedest = _pbs.ATTR_routedest
116ATTR_routeheld = _pbs.ATTR_routeheld
117ATTR_routewait = _pbs.ATTR_routewait
118ATTR_routeretry = _pbs.ATTR_routeretry
119ATTR_routelife = _pbs.ATTR_routelife
120ATTR_rsvexpdt = _pbs.ATTR_rsvexpdt
121ATTR_rsvsync = _pbs.ATTR_rsvsync
122ATTR_start = _pbs.ATTR_start
123ATTR_count = _pbs.ATTR_count
124ATTR_number = _pbs.ATTR_number
125ATTR_reqprop = _pbs.ATTR_reqprop
126ATTR_aclroot = _pbs.ATTR_aclroot
127ATTR_managers = _pbs.ATTR_managers
128ATTR_dfltque = _pbs.ATTR_dfltque
129ATTR_defnode = _pbs.ATTR_defnode
130ATTR_locsvrs = _pbs.ATTR_locsvrs
131ATTR_logevents = _pbs.ATTR_logevents
132ATTR_logfile = _pbs.ATTR_logfile
133ATTR_mailfrom = _pbs.ATTR_mailfrom
134ATTR_nodepack = _pbs.ATTR_nodepack
135ATTR_operators = _pbs.ATTR_operators
136ATTR_queryother = _pbs.ATTR_queryother
137ATTR_resccost = _pbs.ATTR_resccost
138ATTR_rescavail = _pbs.ATTR_rescavail
139ATTR_schedit = _pbs.ATTR_schedit
140ATTR_scheduling = _pbs.ATTR_scheduling
141ATTR_status = _pbs.ATTR_status
142ATTR_syscost = _pbs.ATTR_syscost
143ATTR_pingrate = _pbs.ATTR_pingrate
144ATTR_ndchkrate = _pbs.ATTR_ndchkrate
145ATTR_procpack = _pbs.ATTR_procpack
146ATTR_NODE_state = _pbs.ATTR_NODE_state
147ATTR_NODE_np = _pbs.ATTR_NODE_np
148ATTR_NODE_properties = _pbs.ATTR_NODE_properties
149ATTR_NODE_ntype = _pbs.ATTR_NODE_ntype
150ATTR_NODE_jobs = _pbs.ATTR_NODE_jobs
151CHECKPOINT_UNSPECIFIED = _pbs.CHECKPOINT_UNSPECIFIED
152NO_HOLD = _pbs.NO_HOLD
153NO_JOIN = _pbs.NO_JOIN
154NO_KEEP = _pbs.NO_KEEP
155MAIL_AT_ABORT = _pbs.MAIL_AT_ABORT
156DELDELAY = _pbs.DELDELAY
157USER_HOLD = _pbs.USER_HOLD
158OTHER_HOLD = _pbs.OTHER_HOLD
159SYSTEM_HOLD = _pbs.SYSTEM_HOLD
160ND_free = _pbs.ND_free
161ND_offline = _pbs.ND_offline
162ND_down = _pbs.ND_down
163ND_reserve = _pbs.ND_reserve
164ND_job_exclusive = _pbs.ND_job_exclusive
165ND_job_sharing = _pbs.ND_job_sharing
166ND_busy = _pbs.ND_busy
167ND_state_unknown = _pbs.ND_state_unknown
168ND_timeshared = _pbs.ND_timeshared
169ND_cluster = _pbs.ND_cluster
170MAX_ENCODE_BFR = _pbs.MAX_ENCODE_BFR
171MGR_CMD_CREATE = _pbs.MGR_CMD_CREATE
172MGR_CMD_DELETE = _pbs.MGR_CMD_DELETE
173MGR_CMD_SET = _pbs.MGR_CMD_SET
174MGR_CMD_UNSET = _pbs.MGR_CMD_UNSET
175MGR_CMD_LIST = _pbs.MGR_CMD_LIST
176MGR_CMD_PRINT = _pbs.MGR_CMD_PRINT
177MGR_CMD_ACTIVE = _pbs.MGR_CMD_ACTIVE
178MGR_OBJ_NONE = _pbs.MGR_OBJ_NONE
179MGR_OBJ_SERVER = _pbs.MGR_OBJ_SERVER
180MGR_OBJ_QUEUE = _pbs.MGR_OBJ_QUEUE
181MGR_OBJ_JOB = _pbs.MGR_OBJ_JOB
182MGR_OBJ_NODE = _pbs.MGR_OBJ_NODE
183MSG_OUT = _pbs.MSG_OUT
184MSG_ERR = _pbs.MSG_ERR
185SHUT_SIG = _pbs.SHUT_SIG
186SHUT_IMMEDIATE = _pbs.SHUT_IMMEDIATE
187SHUT_DELAY = _pbs.SHUT_DELAY
188SHUT_QUICK = _pbs.SHUT_QUICK
189SIG_RESUME = _pbs.SIG_RESUME
190SIG_SUSPEND = _pbs.SIG_SUSPEND
191PBS_MAXHOSTNAME = _pbs.PBS_MAXHOSTNAME
192MAXPATHLEN = _pbs.MAXPATHLEN
193MAXNAMLEN = _pbs.MAXNAMLEN
194PBS_MAXUSER = _pbs.PBS_MAXUSER
195PBS_MAXGRPN = _pbs.PBS_MAXGRPN
196PBS_MAXQUEUENAME = _pbs.PBS_MAXQUEUENAME
197PBS_MAXSERVERNAME = _pbs.PBS_MAXSERVERNAME
198PBS_MAXSEQNUM = _pbs.PBS_MAXSEQNUM
199PBS_MAXPORTNUM = _pbs.PBS_MAXPORTNUM
200PBS_MAXSVRJOBID = _pbs.PBS_MAXSVRJOBID
201PBS_MAXCLTJOBID = _pbs.PBS_MAXCLTJOBID
202PBS_MAXDEST = _pbs.PBS_MAXDEST
203PBS_MAXROUTEDEST = _pbs.PBS_MAXROUTEDEST
204PBS_USE_IFF = _pbs.PBS_USE_IFF
205PBS_INTERACTIVE = _pbs.PBS_INTERACTIVE
206PBS_TERM_BUF_SZ = _pbs.PBS_TERM_BUF_SZ
207PBS_TERM_CCA = _pbs.PBS_TERM_CCA
208PBS_BATCH_SERVICE_NAME = _pbs.PBS_BATCH_SERVICE_NAME
209PBS_BATCH_SERVICE_PORT = _pbs.PBS_BATCH_SERVICE_PORT
210PBS_BATCH_SERVICE_NAME_DIS = _pbs.PBS_BATCH_SERVICE_NAME_DIS
211PBS_BATCH_SERVICE_PORT_DIS = _pbs.PBS_BATCH_SERVICE_PORT_DIS
212PBS_MOM_SERVICE_NAME = _pbs.PBS_MOM_SERVICE_NAME
213PBS_MOM_SERVICE_PORT = _pbs.PBS_MOM_SERVICE_PORT
214PBS_MANAGER_SERVICE_NAME = _pbs.PBS_MANAGER_SERVICE_NAME
215PBS_MANAGER_SERVICE_PORT = _pbs.PBS_MANAGER_SERVICE_PORT
216PBS_SCHEDULER_SERVICE_NAME = _pbs.PBS_SCHEDULER_SERVICE_NAME
217PBS_SCHEDULER_SERVICE_PORT = _pbs.PBS_SCHEDULER_SERVICE_PORT
218SET = _pbs.SET
219UNSET = _pbs.UNSET
220INCR = _pbs.INCR
221DECR = _pbs.DECR
222EQ = _pbs.EQ
223NE = _pbs.NE
224GE = _pbs.GE
225GT = _pbs.GT
226LE = _pbs.LE
227LT = _pbs.LT
228DFLT = _pbs.DFLT
229class attrl(_object):
230    __swig_setmethods__ = {}
231    __setattr__ = lambda self, name, value: _swig_setattr(self, attrl, name, value)
232    __swig_getmethods__ = {}
233    __getattr__ = lambda self, name: _swig_getattr(self, attrl, name)
234    def __init__(self): raise RuntimeError, "No constructor defined"
235    def __repr__(self):
236        return "<%s.%s; proxy of C attrl instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,)
237    __swig_setmethods__["name"] = _pbs.attrl_name_set
238    __swig_getmethods__["name"] = _pbs.attrl_name_get
239    if _newclass:name = property(_pbs.attrl_name_get, _pbs.attrl_name_set)
240    __swig_setmethods__["resource"] = _pbs.attrl_resource_set
241    __swig_getmethods__["resource"] = _pbs.attrl_resource_get
242    if _newclass:resource = property(_pbs.attrl_resource_get, _pbs.attrl_resource_set)
243    __swig_setmethods__["value"] = _pbs.attrl_value_set
244    __swig_getmethods__["value"] = _pbs.attrl_value_get
245    if _newclass:value = property(_pbs.attrl_value_get, _pbs.attrl_value_set)
246    __swig_setmethods__["op"] = _pbs.attrl_op_set
247    __swig_getmethods__["op"] = _pbs.attrl_op_get
248    if _newclass:op = property(_pbs.attrl_op_get, _pbs.attrl_op_set)
249    def __str__(*args): return _pbs.attrl___str__(*args)
250
251class attrlPtr(attrl):
252    def __init__(self, this):
253        _swig_setattr(self, attrl, 'this', this)
254        if not hasattr(self,"thisown"): _swig_setattr(self, attrl, 'thisown', 0)
255        _swig_setattr(self, attrl,self.__class__,attrl)
256_pbs.attrl_swigregister(attrlPtr)
257
258class attropl(_object):
259    __swig_setmethods__ = {}
260    __setattr__ = lambda self, name, value: _swig_setattr(self, attropl, name, value)
261    __swig_getmethods__ = {}
262    __getattr__ = lambda self, name: _swig_getattr(self, attropl, name)
263    def __init__(self): raise RuntimeError, "No constructor defined"
264    def __repr__(self):
265        return "<%s.%s; proxy of C attropl instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,)
266    __swig_setmethods__["name"] = _pbs.attropl_name_set
267    __swig_getmethods__["name"] = _pbs.attropl_name_get
268    if _newclass:name = property(_pbs.attropl_name_get, _pbs.attropl_name_set)
269    __swig_setmethods__["resource"] = _pbs.attropl_resource_set
270    __swig_getmethods__["resource"] = _pbs.attropl_resource_get
271    if _newclass:resource = property(_pbs.attropl_resource_get, _pbs.attropl_resource_set)
272    __swig_setmethods__["value"] = _pbs.attropl_value_set
273    __swig_getmethods__["value"] = _pbs.attropl_value_get
274    if _newclass:value = property(_pbs.attropl_value_get, _pbs.attropl_value_set)
275    __swig_setmethods__["op"] = _pbs.attropl_op_set
276    __swig_getmethods__["op"] = _pbs.attropl_op_get
277    if _newclass:op = property(_pbs.attropl_op_get, _pbs.attropl_op_set)
278    def __str__(*args): return _pbs.attropl___str__(*args)
279
280class attroplPtr(attropl):
281    def __init__(self, this):
282        _swig_setattr(self, attropl, 'this', this)
283        if not hasattr(self,"thisown"): _swig_setattr(self, attropl, 'thisown', 0)
284        _swig_setattr(self, attropl,self.__class__,attropl)
285_pbs.attropl_swigregister(attroplPtr)
286
287class batch_status(_object):
288    __swig_setmethods__ = {}
289    __setattr__ = lambda self, name, value: _swig_setattr(self, batch_status, name, value)
290    __swig_getmethods__ = {}
291    __getattr__ = lambda self, name: _swig_getattr(self, batch_status, name)
292    def __init__(self): raise RuntimeError, "No constructor defined"
293    def __repr__(self):
294        return "<%s.%s; proxy of C batch_status instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,)
295    __swig_setmethods__["name"] = _pbs.batch_status_name_set
296    __swig_getmethods__["name"] = _pbs.batch_status_name_get
297    if _newclass:name = property(_pbs.batch_status_name_get, _pbs.batch_status_name_set)
298    __swig_setmethods__["attribs"] = _pbs.batch_status_attribs_set
299    __swig_getmethods__["attribs"] = _pbs.batch_status_attribs_get
300    if _newclass:attribs = property(_pbs.batch_status_attribs_get, _pbs.batch_status_attribs_set)
301    __swig_setmethods__["text"] = _pbs.batch_status_text_set
302    __swig_getmethods__["text"] = _pbs.batch_status_text_get
303    if _newclass:text = property(_pbs.batch_status_text_get, _pbs.batch_status_text_set)
304
305class batch_statusPtr(batch_status):
306    def __init__(self, this):
307        _swig_setattr(self, batch_status, 'this', this)
308        if not hasattr(self,"thisown"): _swig_setattr(self, batch_status, 'thisown', 0)
309        _swig_setattr(self, batch_status,self.__class__,batch_status)
310_pbs.batch_status_swigregister(batch_statusPtr)
311
312RESOURCE_T_NULL = _pbs.RESOURCE_T_NULL
313RESOURCE_T_ALL = _pbs.RESOURCE_T_ALL
314
315avail = _pbs.avail
316
317pbs_asyrunjob = _pbs.pbs_asyrunjob
318
319pbs_alterjob = _pbs.pbs_alterjob
320
321pbs_connect = _pbs.pbs_connect
322
323pbs_query_max_connections = _pbs.pbs_query_max_connections
324
325pbs_default = _pbs.pbs_default
326
327pbs_deljob = _pbs.pbs_deljob
328
329pbs_disconnect = _pbs.pbs_disconnect
330
331pbs_holdjob = _pbs.pbs_holdjob
332
333pbs_locjob = _pbs.pbs_locjob
334
335pbs_manager = _pbs.pbs_manager
336
337pbs_movejob = _pbs.pbs_movejob
338
339pbs_msgjob = _pbs.pbs_msgjob
340
341pbs_orderjob = _pbs.pbs_orderjob
342
343pbs_rescquery = _pbs.pbs_rescquery
344
345pbs_rescreserve = _pbs.pbs_rescreserve
346
347pbs_rescrelease = _pbs.pbs_rescrelease
348
349pbs_rerunjob = _pbs.pbs_rerunjob
350
351pbs_rlsjob = _pbs.pbs_rlsjob
352
353pbs_runjob = _pbs.pbs_runjob
354
355pbs_selectjob = _pbs.pbs_selectjob
356
357pbs_sigjob = _pbs.pbs_sigjob
358
359pbs_statfree = _pbs.pbs_statfree
360
361pbs_statjob = _pbs.pbs_statjob
362
363pbs_selstat = _pbs.pbs_selstat
364
365pbs_statque = _pbs.pbs_statque
366
367pbs_statserver = _pbs.pbs_statserver
368
369pbs_statnode = _pbs.pbs_statnode
370
371pbs_submit = _pbs.pbs_submit
372
373pbs_terminate = _pbs.pbs_terminate
374
375totpool = _pbs.totpool
376
377usepool = _pbs.usepool
378
379openrm = _pbs.openrm
380
381closerm = _pbs.closerm
382
383downrm = _pbs.downrm
384
385configrm = _pbs.configrm
386
387addreq = _pbs.addreq
388
389allreq = _pbs.allreq
390
391flushreq = _pbs.flushreq
392
393activereq = _pbs.activereq
394
395fullresp = _pbs.fullresp
396
397getreq = _pbs.getreq
398LOG_BUF_SIZE = _pbs.LOG_BUF_SIZE
399
400log_close = _pbs.log_close
401
402log_err = _pbs.log_err
403
404log_event = _pbs.log_event
405
406log_open = _pbs.log_open
407
408log_record = _pbs.log_record
409
410setup_env = _pbs.setup_env
411
412chk_file_sec = _pbs.chk_file_sec
413PBSEVENT_ERROR = _pbs.PBSEVENT_ERROR
414PBSEVENT_SYSTEM = _pbs.PBSEVENT_SYSTEM
415PBSEVENT_ADMIN = _pbs.PBSEVENT_ADMIN
416PBSEVENT_JOB = _pbs.PBSEVENT_JOB
417PBSEVENT_JOB_USAGE = _pbs.PBSEVENT_JOB_USAGE
418PBSEVENT_SECURITY = _pbs.PBSEVENT_SECURITY
419PBSEVENT_SCHED = _pbs.PBSEVENT_SCHED
420PBSEVENT_DEBUG = _pbs.PBSEVENT_DEBUG
421PBSEVENT_DEBUG2 = _pbs.PBSEVENT_DEBUG2
422PBSEVENT_FORCE = _pbs.PBSEVENT_FORCE
423PBS_EVENTCLASS_SERVER = _pbs.PBS_EVENTCLASS_SERVER
424PBS_EVENTCLASS_QUEUE = _pbs.PBS_EVENTCLASS_QUEUE
425PBS_EVENTCLASS_JOB = _pbs.PBS_EVENTCLASS_JOB
426PBS_EVENTCLASS_REQUEST = _pbs.PBS_EVENTCLASS_REQUEST
427PBS_EVENTCLASS_FILE = _pbs.PBS_EVENTCLASS_FILE
428PBS_EVENTCLASS_ACCT = _pbs.PBS_EVENTCLASS_ACCT
429PBS_EVENTCLASS_NODE = _pbs.PBS_EVENTCLASS_NODE
430PBSEVENT_MASK = _pbs.PBSEVENT_MASK
431#  PBS python interface
432#  Author: Bas van der Vlies <basv@sara.nl>
433#  Date  : 27 Feb 2002
434#  Desc. : This is python wrapper class for getting the resource
435#          mom values.
436#
437# CVS info
438# $Id: pbs.py 144 2006-11-16 13:35:53Z bas $
439# $Date: 2002/10/21 14:14:47 $
440# $Revision: 1.6 $
441#
442import string
443import types
444
445# Default linux resources to get from the mom
446#
447default_linux_res = [   
448        "availmem",     # available memory size in KB
449        "ideal_load",   # static ideal_load value
450        "loadave",      # the current load average
451        "max_load",     # static max_load value
452        "ncpus",        # number of cpus
453        "physmem",      # physical memory size in KB
454        "resi",         # resident memory size for a pid or session in KB
455        "totmem",       # total memory size in KB
456        "walltime",     # wall clock time for a pid
457]
458
459# Default irix6 resources to get from the mom
460#
461default_irix6_res = [   
462        "availmem",     # available memory size in KB
463        "loadave",      # the current load average
464        "ncpus",        # number of cpus
465        "physmem",      # physical memory size in KB
466        "resi",         # resident memory size for a pid or session in KB
467        "walltime",     # wall clock time for a pid
468        "quota",        # quota information (sizes in KB)
469]
470
471default_mom_res = [   
472        "arch",         # the architecture of the machine
473        "uname",        # the architecture of the machine
474        "cput",         # cpu time for a pid or session
475        "idletime",     # seconds of idle time
476        "mem",          # memory size for a pid or session in KB
477        "sessions",     # list of sessions in the system
478        "pids",         # list of pids in a session
479        "nsessions",    # number of sessions in the system
480        "nusers",       # number of users in the system
481        "size",         # size of a file or filesystem
482        "host",         # Name  of host on which job should be run
483        "nodes",        # Number and/or type of nodes to be reserved for exclusive use by the job
484        "other",        # Allows a  user  to  specify  site  specific  information
485        "software",     # Allows a user to specify software required by the job
486]
487
488def check_resp(dict, str):
489  """
490  Check the daemon response. If we have no permission to
491  query the values then we got a 'None' response. Else
492  if we supplied a keyword that does not exits we get a
493  '?' response
494  """
495  if not str:
496    return
497     
498  key, val = string.split(str, '=')
499  key = string.strip(key)
500  val = string.strip(val)
501
502  # Did we got a valid response
503  #
504  if not val[0] == '?':
505    dict[key] = val
506
507def use_default_keywords(id, d):
508  """
509  Get the default values from the mom daemon
510  """
511  for res in default_mom_res:
512    addreq(id, res)
513    resp = getreq(id)
514    check_resp(d, resp)
515
516  # Do not proceed if we have an empty dictionary
517  #
518  if not d:
519    return
520
521  if d['arch' ] == 'linux':
522    for res in default_linux_res:
523      addreq(id, res)
524      resp = getreq(id)
525      check_resp(d, resp)
526
527def use_user_keywords(id, d, l):
528  for res in l:
529    if type(res) is types.StringType:
530      addreq(id, res)
531      resp = getreq(id)
532      check_resp(d, resp)
533    else:
534      raise TypeError, 'Expected a string got %s :%s' %(type(res), res) 
535
536def get_mom_values(id, list = None):
537  """
538  This function will query the mom with a default resmon keywords
539  and 'arch' depended keywords. Supported archs are:
540    linux
541    irix6
542  User can also supply their own list of keywords as second parameter.
543  arguments:
544    id   : connection number with mom daemon on a node
545    list : optional parameter. If supplied then use this. A list
546           of mom keywords.
547  """
548
549  d = {}
550  if not list:
551    use_default_keywords(id, d)
552  else:
553    use_user_keywords(id, d , list)
554     
555  return d
556
557def version():
558  """
559  Returns the pbs python interface version as a string.
560  """
561  return '2.9.4'
562
563# A useful dict with error codes to text
564#
565# SVN Info:
566#       $Id: pbs.py 144 2006-11-16 13:35:53Z bas $
567#
568errors_txt = { 
569        0 : 'no error',
570        15001 :  'Unknown Job Identifier',
571        15002 : 'Undefined Attribute',
572        15003 : 'attempt to set READ ONLY attribute',
573        15004 : 'Invalid request',
574        15005 : 'Unknown batch request',
575        15006 : 'Too many submit retries',
576        15007 : 'No permission',
577        15008 : 'access from host not allowed',
578        15009 : 'job already exists',
579        15010 : 'system error occurred',
580        15011 : 'internal server error occurred',
581        15012 : 'parent job of dependent in rte que',
582        15013 : 'unknown signal name',
583        15014 : 'bad attribute value',
584        15015 : 'Cannot modify attrib in run state',
585        15016 : 'request invalid for job state',
586        15018 : 'Unknown queue name',
587        15019 : 'Invalid Credential in request',
588        15020 : 'Expired Credential in request',
589        15021 : 'Queue not enabled',
590        15022 : 'No access permission for queue',
591        15023 : 'Bad user - no password entry',
592        15024 : 'Max hop count exceeded',
593        15025 : 'Queue already exists',
594        15026 : 'incompatable queue attribute type',
595        15027 : 'Queue Busy (not empty)',
596        15028 : 'Queue name too long',
597        15029 : 'Feature',
598        15030 : 'Cannot enable queue,needs add def',
599        15031 : 'Protocol (ASN.1) error',
600        15032 : 'Bad attribute list structure',
601        15033 : 'No free connections',
602        15034 : 'No server to connect to',
603        15035 : 'Unknown resource',
604        15036 : 'Job exceeds Queue resource limits',
605        15037 : 'No Default Queue Defined',
606        15038 : 'Job Not Rerunnable',
607        15039 : 'Route rejected by all destinations',
608        15040 : 'Time in Route Queue Expired',
609        15041 : 'Request to MOM failed',
610        15042 : '(qsub) cannot access script file',
611        15043 : 'Stage In of files failed',
612        15044 : 'Resources temporarily unavailable',
613        15045 : 'Bad Group specified',
614        15046 : 'Max number of jobs in queue',
615        15047 : 'Checkpoint Busy, may be retries',
616        15048 : 'Limit exceeds allowable',
617        15049 : 'Bad Account attribute value',
618        15050 : 'Job already in exit state',
619        15051 : 'Job files not copied',
620        15052 : 'unknown job id after clean init',
621        15053 : 'No Master in Sync Set',
622        15054 : 'Invalid dependency',
623        15055 : 'Duplicate entry in List',
624        15056 : 'Bad DIS based Request Protocol',
625        15057 : 'cannot execute there',
626        15058 : 'sister rejected',
627        15059 : 'sister could not communicate',
628        15060 : 'req rejected -server shutting down',
629        15061 : 'not all tasks could checkpoint',
630        15062 : 'Named node is not in the list',
631        15063 : 'node-attribute not recognized',
632        15064 : 'Server has no node list',
633        15065 : 'Node name is too big',
634        15066 : 'Node name already exists',
635        15067 : 'Bad node-attribute value',
636        15068 : 'State values are mutually exclusive',
637        15069 : 'Error(s) during global modification of nodes',
638        15070 : 'could not contact Mom',
639        15071 : 'no time-shared nodes',
640        15201 : 'resource unknown',
641        15202 : 'parameter could not be used',
642        15203 : 'a parameter needed did not exist',
643        15204 : "something specified didn't exist",
644        15205 : 'a system error occured',
645        15206 : 'only part of reservation made'
646}
647
648def error():
649  """
650  Check if there is an error, if so fetch the error message string.
651  It says more then a number!
652  """
653  e = get_error()
654  if errors_txt.has_key(e):
655     return (e, errors_txt[e])
656  else:
657     return (e, "Could not find a text for this error, uhhh")
658
659cvar = _pbs.cvar
660
Note: See TracBrowser for help on using the repository browser.