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

.rstrip("/") for some dst comparisons #920

Merged
merged 3 commits into from
Sep 13, 2021
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
- Temp files are correctly identified for cleanup.
([#912](https://github.com/ericaltendorf/plotman/pull/913))
- Correct where trailing `/` on dst directories resulted in them being considered unused.
([#920](https://github.com/ericaltendorf/plotman/pull/920))
### Added
- `-v`/`--buckets3` and `-K`/`--rmulti2` are configurable for madMAx.
([#869](https://github.com/ericaltendorf/plotman/pull/869))
Expand Down
10 changes: 6 additions & 4 deletions src/plotman/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ def maybe_start_new_plot(
# Plot to oldest tmpdir.
tmpdir = max(rankable, key=operator.itemgetter(1))[0]

dst_dirs = dir_cfg.get_dst_directories()
dst_dirs = [d.rstrip("/") for d in dir_cfg.get_dst_directories()]

dstdir: str
if dir_cfg.dst_is_tmp2():
Expand All @@ -166,11 +166,13 @@ def maybe_start_new_plot(
else:
# Select the dst dir least recently selected
dir2ph = {
d: ph
d.rstrip("/"): ph
for (d, ph) in dstdirs_to_youngest_phase(jobs).items()
if d in dst_dirs and ph is not None
if d.rstrip("/") in dst_dirs and ph is not None
}
unused_dirs = [d for d in dst_dirs if d not in dir2ph.keys()]
unused_dirs = [
d.rstrip("/") for d in dst_dirs if d not in dir2ph.keys()
]
dstdir = ""
if unused_dirs:
dstdir = random.choice(unused_dirs)
Expand Down