def __init__(self): self.payloadsFile = 'nayra/resources/data.json' #You can add new payloads in this file self.maxLength = 100 #Limiting value of split self.argvs = argvs.Parser() self.request = network.Request() self.fullURL = '' self.payload = '' self.splitBefore = '' self.splitAfter = '' self.content = ''
def run_request(): request = network.Request() node = network.NodeAssignment() node.add(0, '127.0.0.1') com = request.request(node) com.establish_communication() for i in range(TestCase.TEST_ROUND - 1): com.send_one(0, TestCase.TEST_DATA) time.sleep(1) # last round com.send_one(0, TestCase.TEST_DATA) com.close(force=False, timeout=10)
import time import network import numpy as np if __name__ == '__main__': request = network.Request() node = network.NodeAssignment() node.add(0, '127.0.0.1') with request.request(node) as com: while not com.is_closed(): com: network.ICommunication_Controller for i in range(100): com.send_one(0, np.random.uniform(size=[100000])) print(i) time.sleep(1)
import time import network import rpc class Hello(rpc.AbsSimpleExecutor): def run(self, com: rpc.communication.Communication) -> object: for i in range(101): time.sleep(0.1) # Executor可以这样报告状态 com.report_progress(i) return "Hello World" if __name__ == '__main__': # 分配运行节点 nodes = network.NodeAssignment() nodes.add(1, "127.0.0.1") # 创建执行环境 with network.Request().request(nodes) as com: master = rpc.Coordinator(com) master.submit_group(Hello) res, err = master.join() # 打印结果 print(res)