diff --git a/gnes/composer/base.py b/gnes/composer/base.py index 0f491185..03d16a8e 100644 --- a/gnes/composer/base.py +++ b/gnes/composer/base.py @@ -175,8 +175,8 @@ def build_dockerswarm(all_layers: List['YamlGraph.Layer'], docker_img: str = 'gn host_in_name = '%s%d%d' % (_c['name'], _l_idx, _c_idx) break - args += ['--host_in %s' % host_in_name, - '--host_out %s' % host_out_name] + args += ['--host_in %s' % host_in_name] + # '--host_out %s' % host_out_name] cmd = '%s %s' % (YamlGraph.comp2file[c['name']], ' '.join(args)) swarm_lines['services'][c_name] = { @@ -266,7 +266,7 @@ def build_mermaid(all_layers: List['YamlGraph.Layer'], mermaid_leftright: bool = # if len(last_layer.components) > 1: # self.mermaid_graph.append('\tend') - style = ['classDef FrontendCLS fill:#FFFFCB,stroke:#277CE8,stroke-width:1px,stroke-dasharray:5;', + style = ['classDef FrontendCLS fill:#ffb347,stroke:#277CE8,stroke-width:1px,stroke-dasharray:5;', 'classDef EncoderCLS fill:#27E1E8,stroke:#277CE8,stroke-width:1px;', 'classDef IndexerCLS fill:#27E1E8,stroke:#277CE8,stroke-width:1px;', 'classDef RouterCLS fill:#2BFFCB,stroke:#277CE8,stroke-width:1px;', @@ -417,20 +417,29 @@ def rule8(): 'port_out': self._get_random_port()}) for c in last_layer.components: - c['socket_out'] = str(SocketType.PUSH_CONNECT) - r_c = CommentedMap({'name': 'Router', - 'yaml_path': None, - 'socket_in': str(SocketType.PULL_BIND), - 'socket_out': str(SocketType.PUSH_CONNECT), - 'port_in': self._get_random_port(), - 'port_out': r['port_in']}) - c['port_out'] = r_c['port_in'] - router_layer.append(r_c) + last_income = self.Layer.get_value(c, 'income') + if last_income == 'sub': + c['socket_out'] = str(SocketType.PUSH_CONNECT) + r_c = CommentedMap({'name': 'Router', + 'yaml_path': None, + 'socket_in': str(SocketType.PULL_BIND), + 'socket_out': str(SocketType.PUSH_CONNECT), + 'port_in': self._get_random_port(), + 'port_out': r['port_in']}) + c['port_out'] = r_c['port_in'] + router_layer.append(r_c) + elif last_income == 'pull': + c['socket_out'] = str(SocketType.PUSH_CONNECT) + c['port_out'] = r['port_in'] for c in layer.components: c['socket_in'] = str(SocketType.PULL_CONNECT) c['port_in'] = r['port_out'] - router_layers.append(router_layer) + + if router_layer.components: + router_layers.append(router_layer) + else: + self._num_layer -= 1 router_layer = YamlGraph.Layer(layer_id=self._num_layer) self._num_layer += 1 diff --git a/gnes/resources/static/gnes-board.html b/gnes/resources/static/gnes-board.html index ef704b79..81fc94e0 100644 --- a/gnes/resources/static/gnes-board.html +++ b/gnes/resources/static/gnes-board.html @@ -194,7 +194,7 @@