-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
commit ad8231a8f22dd3cd8d887774474f97df2c83e429 Merge: acc0ca3 6fc3c58 Author: Hilary James Oliver <hilary.j.oliver@gmail.com> Date: Mon Mar 20 10:27:19 2023 +1300 Merge branch 'master' into initial-final-graph commit acc0ca3 Author: Hilary Oliver <hilary.j.oliver@gmail.com> Date: Wed Oct 26 12:00:00 2022 +1300 Style fix. commit a7170fb Author: Hilary Oliver <hilary.j.oliver@gmail.com> Date: Wed Oct 26 11:53:31 2022 +1300 Update change log. commit 9024065 Merge: 858a8c1 b0ff549 Author: Hilary Oliver <hilary.j.oliver@gmail.com> Date: Wed Oct 26 11:32:26 2022 +1300 Merge branch 'master' into initial-final-graph commit 858a8c1 Author: Hilary James Oliver <hilary.j.oliver@gmail.com> Date: Mon Sep 26 23:27:01 2022 +1300 Fix alpha/omega graph runahead release. commit b581ab2 Author: Hilary James Oliver <hilary.j.oliver@gmail.com> Date: Mon Sep 26 23:26:33 2022 +1300 Add new func tests. commit 8d09900 Author: Hilary James Oliver <hilary.j.oliver@gmail.com> Date: Mon Sep 26 15:53:42 2022 +1300 Revert graph sorting change. commit 75c1763 Author: Hilary James Oliver <hilary.j.oliver@gmail.com> Date: Fri Sep 23 22:44:08 2022 +1200 Adapt integration tests. commit 1b685a0 Author: Hilary James Oliver <hilary.j.oliver@gmail.com> Date: Fri Sep 23 15:55:57 2022 +1200 Tidy up. commit 7a62450 Author: Hilary James Oliver <hilary.j.oliver@gmail.com> Date: Fri Sep 23 13:20:51 2022 +1200 Switch to alpha and omega. commit 129c2e3 Author: Hilary James Oliver <hilary.j.oliver@gmail.com> Date: Fri Sep 23 10:32:54 2022 +1200 Implicit integer ICP if only nocycle graphs. commit a53ac82 Author: Hilary James Oliver <hilary.j.oliver@gmail.com> Date: Thu Sep 22 16:23:16 2022 +1200 startup and shutdown graphs; needs tidying
- Loading branch information
Showing
26 changed files
with
627 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Implement initial and final graphs, distinct from the main cycling graph. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,159 @@ | ||
# THIS FILE IS PART OF THE CYLC WORKFLOW ENGINE. | ||
# Copyright (C) NIWA & British Crown (Met Office) & Contributors. | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
""" | ||
Cycling logic for isolated non-cycling startup and shutdown graphs. | ||
""" | ||
|
||
from cylc.flow.cycling import PointBase, SequenceBase, cmp | ||
|
||
# TODO: scheduler check DB to be sure alpha and omega sections have run or not. | ||
|
||
# cycle point values | ||
NOCYCLE_PT_ALPHA = "alpha" | ||
NOCYCLE_PT_OMEGA = "omega" | ||
|
||
NOCYCLE_POINTS = ( | ||
NOCYCLE_PT_ALPHA, | ||
NOCYCLE_PT_OMEGA | ||
) | ||
|
||
CYCLER_TYPE_NOCYCLE = "nocycle" | ||
CYCLER_TYPE_SORT_KEY_NOCYCLE = 1 | ||
|
||
|
||
class NocyclePoint(PointBase): | ||
"""A string-valued point.""" | ||
|
||
TYPE = CYCLER_TYPE_NOCYCLE | ||
TYPE_SORT_KEY = CYCLER_TYPE_SORT_KEY_NOCYCLE | ||
|
||
__slots__ = ('value') | ||
|
||
def __init__(self, value: str) -> None: | ||
if value not in [NOCYCLE_PT_ALPHA, NOCYCLE_PT_OMEGA]: | ||
raise ValueError(f"Illegal Nocycle value {value}") | ||
self.value = value | ||
|
||
def __hash__(self): | ||
return hash(self.value) | ||
|
||
def __eq__(self, other): | ||
return str(other) == self.value | ||
|
||
def __le__(self, other): | ||
"""less than or equal only if equal.""" | ||
return str(other) == self.value | ||
|
||
def __lt__(self, other): | ||
"""never less than.""" | ||
return False | ||
|
||
def __gt__(self, other): | ||
"""never greater than.""" | ||
return False | ||
|
||
def __str__(self): | ||
return self.value | ||
|
||
def _cmp(self, other): | ||
return cmp(int(self), int(other)) | ||
|
||
def add(self, other): | ||
# NOT USED | ||
return None | ||
|
||
def sub(self, other): | ||
# NOT USED | ||
return None | ||
|
||
|
||
class NocycleSequence(SequenceBase): | ||
"""A single point sequence.""" | ||
|
||
def __init__(self, dep_section, p_context_start=None, p_context_stop=None): | ||
"""Workflow cycling context is ignored.""" | ||
self.point = NocyclePoint(dep_section) | ||
|
||
def __hash__(self): | ||
return hash(str(self.point)) | ||
|
||
def is_valid(self, point): | ||
"""Is point on-sequence and in-bounds?""" | ||
return str(point) == self.point | ||
|
||
def get_first_point(self, point): | ||
"""First point is the only point""" | ||
return self.point | ||
|
||
def get_next_point(self, point): | ||
"""There is no next point""" | ||
return None | ||
|
||
def get_next_point_on_sequence(self, point): | ||
"""There is no next point""" | ||
return None | ||
|
||
def __eq__(self, other): | ||
try: | ||
return other.point == self.point | ||
except AttributeError: | ||
# (other is not a nocycle sequence) | ||
return False | ||
|
||
def __str__(self): | ||
return str(self.point) | ||
|
||
def TYPE(self): | ||
raise NotImplementedError | ||
|
||
def TYPE_SORT_KEY(self): | ||
raise NotImplementedError | ||
|
||
def get_async_expr(cls, start_point=0): | ||
raise NotImplementedError | ||
|
||
def get_interval(self): | ||
"""Return the cycling interval of this sequence.""" | ||
raise NotImplementedError | ||
|
||
def get_offset(self): | ||
"""Deprecated: return the offset used for this sequence.""" | ||
raise NotImplementedError | ||
|
||
def set_offset(self, i_offset): | ||
"""Deprecated: alter state to offset the entire sequence.""" | ||
raise NotImplementedError | ||
|
||
def is_on_sequence(self, point): | ||
"""Is point on-sequence, disregarding bounds?""" | ||
raise NotImplementedError | ||
|
||
def get_prev_point(self, point): | ||
"""Return the previous point < point, or None if out of bounds.""" | ||
raise NotImplementedError | ||
|
||
def get_nearest_prev_point(self, point): | ||
"""Return the largest point < some arbitrary point.""" | ||
raise NotImplementedError | ||
|
||
def get_stop_point(self): | ||
"""Return the last point in this sequence, or None if unbounded.""" | ||
raise NotImplementedError | ||
|
||
|
||
NOCYCLE_SEQ_ALPHA = NocycleSequence(NOCYCLE_PT_ALPHA) | ||
NOCYCLE_SEQ_OMEGA = NocycleSequence(NOCYCLE_PT_OMEGA) |
Oops, something went wrong.