Skip to content

Commit 0b66cde

Browse files
committed
Get connection using getConnection in spawned process
1 parent 5203bb8 commit 0b66cde

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

test/tests_tensorflow.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -633,6 +633,7 @@ def test_tensorflow_modelrun_with_batch_and_minbatch(env):
633633
'BLOB', img.tobytes())
634634

635635
def run(name=model_name, output_name='output'):
636+
con = env.getConnection()
636637
con.execute_command('AI.MODELRUN', name,
637638
'INPUTS', 'input', 'OUTPUTS', output_name)
638639

@@ -652,12 +653,10 @@ def run(name=model_name, output_name='output'):
652653
'OUTPUTS', outputvar,
653654
'BLOB', model_pb)
654655

655-
p1 = mp.Process(target=run, args=(another_model_name, 'final1'))
656-
p1.start()
657-
p2 = mp.Process(target=run, args=(another_model_name, 'final2'))
658-
p2.start()
656+
p1b = mp.Process(target=run, args=(another_model_name, 'final1'))
657+
p1b.start()
659658

660-
time.sleep(3)
659+
run(another_model_name, 'final2')
661660

662661
_, dtype, _, shape, _, data = con.execute_command('AI.TENSORGET', 'final1', 'META', 'BLOB')
663662
dtype_map = {b'FLOAT': np.float32}
@@ -670,6 +669,7 @@ def run(name=model_name, output_name='output'):
670669

671670
p3.terminate()
672671

672+
673673
@skip_if_no_TF
674674
def test_tensorflow_modelrun_financialNet(env):
675675
con = env.getConnection()

0 commit comments

Comments
 (0)