forked from cylc/cylc-flow
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/master' into feature.sim_mode_…
…at_runtime * upstream/master: log_vc_info: handle long command output (cylc#5821) GH Actions: limit tutorial workflow to Py3.11 remove cylc task dependencies env var (cylc#5836) Refactor.lint (cylc#5718) protobuf 4.24.4 upgrade (cylc#5828) made reinstall work on multiple workflows Fix `IndepQueueManager` test (cylc#5832) Lint: Add a check for indentation being 4N spaces. (cylc#5772)
- Loading branch information
Showing
21 changed files
with
528 additions
and
330 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Add a check for indentation being 4N spaces. |
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 @@ | ||
Updated 'reinstall' functionality to support multiple workflows |
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 @@ | ||
Fixed issue where large uncommitted changes could cause `cylc install` to hang. |
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 @@ | ||
Removed the 'CYLC_TASK_DEPENDENCIES' environment variable |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,73 @@ | ||
# 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/>. | ||
|
||
"""Utility for preventing pipes from getting clogged up. | ||
If you're reading files from Popen (i.e. to extract command output) where the | ||
command output has the potential to be long-ish, then you should use this | ||
function to protect against the buffer filling up. | ||
Note, there is a more advanced version of this baked into the subprocpool. | ||
""" | ||
|
||
from select import select | ||
|
||
|
||
def pipe_poller(proc, *files, chunk_size=4096): | ||
"""Read from a process without hitting buffer issues. | ||
Standin for subprocess.Popen.communicate. | ||
When PIPE'ing from subprocesses, the output goes into a buffer. If the | ||
buffer gets full, the subprocess will hang trying to write to it. | ||
This function polls the process, reading output from the buffers into | ||
memory to prevent them from filling up. | ||
Args: | ||
proc: | ||
The process to poll. | ||
files: | ||
The files you want to read from, likely anything you've directed to | ||
PIPE. | ||
chunk_size: | ||
The amount of text to read from the buffer on each pass. | ||
Returns: | ||
tuple - The text read from each of the files in the order they were | ||
specified. | ||
""" | ||
_files = { | ||
file: b'' if 'b' in getattr(file, 'mode', 'r') else '' | ||
for file in files | ||
} | ||
|
||
def _read(timeout=1.0): | ||
# read any data from files | ||
nonlocal chunk_size, files | ||
for file in select(list(files), [], [], timeout)[0]: | ||
buffer = file.read(chunk_size) | ||
if len(buffer) > 0: | ||
_files[file] += buffer | ||
|
||
while proc.poll() is None: | ||
# read from the buffers | ||
_read() | ||
# double check the buffers now that the process has finished | ||
_read(timeout=0.01) | ||
|
||
return tuple(_files.values()) |
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
Oops, something went wrong.