|
1 | 1 | import redis |
| 2 | +from functools import wraps |
| 3 | +import multiprocessing as mp |
2 | 4 |
|
3 | 5 | from includes import * |
4 | 6 |
|
@@ -135,6 +137,8 @@ def test_dagro_common_errors(env): |
135 | 137 |
|
136 | 138 |
|
137 | 139 | def test_dag_modelrun_financialNet_errors(env): |
| 140 | + if not TEST_TF: |
| 141 | + return |
138 | 142 | con = env.getConnection() |
139 | 143 |
|
140 | 144 | model_pb, creditcard_transactions, creditcard_referencedata = load_creditcardfraud_data( |
@@ -379,6 +383,8 @@ def test_dag_keyspace_and_localcontext_tensorget(env): |
379 | 383 |
|
380 | 384 |
|
381 | 385 | def test_dag_modelrun_financialNet_separate_tensorget(env): |
| 386 | + if not TEST_TF: |
| 387 | + return |
382 | 388 | con = env.getConnection() |
383 | 389 |
|
384 | 390 | model_pb, creditcard_transactions, creditcard_referencedata = load_creditcardfraud_data( |
@@ -419,6 +425,8 @@ def test_dag_modelrun_financialNet_separate_tensorget(env): |
419 | 425 |
|
420 | 426 |
|
421 | 427 | def test_dag_modelrun_financialNet(env): |
| 428 | + if not TEST_TF: |
| 429 | + return |
422 | 430 | con = env.getConnection() |
423 | 431 |
|
424 | 432 | model_pb, creditcard_transactions, creditcard_referencedata = load_creditcardfraud_data( |
@@ -456,6 +464,8 @@ def test_dag_modelrun_financialNet(env): |
456 | 464 |
|
457 | 465 |
|
458 | 466 | def test_dag_modelrun_financialNet_no_writes(env): |
| 467 | + if not TEST_TF: |
| 468 | + return |
459 | 469 | con = env.getConnection() |
460 | 470 |
|
461 | 471 | model_pb, creditcard_transactions, creditcard_referencedata = load_creditcardfraud_data( |
@@ -505,11 +515,13 @@ def test_dag_modelrun_financialNet_no_writes(env): |
505 | 515 |
|
506 | 516 |
|
507 | 517 | def test_dagro_modelrun_financialNet_no_writes_multiple_modelruns(env): |
| 518 | + if not TEST_TF: |
| 519 | + return |
508 | 520 | con = env.getConnection() |
509 | 521 |
|
510 | 522 | model_pb, creditcard_transactions, creditcard_referencedata = load_creditcardfraud_data( |
511 | 523 | env) |
512 | | - ret = con.execute_command('AI.MODELSET', 'financialNet', 'TF', "CPU", |
| 524 | + ret = con.execute_command('AI.MODELSET', 'financialNet', 'TF', DEVICE, |
513 | 525 | 'INPUTS', 'transaction', 'reference', 'OUTPUTS', 'output', model_pb) |
514 | 526 | env.assertEqual(ret, b'OK') |
515 | 527 |
|
@@ -555,3 +567,28 @@ def test_dagro_modelrun_financialNet_no_writes_multiple_modelruns(env): |
555 | 567 | tensor_number)) |
556 | 568 | env.assertEqual(ret, 0) |
557 | 569 | tensor_number = tensor_number + 1 |
| 570 | + |
| 571 | + info = con.execute_command('AI.INFO', 'financialNet') |
| 572 | + financialNetRunInfo = info_to_dict(info) |
| 573 | + |
| 574 | + env.assertEqual('financialNet', financialNetRunInfo['key']) |
| 575 | + env.assertEqual('MODEL', financialNetRunInfo['type']) |
| 576 | + env.assertEqual('TF', financialNetRunInfo['backend']) |
| 577 | + env.assertEqual(DEVICE, financialNetRunInfo['device']) |
| 578 | + env.assertTrue(financialNetRunInfo['duration'] > 0) |
| 579 | + env.assertEqual(0, financialNetRunInfo['samples']) |
| 580 | + env.assertEqual(2*len(creditcard_transactions), financialNetRunInfo['calls']) |
| 581 | + env.assertEqual(0, financialNetRunInfo['errors']) |
| 582 | + |
| 583 | + con.execute_command('AI.INFO', 'financialNet', 'RESETSTAT') |
| 584 | + info = con.execute_command('AI.INFO', 'financialNet') |
| 585 | + financialNetRunInfo = info_to_dict(info) |
| 586 | + |
| 587 | + env.assertEqual('financialNet', financialNetRunInfo['key']) |
| 588 | + env.assertEqual('MODEL', financialNetRunInfo['type']) |
| 589 | + env.assertEqual('TF', financialNetRunInfo['backend']) |
| 590 | + env.assertEqual(DEVICE, financialNetRunInfo['device']) |
| 591 | + env.assertEqual(0, financialNetRunInfo['duration']) |
| 592 | + env.assertEqual(0, financialNetRunInfo['samples']) |
| 593 | + env.assertEqual(0, financialNetRunInfo['calls']) |
| 594 | + env.assertEqual(0, financialNetRunInfo['errors']) |
0 commit comments