diff options
Diffstat (limited to 'benchmarks/fragments/shared.py')
-rw-r--r-- | benchmarks/fragments/shared.py | 28 |
1 files changed, 0 insertions, 28 deletions
diff --git a/benchmarks/fragments/shared.py b/benchmarks/fragments/shared.py deleted file mode 100644 index e0cd449..0000000 --- a/benchmarks/fragments/shared.py +++ /dev/null @@ -1,28 +0,0 @@ -import os, time - -binary_path = "/tmp/mknet-bin" -storage_path = "/tmp/mknet-store" - -def exec(s): - if os.system(s) != 0: - raise Exception("Command terminated with an error") -def exec_retry(s, cnt=16): - print(s) - for i in range(cnt): - time.sleep(i) # this is expected to sleep before running the command to reduce the noise - if os.system(s) == 0: return - raise Exception("Command terminated with an error too many times") -def fn_retry(f, cnt=5): - for i in range(cnt): - try: - r = f() - return r - except Exception as e: - if i+1 == cnt: raise e - log(f"failed call, retry in {i} sec") - time.sleep(i) - -def id(): return int(os.environ['ID']) -def count(): return int(os.environ['SERVER_COUNT']) -def log(*args): print(f"[{id()}/{count()} - {os.environ['HOST']}]", *args) - |