|
25 | 25 | from glob import glob |
26 | 26 | import os |
27 | 27 | from pathlib import Path |
28 | | -import socket |
29 | 28 | from typing import Annotated |
30 | 29 |
|
31 | 30 | LOG_ROOT_TMPL = "~/.cylc/%(ns)s-%(util)s-%(host)s-%(port)s" |
@@ -162,39 +161,24 @@ def get_util_home(*args): |
162 | 161 |
|
163 | 162 |
|
164 | 163 | def get_review_service_config( |
165 | | - ports: tuple[Annotated[int, Ge(0)], Annotated[int, Ge(0)]] = (8000, 8999), |
| 164 | + port: Annotated[int, Ge(0)] = 8042, |
166 | 165 | service_root: str = 'services/cylc' |
167 | 166 | ) -> dict: |
168 | 167 | """Get a configuration for Cylc Review as a service. |
169 | 168 |
|
170 | 169 | Args: |
171 | | - ports: A range of ports to attempt to make the Cylc Review service |
172 | | - available on. |
| 170 | + port: The port to make the Cylc Review service available on. |
173 | 171 | service_root: Include web service name under root of URL. |
174 | 172 |
|
175 | 173 | Returns: |
176 | 174 | Dictionary of settings for Cylc Review to be run as a hub service. |
177 | 175 | """ |
178 | | - port_found = False |
179 | | - for port in range(ports[0], ports[1]): |
180 | | - with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s: |
181 | | - try: |
182 | | - s.bind(('localhost', port)) |
183 | | - except Exception: |
184 | | - pass |
185 | | - else: |
186 | | - port_found = True |
187 | | - break |
188 | | - |
189 | | - if not port_found: |
190 | | - print('No suitable port found.') |
191 | | - |
192 | 176 | return { |
193 | 177 | "name": "cylc-review", |
194 | 178 | "command": [ |
195 | 179 | "cylc", "review", "start", |
196 | 180 | f"--port={port}", |
197 | 181 | f"--service-root={service_root}", |
198 | 182 | ], |
199 | | - "url": f"http://127.0.0.1:{port}/", |
| 183 | + "url": f"http://0.0.0.0:{port}/", |
200 | 184 | } |
0 commit comments