transaction generator on seperate node

pull/6/head
alok 7 years ago
parent 416cef7a2b
commit 1748662dfb
  1. 5
      aws-code/transaction_generator.go
  2. 18
      aws-scripts/preprocess_peerlist.py
  3. 2
      aws-scripts/run_instances.sh

@ -63,10 +63,10 @@ func readConfigFile(configFile string) [][]string {
} }
func main() { func main() {
configFile := flag.String("config_file", "local_config.txt", "file containing all ip addresses and config") configFile := flag.String("config_file", "global_nodes.txt", "file containing all ip addresses and config")
flag.Parse() flag.Parse()
config := readConfigFile(*configFile) config := readConfigFile(*configFile)
time.Sleep(totalTime) //Sleep Time to let all instances come up
start := time.Now() start := time.Now()
totalTime := 60.0 totalTime := 60.0
txs := make([]blockchain.Transaction, 10) txs := make([]blockchain.Transaction, 10)
@ -79,7 +79,6 @@ func main() {
} }
for i := range txs { for i := range txs {
txs[i] = newRandTransaction() txs[i] = newRandTransaction()
} }
msg := node.ConstructTransactionListMessage(txs) msg := node.ConstructTransactionListMessage(txs)
log.Printf("[Generator] Sending txs to %d leader[s]\n", len(leaders)) log.Printf("[Generator] Sending txs to %d leader[s]\n", len(leaders))

@ -1,19 +1,21 @@
from collections import namedtuple
import requests import requests
amazon_ipv4_url = "http://169.254.169.254/latest/meta-data/public-ipv4" amazon_ipv4_url = "http://169.254.169.254/latest/meta-data/public-ipv4"
if __name__ == "__main__": if __name__ == "__main__":
current_ip = requests.get(amazon_ipv4_url).text current_ip = requests.get(amazon_ipv4_url).text
f = open("all_peerlist.txt",r) f = open("global_nodes.txt",r)
for myline in f: for myline in f:
mylist = myline.strip().split(" ") mylist = myline.split(" ")
ip = mylist[0] ip = mylist[0]
if ip != current_ip: node = mylist[2]
if ip != current_ip or node != "transaction":
peerList.append(myline) peerList.append(myline)
else:
h = open("isTransaction.txt",w)
h.write("I am just a transaction generator node")
h.close()
f.close() f.close()
g = open("global_peerlist.txt") g = open("global_peerlist.txt",w)
for myline peerList: for myline peerList:
g.write(myline + "\n") g.write(myline)
g.close() g.close()

@ -1,3 +1,3 @@
#!/bin/bash -x #!/bin/bash -x
cd /home/ec2-user/projects/src/harmony-benchmark cd /home/ec2-user/projects/src/harmony-benchmark
./deploy_linux.sh local_config2.txt ./deploy_one_instance.sh global_peerlist.txt
Loading…
Cancel
Save