|
9 | 9 | import os
|
10 | 10 | import sys
|
11 | 11 | import tempfile
|
12 |
| - |
| 12 | +import time |
13 | 13 | import git
|
14 | 14 | import paramiko
|
15 | 15 | import pysftp
|
@@ -93,13 +93,22 @@ def copy_file_to_remote_setup(
|
93 | 93 | cnopts=cnopts,
|
94 | 94 | port=port,
|
95 | 95 | )
|
96 |
| - srv.put(full_local_path, remote_file, callback=view_bar_simple) |
97 |
| - srv.close() |
| 96 | + if srv.exists(remote_file): |
| 97 | + print(f"Remote file {remote_file} already exists. Skipping the copy.") |
| 98 | + else: |
| 99 | + uploaded_file = srv.put( |
| 100 | + full_local_path, remote_file, callback=view_bar_simple |
| 101 | + ) |
| 102 | + print(f"File uploaded to: {uploaded_file}") |
98 | 103 | logging.info(
|
99 | 104 | "Finished Copying file {} to remote server {} ".format(
|
100 | 105 | full_local_path, remote_file
|
101 | 106 | )
|
102 | 107 | )
|
| 108 | + file_info = srv.stat(remote_file) |
| 109 | + print(f"Remote file size: {file_info.st_size} bytes") |
| 110 | + print(f"Remote file permissions: {oct(file_info.st_mode)[-3:]}") |
| 111 | + srv.close() |
103 | 112 | res = True
|
104 | 113 | else:
|
105 | 114 | if continue_on_module_check_error:
|
@@ -314,6 +323,9 @@ def setup_remote_environment(
|
314 | 323 | },
|
315 | 324 | raise_on_error=True,
|
316 | 325 | )
|
| 326 | + infra_wait_secs = 60 |
| 327 | + logging.warning(f"Infra ready wait... for {infra_wait_secs} secs") |
| 328 | + time.sleep(infra_wait_secs) |
317 | 329 | return retrieve_tf_connection_vars(return_code, tf)
|
318 | 330 |
|
319 | 331 |
|
@@ -616,42 +628,50 @@ def push_data_to_redistimeseries(rts, time_series_dict: dict, expire_msecs=0):
|
616 | 628 | unit="benchmark time-series", total=len(time_series_dict.values())
|
617 | 629 | )
|
618 | 630 | for timeseries_name, time_series in time_series_dict.items():
|
619 |
| - exporter_create_ts(rts, time_series, timeseries_name) |
620 |
| - for timestamp, value in time_series["data"].items(): |
621 |
| - try: |
622 |
| - if timestamp is None: |
623 |
| - logging.warning("The provided timestamp is null. Using auto-ts") |
624 |
| - rts.ts().add( |
625 |
| - timeseries_name, |
626 |
| - value, |
627 |
| - duplicate_policy="last", |
628 |
| - ) |
629 |
| - else: |
630 |
| - rts.ts().add( |
631 |
| - timeseries_name, |
632 |
| - timestamp, |
633 |
| - value, |
634 |
| - duplicate_policy="last", |
| 631 | + try: |
| 632 | + exporter_create_ts(rts, time_series, timeseries_name) |
| 633 | + for timestamp, value in time_series["data"].items(): |
| 634 | + try: |
| 635 | + if timestamp is None: |
| 636 | + logging.warning( |
| 637 | + "The provided timestamp is null. Using auto-ts" |
| 638 | + ) |
| 639 | + rts.ts().add( |
| 640 | + timeseries_name, |
| 641 | + value, |
| 642 | + duplicate_policy="last", |
| 643 | + ) |
| 644 | + else: |
| 645 | + rts.ts().add( |
| 646 | + timeseries_name, |
| 647 | + timestamp, |
| 648 | + value, |
| 649 | + duplicate_policy="last", |
| 650 | + ) |
| 651 | + datapoint_inserts += 1 |
| 652 | + except redis.exceptions.DataError: |
| 653 | + logging.warning( |
| 654 | + "Error while inserting datapoint ({} : {}) in timeseries named {}. ".format( |
| 655 | + timestamp, value, timeseries_name |
| 656 | + ) |
635 | 657 | )
|
636 |
| - datapoint_inserts += 1 |
637 |
| - except redis.exceptions.DataError: |
638 |
| - logging.warning( |
639 |
| - "Error while inserting datapoint ({} : {}) in timeseries named {}. ".format( |
640 |
| - timestamp, value, timeseries_name |
| 658 | + datapoint_errors += 1 |
| 659 | + pass |
| 660 | + except redis.exceptions.ResponseError: |
| 661 | + logging.warning( |
| 662 | + "Error while inserting datapoint ({} : {}) in timeseries named {}. ".format( |
| 663 | + timestamp, value, timeseries_name |
| 664 | + ) |
641 | 665 | )
|
642 |
| - ) |
643 |
| - datapoint_errors += 1 |
644 |
| - pass |
645 |
| - except redis.exceptions.ResponseError: |
646 |
| - logging.warning( |
647 |
| - "Error while inserting datapoint ({} : {}) in timeseries named {}. ".format( |
648 |
| - timestamp, value, timeseries_name |
649 |
| - ) |
650 |
| - ) |
651 |
| - datapoint_errors += 1 |
652 |
| - pass |
653 |
| - if expire_msecs > 0: |
654 |
| - rts.pexpire(timeseries_name, expire_msecs) |
| 666 | + datapoint_errors += 1 |
| 667 | + pass |
| 668 | + if expire_msecs > 0: |
| 669 | + rts.pexpire(timeseries_name, expire_msecs) |
| 670 | + except redis.exceptions.TimeoutError: |
| 671 | + logging.error( |
| 672 | + f"Error while working in timeseries named {timeseries_name}. " |
| 673 | + ) |
| 674 | + datapoint_errors += 1 |
655 | 675 | progress.update()
|
656 | 676 | return datapoint_errors, datapoint_inserts
|
657 | 677 |
|
|
0 commit comments