args = [(x if not x in argfix else argfix[x]) for x in sys.argv[1:]] parser = ArgumentParser(prog=sys.argv[0], description="Master server") parser.add_argument('--primary_address', '-pa', type=str, default="", help="primary communication server's IPv4/6 address or host name") parser.add_argument('--primary_port', '-pp', type=int, default=2121, help="primary communication server's port") parser.add_argument('--port', '-p', type=int, default=2121, help="port to listen on") parser.add_argument('--backup', '-b', action="store_true", help="are we a backup server?") parser.add_argument('--timeout', '-t', type=int, default=5, help="component timeout (s)") args = parser.parse_args(args) config = Namespace() config.parent_address = None config.parent_port = None config.child_address = None config.child_port = None config.child_id = None config.is_backup = args.backup config.timeout = args.timeout problemStartTime = {} # The important # information that are synchronized are the existing CN and TM and their current activities and the data of # tasks, partial problems, partial solutions and final solutions. Each backup server connects first with the # main CS but if it is not the first backup server it registers with the current last backup server. In that way, # each backup server needs to store only one set of data to be synchronized. The current information is # sent to the backup CS when it registers with the CS of a higher level and is updated after each # [Register or data message message Received || Inactive component removed # => Add information to synchronization queue and update internal information def registerTMCN(conn, msg): id = components.add(msg)