Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

n-distance data-store graph window generation/pruning #3811

Merged
merged 8 commits into from
Nov 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
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
5 changes: 5 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ compatibility, the `cylc run` command will automatically symlink an existing

### Enhancements

[#3811](https://github.com/cylc/cylc-flow/pull/3811) - Move from cycle based
to `n` distance dependency graph window node generation and pruning of the
data-store (API/visual backing data). Ability to modify distance of live
workflow via API, with default of `n=1`.

[#3899](https://github.com/cylc/cylc-flow/pull/3899) - CLI changes
* Commands no longer re-invoke (so you get `cylc run` not `cylc-run`).
* Improve CLI descriptions and help.
Expand Down
99 changes: 1 addition & 98 deletions cylc/flow/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -1742,7 +1742,7 @@ def generate_triggers(self, lexpression, left_nodes, right, seq,
# (name is left name)
self.taskdefs[name].add_graph_child(task_trigger, right, seq)
# graph_parents not currently used but might be needed soon:
# self.taskdefs[right].add_graph_parent(task_trigger, name, seq)
self.taskdefs[right].add_graph_parent(task_trigger, name, seq)
hjoliver marked this conversation as resolved.
Show resolved Hide resolved

# Walk down "expr_list" depth first, and replace any items matching a
# key in "triggers" ("left" values) with the trigger.
Expand Down Expand Up @@ -1994,103 +1994,6 @@ def get_graph_raw(self, start_point_string, stop_point_string,
self._last_graph_raw_edges = graph_raw_edges
return graph_raw_edges

def get_graph_edges(self, start_point, stop_point):
"""Convert the abstract graph edges (self.edges, etc) to actual edges

This method differs from the get_graph_raw; class attributes are not
used to hold information from previous method calls, and only ungrouped
edges are returned.

Args:
start_point (cylc.flow.cycling.*Point):
Start Integer or ISO8601 Point.
stop_point (cylc.flow.cycling.*Point):
Stop Integer or ISO8601 Point.
"""

if start_point is None:
raise TypeError(
"get_graph_edges() start_point argument must be a"
" valid cycle point, not 'NoneType'")
# Avoid infinite edge generation
if stop_point is None:
raise TypeError(
"get_graph_edges() stop_point argument must be a"
" valid cycle point, not 'NoneType'")
suite_final_point = get_point(
self.cfg['scheduling']['final cycle point'])

# Get ICP on-sequence point
actual_first_point = self.get_actual_first_point(self.start_point)

gr_edges = {}
start_point_offset_cache = {}
point_offset_cache = None
for sequence, edges in self.edges.items():
# Get first cycle point for this sequence
point = sequence.get_first_point(start_point)
while point is not None:
if point > stop_point:
# Beyond requested final cycle point.
break
if suite_final_point is not None and point > suite_final_point:
# Beyond suite final cycle point.
break
point_offset_cache = {}
for left, right, suicide, cond in edges:
if right:
r_id = (right, point)
else:
r_id = None
if left.startswith('@'):
# @trigger node.
name = left
offset_is_from_icp = False
offset = None
else:
name, offset, _, offset_is_from_icp, _, _ = (
GraphNodeParser.get_inst().parse(left))
if offset:
if offset_is_from_icp:
cache = start_point_offset_cache
# use actual ICP first point
rel_point = actual_first_point
else:
cache = point_offset_cache
rel_point = point
try:
l_point = cache[offset]
except KeyError:
l_point = get_point_relative(offset, rel_point)
cache[offset] = l_point
else:
l_point = point
l_id = (name, l_point)

if l_id is None and r_id is None:
continue
if l_id is not None and actual_first_point > l_id[1]:
# Check that l_id is not earlier than start time.
if r_id is None or r_id[1] < actual_first_point:
continue
# Pre-initial dependency;
# keep right hand node.
l_id = r_id
r_id = None
if point not in gr_edges:
gr_edges[point] = []
# only used to get task ID here
lstr, rstr = self._close_families(l_id, r_id, {})
gr_edges[point].append((lstr, rstr, None, suicide, cond))
# Increment the cycle point.
point = sequence.get_next_point_on_sequence(point)

del start_point_offset_cache
del point_offset_cache
GraphNodeParser.get_inst().clear()
# Flatten nested list.
return [i for sublist in gr_edges.values() for i in sublist]

def get_node_labels(self, start_point_string, stop_point_string=None):
"""Return dependency graph node labels."""
stop_point = None
Expand Down
Loading