9b7d6a142b
Reviewers: buda, lion Reviewed By: buda Subscribers: pullbot Differential Revision: https://phabricator.memgraph.io/D723
47 lines
1.3 KiB
Python
47 lines
1.3 KiB
Python
#!/usr/bin/env python3
|
|
# Automatically copied to the build/ directory during Makefile (configured by cmake)
|
|
|
|
import os
|
|
|
|
terminal_command = 'gnome-terminal'
|
|
terminal_flags = ' --geometry=200x50 ' # columns x rows
|
|
|
|
config_filename = 'config'
|
|
log_dir = "logs"
|
|
glog_flags = '--alsologtostderr --logbufsecs=0 --minloglevel=2 --log_dir="{}" '.format(log_dir)
|
|
|
|
def GetMainCall(my_mnid, address, port):
|
|
ret = "./main {} --my_mnid {} --address {} --port {} --config_filename={}".format(
|
|
glog_flags, my_mnid, address, port, config_filename)
|
|
|
|
print(ret)
|
|
return ret
|
|
|
|
|
|
def GetClientCall():
|
|
ret = "./main-client {} --address 127.0.0.1 --port 10000 --config_filename={}".format(
|
|
glog_flags, config_filename)
|
|
print(ret)
|
|
return ret
|
|
|
|
|
|
def NamedGnomeTab(name, command):
|
|
return " --tab -e \"bash -c 'printf \\\"\\033]0;{}\\007\\\"; {}'\" ".format(name, command)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
command = "{} {}".format(terminal_command, terminal_flags)
|
|
command += NamedGnomeTab("client", GetClientCall())
|
|
|
|
f = open(config_filename, 'r')
|
|
for line in f:
|
|
data = line.strip().split(' ')
|
|
my_mnid = data[0]
|
|
address = data[1]
|
|
port = data[2]
|
|
command += NamedGnomeTab("mnid={}".format(my_mnid), GetMainCall(my_mnid, address, port))
|
|
|
|
print(command)
|
|
os.system('mkdir -p {}'.format(log_dir))
|
|
os.system(command)
|