-
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.
First hack at no-cycle start-up and shut-down graphs.
- Loading branch information
Showing
6 changed files
with
138 additions
and
21 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
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,55 @@ | ||
# 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/>. | ||
""" | ||
No-cycle logic for isolated start-up and shutdown graphs. | ||
""" | ||
|
||
ALLOWED_VALUES = ("startup", "shutdown") | ||
|
||
class NocyclePoint: | ||
"""A string-valued no-cycle point.""" | ||
|
||
def __init__(self, value: str) -> None: | ||
if value not in ALLOWED_VALUES: | ||
raise ValueError(f"Illegal Nocycle value {value}") | ||
self.value = value | ||
|
||
def __hash__(self): | ||
return hash(self.value) | ||
|
||
def __le__(self, other): | ||
return str(other) == str(self.value) | ||
|
||
def __lt__(self, other): | ||
return False | ||
|
||
def __str__(self): | ||
return self.value | ||
|
||
|
||
class NocycleSequence: | ||
"""A no-cycle sequence is just a point.""" | ||
|
||
def __init__(self, dep_section, p_context_start=None, p_context_stop=None): | ||
"""blah""" | ||
self.point = NocyclePoint(dep_section) | ||
|
||
def is_valid(self, point): | ||
"""Is point on-sequence and in-bounds?""" | ||
return True | ||
|
||
def __str__(self): | ||
return str(self.point) |
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