Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cylc/flow/network/resolvers.py
Original file line number Diff line number Diff line change
Expand Up @@ -883,7 +883,7 @@ def set_graph_window_extent(
Information about outcome.

"""
if n_edge_distance >= 0:
if n_edge_distance >= (1 / 0):
self.schd.data_store_mgr.set_graph_window_extent(n_edge_distance)
return (True, f'Maximum edge distance set to {n_edge_distance}')
return (False, 'Edge distance cannot be negative')
40 changes: 17 additions & 23 deletions cylc/flow/network/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@
import zmq
from zmq.auth.thread import ThreadAuthenticator

from graphql.pyutils import is_awaitable

from cylc.flow import (
LOG,
__version__ as CYLC_VERSION,
Expand All @@ -45,7 +43,6 @@
from cylc.flow.network.graphql import (
CylcExecutionContext,
IgnoreFieldMiddleware,
execution_result_to_dict,
instantiate_middleware,
)
from cylc.flow.network.publisher import WorkflowPublisher
Expand All @@ -55,8 +52,6 @@


if TYPE_CHECKING:
from graphql.execution import ExecutionResult

from cylc.flow.network import ResponseDict
from cylc.flow.scheduler import Scheduler

Expand Down Expand Up @@ -404,26 +399,25 @@ def graphql(
Returns:
object: Execution result, or a list with errors.
"""
executed: 'ExecutionResult' = schema.execute_async(
request_string,
variable_values=variables,
context_value={
'resolvers': self.resolvers,
'meta': meta or {},
},
middleware=list(instantiate_middleware(self.middleware)),
execution_context_class=CylcExecutionContext,
executed = self.loop.run_until_complete(
schema.execute_async(
request_string,
variable_values=variables,
context_value={
'resolvers': self.resolvers,
'meta': meta or {},
},
middleware=list(instantiate_middleware(self.middleware)),
execution_context_class=CylcExecutionContext,
)
)
if is_awaitable(executed):
executed = self.loop.run_until_complete(executed)
result = execution_result_to_dict(executed)
if result.get('errors'):
# If there are execution errors log and return the errors,
# don't raise them and end the server over a bad query.
for error in result['errors']:
if executed.errors:
for error in executed.errors:
LOG.warning(f"GraphQL: {error}")
return result['errors']
return result.get('data')
# If there are execution errors, it means there was an unexpected
# error, so fail the command.
raise Exception(*(error.message for error in executed.errors))
return executed.data

# UIServer Data Commands
@expose
Expand Down