Merge "Replace asserts with exceptions"
This commit is contained in:
commit
7bee0b5861
|
@ -7089,7 +7089,8 @@ class Layout(object):
|
|||
# configured pipeline, if so return an empty JobGraph.
|
||||
if old:
|
||||
job_map = item.current_build_set._old_jobs
|
||||
assert(context is None)
|
||||
if context is not None:
|
||||
raise RuntimeError("Context should be none for old job graphs")
|
||||
context = zkobject.LocalZKContext(self.log)
|
||||
else:
|
||||
job_map = item.current_build_set.jobs
|
||||
|
|
|
@ -198,8 +198,10 @@ class JobRequestQueue(ZooKeeperSimpleBase):
|
|||
path = "/".join([self.REQUEST_ROOT, request.uuid])
|
||||
request.path = path
|
||||
|
||||
assert isinstance(request, self.request_class)
|
||||
assert request.state == self.request_class.UNSUBMITTED
|
||||
if not isinstance(request, self.request_class):
|
||||
raise RuntimeError("Request of wrong class")
|
||||
if request.state != self.request_class.UNSUBMITTED:
|
||||
raise RuntimeError("Request state must be unsubmitted")
|
||||
request.state = self.initial_state
|
||||
|
||||
result = None
|
||||
|
|
|
@ -64,7 +64,8 @@ class RawShardIO(io.RawIOBase):
|
|||
# Only write one key at a time and defer writing the rest to the caller
|
||||
shard_bytes = bytes(shard_data[0:NODE_BYTE_SIZE_LIMIT])
|
||||
shard_bytes = zlib.compress(shard_bytes)
|
||||
assert(len(shard_bytes) < NODE_BYTE_SIZE_LIMIT)
|
||||
if not (len(shard_bytes) < NODE_BYTE_SIZE_LIMIT):
|
||||
raise RuntimeError("Shard too large")
|
||||
self.client.create(
|
||||
"{}/".format(self.shard_base),
|
||||
shard_bytes,
|
||||
|
|
Loading…
Reference in New Issue