<commit_before>import os

serverA = open('serverlistA.list', 'r')
serverB = open('serverlistB.list', 'r')
numA = int(serverA.readline())
numB = int(serverB.readline())

iplistA = open('iplistA', 'w')
iplistB = open('iplistB', 'w')

sshconfig = open('/home/lsh/.ssh/config', 'w')
csshconfig = open('/home/lsh/.clusterssh/clusters', 'w')

csshconfig.write("rackA ")
for i in range(numA):
  port = int(serverA.readline())
  #content = "host A" + str(port) + "\n  HostName 192.168.1." + str(port - 30000) + "\n  IdentityFile /home/lsh/.ssh/id_rsa\n"
  content = "host A" + str(port) + "\n  HostName 192.168.1." + str(port - 30000) + "\n  ProxyCommand ssh <EMAIL> -W %h:22" + "\n  IdentityFile /home/lsh/.ssh/id_rsa\n"
  sshconfig.write(content)
  hostname = "A" + str(port) + " "
  csshconfig.write(hostname)
  ipaddr = "192.168.6." + str(port - 30100) + "\n"
  iplistA.write(ipaddr)
iplistA.close()

csshconfig.write("\nrackB ")
for i in range(numB):
  port = int(serverB.readline())
  #content = "host B" + str(port) + "\n  HostName 192.168.1." + str(port - 30000) + "\n  IdentityFile /home/lsh/.ssh/id_rsa\n"
  content = "host B" + str(port) + "\n  HostName 192.168.1." + str(port - 30000) + "\n  ProxyCommand ssh <EMAIL> -W %h:22" + "\n  IdentityFile /home/lsh/.ssh/id_rsa\n"
  sshconfig.write(content)
  hostname = "B" + str(port) + " "
  csshconfig.write(hostname)
  ipaddr = "192.168.7." + str(port - 30106) + "\n"
  iplistB.write(ipaddr)
iplistB.close()

sshconfig.close()
csshconfig.close()
serverA.close()
serverB.close()

csshconfig = open('/home/lsh/.clusterssh/clusters', 'r')
serverA = csshconfig.readline().split()
serverB = csshconfig.readline().split()
csshconfig.close()

for i in range(1, numA+1):
  os.system("echo '" + str(i) + "' > iplist  && cat iplistB >> iplist")
  os.system("scp iplist shuhao@" + serverA[i] + ":~/repflowtestbed/iplist")
  print "Done copying iplist to ", serverA[i]
for j in range(1, numB+1):
  os.system("echo '" + str(i+j) + "' > iplist  && cat iplistA >> iplist")
  os.system("scp iplist shuhao@" + serverB[j] + ":~/repflowtestbed/iplist")
  print "Done copying iplist to ", serverB[j]

os.system("rm iplist*")
<commit_msg>update iplist setup method<commit_after>import os

serverA = open('serverlistA.list', 'r')
serverB = open('serverlistB.list', 'r')
numA = int(serverA.readline())
numB = int(serverB.readline())

iplistA = open('iplistA', 'w')
iplistB = open('iplistB', 'w')

sshconfig = open('/Users/iqua/.ssh/config', 'w')
csshconfig = open('/etc/clusters', 'w')

csshconfig.write("rackA ")
for i in range(numA):
  port = int(serverA.readline())
  content = "host A" + str(port) + "\n  Hostname sing.cse.ust.hk\n  User shuhao\n  Port " + str(port) + "\n"
  sshconfig.write(content)
  hostname = "A" + str(port) + " "
  csshconfig.write(hostname)
  ipaddr = "192.168.6." + str(port - 30042) + "\n"
  iplistA.write(ipaddr)
iplistA.close()

csshconfig.write("\nrackB ")
for i in range(numB):
  port = int(serverB.readline())
  content = "host B" + str(port) + "\n  Hostname sing.cse.ust.hk\n  User shuhao\n  Port " + str(port) + "\n"
  sshconfig.write(content)
  hostname = "B" + str(port) + " "
  csshconfig.write(hostname)
  if (port == 30055):
    port = 30050
  ipaddr = "192.168.7." + str(port - 30048) + "\n"
  iplistB.write(ipaddr)
iplistB.close()

sshconfig.close()
csshconfig.close()
serverA.close()
serverB.close()

csshconfig = open('/etc/clusters', 'r')
serverA = csshconfig.readline().split()
serverB = csshconfig.readline().split()
csshconfig.close()

for i in range(1, numA+1):
  os.system("echo '" + str(i) + "' > iplist  && cat iplistB >> iplist")
  os.system("scp ./iplist " + serverA[i] + ":~/repnet/exp_code/iplist")
  print "Done copying iplist to", serverA[i]
for j in range(1, numB+1):
  os.system("echo '" + str(i+j) + "' > iplist  && cat iplistA >> iplist")
  cmd = "scp ./iplist " + serverB[j] + ":~/repnet/exp_code/iplist"
  os.system(cmd)
  print "Done copying iplist to", serverB[j]

os.system("rm iplist*")

{'fraction_non_alphanumeric': 0.20055220883534136, 'fraction_numerical': 0.02961847389558233, 'mean_word_length': 4.006281407035176, 'pattern_counts': {'":': 4, '<': 5, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7451147', 'n_tokens_mistral': 1770, 'n_tokens_neox': 1616, 'n_words': 332}