7 ###########################################################################
8 class VzUbcMonResource(object):
10 Simple data structure to represent a UBC resource
13 #----------------------------------------------------------------------
14 def __init__(self
, held
=None, maxheld
=None, barrier
=None,
15 limit
=None, failcnt
=None, resource_seq
=None):
17 self
.held
= int(resource_seq
[0])
18 self
.maxheld
= int(resource_seq
[1])
19 self
.barrier
= int(resource_seq
[2])
20 self
.limit
= int(resource_seq
[3])
21 self
.failcnt
= int(resource_seq
[4])
23 if not isinstance(held
, basestring
)and not isinstance(held
, int):
24 raise AttributeError('You must specify either a resource using keyword arguments or a complete resource sequence')
26 self
.maxheld
= int(maxheld
)
27 self
.barrier
= int(barrier
)
28 self
.limit
= int(limit
)
29 self
.failcnt
= int(failcnt
)
31 #----------------------------------------------------------------------
33 return '%s:%s (%s)' % (self
.barrier
, self
.limit
, self
.failcnt
)