def load(manager, units=<NUM_LIT>):
pb_connecting = manager.counter(total=units, desc='<STR_LIT>', unit='<STR_LIT>',<EOL>color='<STR_LIT>', bar_format=BAR_FMT)<EOL>pb_loading = pb_connecting.add_subcounter('<STR_LIT>')<EOL>pb_loaded = pb_connecting.add_subcounter('<STR_LIT>', all_fields=True)<EOL>connecting = []<EOL>loading = []<EOL>loaded = []<EOL>count = <NUM_LIT:0><EOL>while pb_loaded.count < units:<EOL><INDENT>time.sleep(random.uniform(<NUM_LIT>, <NUM_LIT>))  <EOL>for idx, node in enumerate(loading):<EOL><INDENT>if node.loaded:<EOL><INDENT>loading.pop(idx)<EOL>loaded.append(node)<EOL>LOGGER.info('<STR_LIT>', node.iden)<EOL>pb_loaded.update_from(pb_loading)<EOL><DEDENT><DEDENT>for idx, node in enumerate(connecting):<EOL><INDENT>if node.connected:<EOL><INDENT>connecting.pop(idx)<EOL>node.load()<EOL>loading.append(node)<EOL>LOGGER.info('<STR_LIT>', node.iden)<EOL>pb_loading.update_from(pb_connecting)<EOL><DEDENT><DEDENT>for _ in range(<NUM_LIT:0>, min(units - count, <NUM_LIT:5> - len(connecting))):<EOL><INDENT>node = Node(count)<EOL>node.connect()<EOL>connecting.append(node)<EOL>LOGGER.info('<STR_LIT>', node.iden)<EOL>pb_connecting.update()<EOL>count += <NUM_LIT:1><EOL><DEDENT><DEDENT>
Simulate loading services from a remote node
States are connecting (red), loading(yellow), and loaded (green)