def __init__(self, host, port, phases, processing_node=None, max_inbound_connections=50, max_outbound_connections=50): # TODO consider to change phases back to array of ints and translate w/in the DB interface net_dao.reset_data() # TEMP FOR TESTING self.this_node = message_types.Node() self.host = host self.port = port self.business = None self.deploy_location = None # phase_type => {nodes} (dictionary of connected nodes) self.peer_dict = {} self.config = None # list of connected nodes self.connections = set() self.phases = int(phases) self.processing_node = processing_node """ Load configured nodelist """ logger().info('loading network config...') self.load_config() logger().info('scheduling network tasks...') self.schedule_tasks() self.max_inbound_connections = max_inbound_connections self.max_outbound_connections = max_outbound_connections # BLOCKING logger().info('Starting RMI service handler...') if processing_node is None: self.start_service_handler()
def create_node_from_peer(peer): node = message_types.Node() node.host = peer.host node.port = int(peer.port) node.owner = peer.owner node.node_id = peer.node_id node.phases = peer.phases return node