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

Release/v0.5.3 #930

Merged
merged 27 commits into from
Sep 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
df02902
Disable tty usage to prevent blocking on calls from other processes
guydavis Sep 7, 2021
1469568
Use use_stty_size setting for analzye too.
guydavis Sep 7, 2021
a23c1c6
Merge branch 'ericaltendorf:development' into development
guydavis Sep 12, 2021
00c8dd6
Correct typing hopefully.
guydavis Sep 12, 2021
5e8724b
Typing attempt failed Github checks, reverting.
guydavis Sep 12, 2021
e634fcb
+dev and unreleased changelog sections
altendky Sep 13, 2021
862bfb2
Merge branch 'ericaltendorf:development' into development
guydavis Sep 13, 2021
b4714aa
Merge pull request #924 from altendky/main_to_development_v0.5.2
altendky Sep 13, 2021
9ddb292
handle the case when no log file is found
altendky Sep 13, 2021
478b801
Correct a changelog link
altendky Sep 13, 2021
cf81e6c
changelog for 926
altendky Sep 13, 2021
8d47f47
changelog for 926
altendky Sep 13, 2021
fc5491b
Merge branch 'ericaltendorf:development' into development
guydavis Sep 14, 2021
42b2404
Trying to address typing and line length issues with build.
guydavis Sep 14, 2021
8787103
Formatter wants trailing commas...
guydavis Sep 14, 2021
836a489
More format changes.
guydavis Sep 14, 2021
513eade
Dueling formatters... Github wins I guess.
guydavis Sep 14, 2021
5747f1f
Merge pull request #926 from altendky/handle_no_logfile_case
altendky Sep 18, 2021
270e67e
Merge branch 'development' into altendky-patch-2
altendky Sep 18, 2021
c1f77f9
Merge pull request #927 from ericaltendorf/altendky-patch-2
altendky Sep 18, 2021
f14ad0e
Create disk spaces log path
altendky Sep 19, 2021
034003b
changelog for 929
altendky Sep 19, 2021
37b5478
Merge pull request #929 from altendky/create_disk_space_log_path
altendky Sep 19, 2021
69c4888
Merge branch 'development' into development
altendky Sep 19, 2021
cc2f1b3
changelog for 918
altendky Sep 19, 2021
d2cae7c
Merge pull request #918 from guydavis/development
altendky Sep 19, 2021
70e8a48
set v0.5.3
altendky Sep 19, 2021
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
11 changes: 10 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,19 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.5.3] - 2021-09-19
### Fixed
- Regression in v0.5.2 where plotting processes that lack log files caused a traceback.
([#926](https://github.com/ericaltendorf/plotman/pull/926))
- Create the directory for the new disk spaces log file.
([#929](https://github.com/ericaltendorf/plotman/pull/929))
- Better handle non-interactive uses that had trouble while detecting the (non-existant) terminal size.
([#918](https://github.com/ericaltendorf/plotman/pull/918))

## [0.5.2] - 2021-09-12
### Fixed
- Temp files are correctly identified for cleanup.
([#912](https://github.com/ericaltendorf/plotman/pull/913))
([#912](https://github.com/ericaltendorf/plotman/pull/912))
- Correct where trailing `/` on dst directories resulted in them being considered unused.
([#920](https://github.com/ericaltendorf/plotman/pull/920))
### Added
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.5.2
0.5.3
7 changes: 5 additions & 2 deletions src/plotman/analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@


def analyze(
logfilenames: typing.List[str], clipterminals: bool, bytmp: bool, bybitfield: bool
logfilenames: typing.List[str],
clipterminals: bool,
bytmp: bool,
bybitfield: bool,
columns: int,
) -> None:
data: typing.Dict[str, typing.Dict[str, typing.List[float]]] = {}
for logfilename in logfilenames:
Expand Down Expand Up @@ -165,7 +169,6 @@ def analyze(

tab.add_row(row)

(rows, columns) = os.popen("stty size", "r").read().split()
tab.set_max_width(int(columns))
s = tab.draw()
print(s)
8 changes: 1 addition & 7 deletions src/plotman/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,7 @@ def setup(self) -> None:
os.makedirs(self.plots, exist_ok=True)
os.makedirs(self.transfers, exist_ok=True)
os.makedirs(os.path.dirname(self.application), exist_ok=True)
os.makedirs(os.path.dirname(self.disk_spaces), exist_ok=True)

def create_plot_log_path(self, time: pendulum.DateTime) -> str:
return self._create_log_path(
Expand All @@ -343,13 +344,6 @@ def create_transfer_log_path(self, time: pendulum.DateTime) -> str:
group="transfer",
)

def create_tdisk_space_log_path(self, time: pendulum.DateTime) -> str:
return self._create_log_path(
time=time,
directory=self.disk_spaces,
group="disk_space",
)

def _create_log_path(
self, time: pendulum.DateTime, directory: str, group: str
) -> str:
Expand Down
16 changes: 11 additions & 5 deletions src/plotman/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import glob
import time
from datetime import datetime
import sys
import typing

import attr
Expand Down Expand Up @@ -105,7 +106,7 @@ class Job:

plotter: "plotman.plotters.Plotter"

logfile: str = ""
logfile: typing.Optional[str] = None
job_id: int = 0
proc: psutil.Process

Expand Down Expand Up @@ -189,10 +190,11 @@ def get_running_jobs(
plotter=plotter,
logroot=logroot,
)
# TODO: stop reloading every time...
with open(job.logfile, "rb") as f:
r = f.read()
job.plotter.update(chunk=r)
if job.logfile is not None:
# TODO: stop reloading every time...
with open(job.logfile, "rb") as f:
r = f.read()
job.plotter.update(chunk=r)
jobs.append(job)

return jobs
Expand Down Expand Up @@ -254,6 +256,10 @@ def status_str_long(self) -> str:
# )

def print_logs(self, follow: bool = False) -> None:
if self.logfile is None:
print("no log file available for this plotting process", file=sys.stderr)
return

with open(self.logfile, "r") as f:
if follow:
line = ""
Expand Down
26 changes: 17 additions & 9 deletions src/plotman/plotman.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,12 +161,16 @@ def parse_args(self) -> typing.Any:
return args


def get_term_width() -> int:
try:
(rows_string, columns_string) = os.popen("stty size", "r").read().split()
columns = int(columns_string)
except:
columns = 120 # 80 is typically too narrow. TODO: make a command line arg.
def get_term_width(cfg: configuration.PlotmanConfig) -> int:
default_columns = 120 # 80 is typically too narrow.
if cfg.user_interface.use_stty_size:
try:
(rows_string, columns_string) = os.popen("stty size", "r").read().split()
columns = int(columns_string)
except:
columns = default_columns
else:
columns = default_columns
return columns


Expand Down Expand Up @@ -293,7 +297,11 @@ def main() -> None:
elif args.cmd == "analyze":

analyzer.analyze(
args.logfile, args.clipterminals, args.bytmp, args.bybitfield
args.logfile,
args.clipterminals,
args.bytmp,
args.bybitfield,
get_term_width(cfg),
)

#
Expand All @@ -317,7 +325,7 @@ def main() -> None:
result = reporting.json_report(jobs)
else:
result = "{0}\n\n{1}\n\nUpdated at: {2}".format(
reporting.status_report(jobs, get_term_width()),
reporting.status_report(jobs, get_term_width(cfg)),
reporting.summary(jobs),
datetime.datetime.today().strftime("%c"),
)
Expand All @@ -335,7 +343,7 @@ def main() -> None:
cfg.directories,
cfg.archiving,
cfg.scheduling,
get_term_width(),
get_term_width(cfg),
)
)

Expand Down
19 changes: 11 additions & 8 deletions src/plotman/resources/plotman.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,17 @@
# https://github.com/ericaltendorf/plotman/wiki/Configuration#versions
version: [2]

logging:
# One directory in which to store all plot job logs (the STDOUT/
# STDERR of all plot jobs). In order to monitor progress, plotman
# reads these logs on a regular basis, so using a fast drive is
# recommended.
plots: /home/chia/chia/logs
# transfers:
# application:
#logging:
# # One directory in which to store all plot job logs (the STDOUT/
# # STDERR of all plot jobs). In order to monitor progress, plotman
# # reads these logs on a regular basis, so using a fast drive is
# # recommended.
# # For Linux, these paths default to a directory under ~/.local/share/plotman/
# plots: <directory>
# transfers: <directory>
# # For Linux, these paths default to a file at ~/.cache/plotman/log/
# application: <file>
# disk_spaces: <file>
ericaltendorf marked this conversation as resolved.
Show resolved Hide resolved

# Options for display and rendering
user_interface:
Expand Down