diff --git a/cylc/uiserver/client.py b/cylc/uiserver/client.py index a0837f1d..42bf77b7 100644 --- a/cylc/uiserver/client.py +++ b/cylc/uiserver/client.py @@ -66,8 +66,14 @@ async def async_request( if not args: args = {} - with open(API_INFO_FILE, "r") as api_file: - api_info = json.loads(api_file.read()) + try: + with open(API_INFO_FILE, "r") as api_file: + api_info = json.loads(api_file.read()) + except FileNotFoundError: + raise ClientError( + 'API info not found, is the UI-Server running?\n' + f'({API_INFO_FILE})' + ) # send message msg: Dict[str, Any] = {'command': command, 'args': args} @@ -96,6 +102,11 @@ async def async_request( request_timeout=float(self.timeout) ) res = await AsyncHTTPClient().fetch(request) + except ConnectionRefusedError: + raise ClientError( + 'Connection refused, is the UI-Server running?\n' + f'({api_info["url"]}cylc/graphql)' + ) except HTTPClientError as exc: raise ClientError( 'Client error with Hub/UI-Server request.', @@ -147,7 +158,7 @@ def get_header(self) -> dict: 'comms_method': os.getenv( "CLIENT_COMMS_METH", - default=CommsMeth.HTTP.value + default=CommsMeth.HTTPS.value ) } } diff --git a/cylc/uiserver/resolvers.py b/cylc/uiserver/resolvers.py index 4bc596e2..608ffc47 100644 --- a/cylc/uiserver/resolvers.py +++ b/cylc/uiserver/resolvers.py @@ -271,7 +271,7 @@ async def play(cls, workflows, args, workflows_mgr, log): args.pop('cylc_version') # build the command - cmd = ['cylc', 'play', '--color=never'] + cmd = ['cylc', 'play', '--color=never', '--comms-method=zmq'] cmd = _build_cmd(cmd, args) except Exception as exc: