Skip to content

Commit

Permalink
fix graphql node state and remove ghosts filters
Browse files Browse the repository at this point in the history
  • Loading branch information
dwsutherland committed Mar 31, 2022
1 parent 14623a4 commit de15947
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 34 deletions.
10 changes: 4 additions & 6 deletions cylc/flow/network/resolvers.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,10 @@ def node_ids_filter(tokens, state, items) -> bool:
)
# match cycle/task/job state
and (
not get_state_from_selectors(item)
not (
state
and get_state_from_selectors(item)
)
or get_state_from_selectors(item) == state
)
)
Expand All @@ -219,11 +222,6 @@ def node_filter(node, node_type, args):
state = getattr(node, 'state', None)
return (
(
args.get('ghosts')
or state
or node_type in DEF_TYPES
)
and (
not args.get('states')
or state in args['states']
)
Expand Down
25 changes: 0 additions & 25 deletions cylc/flow/network/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@ class SortArgs(InputObjectType):
reverse = Boolean(default_value=False)


GHOSTS_DEFAULT = Boolean(default_value=False)
STRIP_NULL_DEFAULT = Argument(
Boolean, description="A flag that when enabled strips out those fields "
"not set in the protobuf object. And when this flag "
Expand Down Expand Up @@ -633,7 +632,6 @@ class Meta:
lambda: TaskProxy,
description="""Task cycle instances.""",
args=PROXY_ARGS,
ghosts=GHOSTS_DEFAULT,
strip_null=STRIP_NULL_DEFAULT,
delta_store=DELTA_STORE_DEFAULT,
delta_type=DELTA_TYPE_DEFAULT,
Expand All @@ -642,7 +640,6 @@ class Meta:
lambda: FamilyProxy,
description="""Family cycle instances.""",
args=PROXY_ARGS,
ghosts=GHOSTS_DEFAULT,
strip_null=STRIP_NULL_DEFAULT,
delta_store=DELTA_STORE_DEFAULT,
delta_type=DELTA_TYPE_DEFAULT,
Expand All @@ -665,7 +662,6 @@ class Meta:
nodes_edges = Field(
lambda: NodesEdges,
args=NODES_EDGES_ARGS,
ghosts=GHOSTS_DEFAULT,
strip_null=STRIP_NULL_DEFAULT,
delta_store=DELTA_STORE_DEFAULT,
delta_type=DELTA_TYPE_DEFAULT,
Expand Down Expand Up @@ -757,7 +753,6 @@ class Meta:
lambda: TaskProxy,
description="""Associated cycle point proxies""",
args=PROXY_ARGS,
ghosts=GHOSTS_DEFAULT,
strip_null=STRIP_NULL_DEFAULT,
delta_store=DELTA_STORE_DEFAULT,
delta_type=DELTA_TYPE_DEFAULT,
Expand Down Expand Up @@ -912,7 +907,6 @@ class Meta:
lambda: FamilyProxy,
description="""Task parents.""",
args=PROXY_ARGS,
ghosts=GHOSTS_DEFAULT,
strip_null=STRIP_NULL_DEFAULT,
delta_store=DELTA_STORE_DEFAULT,
delta_type=DELTA_TYPE_DEFAULT,
Expand All @@ -921,7 +915,6 @@ class Meta:
lambda: FamilyProxy,
description="""Task first parent.""",
args=PROXY_ARGS,
ghosts=GHOSTS_DEFAULT,
strip_null=STRIP_NULL_DEFAULT,
delta_store=DELTA_STORE_DEFAULT,
delta_type=DELTA_TYPE_DEFAULT,
Expand All @@ -930,7 +923,6 @@ class Meta:
lambda: FamilyProxy,
description="""First parent ancestors.""",
args=PROXY_ARGS,
ghosts=GHOSTS_DEFAULT,
strip_null=STRIP_NULL_DEFAULT,
delta_store=DELTA_STORE_DEFAULT,
delta_type=DELTA_TYPE_DEFAULT,
Expand All @@ -948,7 +940,6 @@ class Meta:
lambda: FamilyProxy,
description="""Associated cycle point proxies""",
args=PROXY_ARGS,
ghosts=GHOSTS_DEFAULT,
strip_null=STRIP_NULL_DEFAULT,
delta_store=DELTA_STORE_DEFAULT,
delta_type=DELTA_TYPE_DEFAULT,
Expand Down Expand Up @@ -1014,7 +1005,6 @@ class Meta:
TaskProxy,
description="""Descendant task proxies.""",
args=PROXY_ARGS,
ghosts=GHOSTS_DEFAULT,
strip_null=STRIP_NULL_DEFAULT,
delta_store=DELTA_STORE_DEFAULT,
delta_type=DELTA_TYPE_DEFAULT,
Expand All @@ -1023,7 +1013,6 @@ class Meta:
lambda: FamilyProxy,
description="""Descendant family proxies.""",
args=PROXY_ARGS,
ghosts=GHOSTS_DEFAULT,
strip_null=STRIP_NULL_DEFAULT,
delta_store=DELTA_STORE_DEFAULT,
delta_type=DELTA_TYPE_DEFAULT,
Expand All @@ -1032,7 +1021,6 @@ class Meta:
lambda: FamilyProxy,
description="""Task first parent.""",
args=PROXY_ARGS,
ghosts=GHOSTS_DEFAULT,
strip_null=STRIP_NULL_DEFAULT,
delta_store=DELTA_STORE_DEFAULT,
delta_type=DELTA_TYPE_DEFAULT,
Expand All @@ -1041,7 +1029,6 @@ class Meta:
lambda: FamilyProxy,
description="""First parent ancestors.""",
args=PROXY_ARGS,
ghosts=GHOSTS_DEFAULT,
strip_null=STRIP_NULL_DEFAULT,
delta_store=DELTA_STORE_DEFAULT,
delta_type=DELTA_TYPE_DEFAULT,
Expand Down Expand Up @@ -1152,7 +1139,6 @@ class Meta:
TaskProxy,
description=TaskProxy._meta.description,
args=ALL_PROXY_ARGS,
ghosts=GHOSTS_DEFAULT,
strip_null=STRIP_NULL_DEFAULT,
resolver=get_nodes_all)
family = Field(
Expand All @@ -1177,7 +1163,6 @@ class Meta:
FamilyProxy,
description=FamilyProxy._meta.description,
args=ALL_PROXY_ARGS,
ghosts=GHOSTS_DEFAULT,
strip_null=STRIP_NULL_DEFAULT,
resolver=get_nodes_all)
edges = graphene.List(
Expand All @@ -1190,7 +1175,6 @@ class Meta:
NodesEdges,
description=NodesEdges._meta.description,
args=NODES_EDGES_ARGS_ALL,
ghosts=GHOSTS_DEFAULT,
strip_null=STRIP_NULL_DEFAULT,
resolver=get_nodes_edges)

Expand Down Expand Up @@ -1943,7 +1927,6 @@ class Delta(Interface):
FamilyProxy,
description="""Family cycle instances.""",
args=PROXY_ARGS,
ghosts=Boolean(default_value=True),
strip_null=Boolean(),
delta_store=Boolean(default_value=True),
delta_type=String(default_value=DELTA_ADDED),
Expand Down Expand Up @@ -1971,7 +1954,6 @@ class Delta(Interface):
TaskProxy,
description="""Task cycle instances.""",
args=PROXY_ARGS,
ghosts=Boolean(default_value=True),
strip_null=Boolean(),
delta_store=Boolean(default_value=True),
delta_type=String(default_value=DELTA_ADDED),
Expand Down Expand Up @@ -2020,7 +2002,6 @@ class Meta:
FamilyProxy,
description="""Family cycle instances.""",
args=PROXY_ARGS,
ghosts=Boolean(default_value=False),
strip_null=Boolean(),
delta_store=Boolean(default_value=True),
delta_type=String(default_value=DELTA_UPDATED),
Expand Down Expand Up @@ -2048,7 +2029,6 @@ class Meta:
TaskProxy,
description="""Task cycle instances.""",
args=PROXY_ARGS,
ghosts=Boolean(default_value=False),
strip_null=Boolean(),
delta_store=Boolean(default_value=True),
delta_type=String(default_value=DELTA_UPDATED),
Expand Down Expand Up @@ -2172,7 +2152,6 @@ class Meta:
TaskProxy,
description=TaskProxy._meta.description,
id=ID(required=True),
ghosts=Boolean(default_value=True),
strip_null=Boolean(default_value=True),
delta_store=Boolean(default_value=True),
delta_type=String(default_value=DELTA_ADDED),
Expand All @@ -2184,7 +2163,6 @@ class Meta:
TaskProxy,
description=TaskProxy._meta.description,
args=ALL_PROXY_ARGS,
ghosts=Boolean(default_value=True),
strip_null=Boolean(default_value=True),
delta_store=Boolean(default_value=True),
delta_type=String(default_value=DELTA_ADDED),
Expand Down Expand Up @@ -2218,7 +2196,6 @@ class Meta:
FamilyProxy,
description=FamilyProxy._meta.description,
id=ID(required=True),
ghosts=Boolean(default_value=True),
strip_null=Boolean(default_value=True),
delta_store=Boolean(default_value=True),
delta_type=String(default_value=DELTA_ADDED),
Expand All @@ -2230,7 +2207,6 @@ class Meta:
FamilyProxy,
description=FamilyProxy._meta.description,
args=ALL_PROXY_ARGS,
ghosts=Boolean(default_value=True),
strip_null=Boolean(default_value=True),
delta_store=Boolean(default_value=True),
delta_type=String(default_value=DELTA_ADDED),
Expand All @@ -2253,7 +2229,6 @@ class Meta:
NodesEdges,
description=NodesEdges._meta.description,
args=NODES_EDGES_ARGS_ALL,
ghosts=Boolean(default_value=True),
strip_null=Boolean(default_value=True),
delta_store=Boolean(default_value=True),
delta_type=String(default_value=DELTA_ADDED),
Expand Down
3 changes: 0 additions & 3 deletions tests/integration/test_resolvers.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ def flow_args():
@pytest.fixture
def node_args():
return {
'ghosts': False,
'workflows': [],
'exworkflows': [],
'ids': [],
Expand Down Expand Up @@ -114,7 +113,6 @@ async def test_get_nodes_all(mock_flow, node_args):
node_args['states'].append('failed')
nodes = await mock_flow.resolvers.get_nodes_all(TASK_PROXIES, node_args)
assert len(nodes) == 0
node_args['ghosts'] = True
node_args['states'] = []
node_args['ids'].append(Tokens(mock_flow.node_ids[0]))
nodes = [
Expand All @@ -136,7 +134,6 @@ async def test_get_nodes_by_ids(mock_flow, node_args):
nodes = await mock_flow.resolvers.get_nodes_by_ids(TASK_PROXIES, node_args)
assert len(nodes) == 0

node_args['ghosts'] = True
node_args['native_ids'] = mock_flow.node_ids
nodes = [
n
Expand Down

0 comments on commit de15947

Please sign in to comment.