Skip to content

Commit

Permalink
http => https comms method string, play via zmq
Browse files Browse the repository at this point in the history
  • Loading branch information
dwsutherland committed Jan 19, 2023
1 parent 3b52874 commit 344246c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
17 changes: 14 additions & 3 deletions cylc/uiserver/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down Expand Up @@ -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.',
Expand Down Expand Up @@ -147,7 +158,7 @@ def get_header(self) -> dict:
'comms_method':
os.getenv(
"CLIENT_COMMS_METH",
default=CommsMeth.HTTP.value
default=CommsMeth.HTTPS.value
)
}
}
2 changes: 1 addition & 1 deletion cylc/uiserver/resolvers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 344246c

Please sign in to comment.