def __analyzeLogs__(self): modified = [] deleted = [] added = [] ignored = self.ignoreFolderList trigger = 0 f = open(self.reportFile) for line in f: if "modified:" in line: modified.append(line) if "deleted: " in line: deleted.append(line) if "Untracked files:" in line: trigger = 1 # trigger.append(1) if "no changes added to commit" in line: trigger = 0 # trigger.append(-1) if trigger == 1: added.append(line) f.close() pattern = r':\s+' self.modified = [tools.cleanUp(pattern, item) for item in modified] self.deleted = [tools.cleanUp(pattern, item) for item in deleted] temp = [tools.cleanUp(r'\t', item) for item in added if '\t' in item] self.added = [item for item in temp if item not in ignored] self.ignored = ignored
def __cleanFiles__(self): newArray1 = [] newArray2 = [] pattern = r'^\.\/' f = open(self.__filesInMainRaw__) for line in f: newArray1.append(tools.cleanUp(pattern, line)) f.close() self.filesInMain = newArray1 f = open(self.__filesInMainGitRaw__) for line in f: newArray2.append(tools.cleanUp(pattern, line)) f.close() self.filesInMainGit = newArray2
bootIP = tools.getExternalIP(advclient, bootstrap) if bootIP == "": print("bootstrap failed") if bootIP != BOOTSTRAP_IP: print("bootstrap loaded with wrong ip") bootID = tools.getPublicKey(fluentd) print("Bootnode is at - " + bootstrap.name + ": " + bootIP + ":7513/" + bootID) create_nodes(params.genesis_accounts, bootIP, bootID, POET_IP, NETWORK_NAME) print("Started " + str(netsize) + " more instances booting from bootnode") tools.parse_logs(fluentd, queries.events) except KeyboardInterrupt: print("Run stopped") except: traceback.print_exc() finally: print("Starting to shutdown nodes") if fluentd is not None: containers.append({"cont": fluentd}) containers.append({"cont": bootstrap}) if poet is not None: containers.append({"cont": poet}) tools.cleanUp(containers) client.networks.prune()
import random import os import pprint from random import SystemRandom from concurrent.futures import ProcessPoolExecutor, ThreadPoolExecutor, wait, as_completed ### Create docker client pp = pprint.PrettyPrinter(indent=4) randcon = 8 client = docker.from_env() advclient = docker.APIClient(base_url='unix://var/run/docker.sock') tools.cleanUp(client.containers.list()) time.sleep(1) print "Creating bootstrap container" bootstrap = client.containers.run("spaceanton/spacemesh:spacemesh_p2p", detach=True, ports={9090:9999}, environment={"BOOTPARAMS": "--gossip --randcon 3 --bucketsize 100"}) print "Waiting for node to boot up" tools.waitForRPC(bootstrap) tools.registerProtocol(advclient, bootstrap, "gossip_test", 8081) # collect id and ip. bootIP = tools.getExternalIP(advclient, bootstrap) bootID = tools.getPublicKey(bootstrap) print "Bootnode is at - "+ bootstrap.name + ": " + bootIP + ":7513/" + bootID