-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnclient.py
More file actions
32 lines (23 loc) · 728 Bytes
/
nclient.py
File metadata and controls
32 lines (23 loc) · 728 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/env python3
import sys
import os
import argparse
from concurrent.futures import ThreadPoolExecutor
from subprocess import check_call
def _start_client():
check_call(["python3", "client.py"])
def main():
parser = argparse.ArgumentParser(description="Client runner")
parser.add_argument("--count", help="Number of clients", default=1, type=int)
args = parser.parse_args()
count = args.count
print("Starting %d client" % count)
try:
with ThreadPoolExecutor(max_workers=count) as pool:
for i in range(count):
pool.submit(_start_client)
except Exception as error:
print(str(error))
return 1
if __name__ == "__main__":
main()