Skip to content

Commit

Permalink
Check explicitly that no unique request ID is repeated
Browse files Browse the repository at this point in the history
  • Loading branch information
David Goodwin committed Aug 27, 2019
1 parent 49b3aee commit a9250a5
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions qa/common/infer_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,14 @@
import numpy as np
from tensorrtserver.api import *
import test_util as tu
from sets import Set

# unicode() doesn't exist on python3, for how we use it the
# corresponding function is bytes()
if sys.version_info.major == 3:
unicode = bytes

_last_request_id = 0
_seen_request_ids = Set()

def _range_repr_dtype(dtype):
if dtype == np.float64:
Expand Down Expand Up @@ -162,11 +163,10 @@ def infer_exact(tester, pf, tensor_shape, batch_size,
output_req, batch_size)

if not skip_request_id_check:
global _last_request_id
min_request_id = _last_request_id + 1
global _seen_request_ids
request_id = ctx.get_last_request_id()
_last_request_id = request_id
tester.assertGreaterEqual(request_id, min_request_id)
tester.assertFalse(request_id in _seen_request_ids)
_seen_request_ids.add(request_id)

tester.assertEqual(ctx.get_last_request_model_name(), model_name)
if model_version is not None:
Expand Down

0 comments on commit a9250a5

Please sign in to comment.