-
Notifications
You must be signed in to change notification settings - Fork 279
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
Generalized plot size from K32 to any size of K #803
Merged
Merged
Changes from 2 commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 | ||||
---|---|---|---|---|---|---|
|
@@ -96,7 +96,7 @@ def spawn_archive_process(dir_cfg: configuration.Directories, arch_cfg: configur | |||||
|
||||||
def compute_priority(phase: job.Phase, gb_free: float, n_plots: int) -> int: | ||||||
# All these values are designed around dst buffer dirs of about | ||||||
# ~2TB size and containing k32 plots. TODO: Generalize, and | ||||||
# ~2TB size and containing k plots. TODO: Generalize, and | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I suspect this is still a valid reference to k32.
Suggested change
|
||||||
# rewrite as a sort function. | ||||||
|
||||||
priority = 50 | ||||||
|
@@ -210,7 +210,7 @@ def archive(dir_cfg: configuration.Directories, arch_cfg: configuration.Archivin | |||||
dst_dir = dir_cfg.get_dst_directories() | ||||||
for d in dst_dir: | ||||||
ph = dir2ph.get(d, job.Phase(0, 0)) | ||||||
dir_plots = plot_util.list_k32_plots(d) | ||||||
dir_plots = plot_util.list_k_plots(d) | ||||||
gb_free = plot_util.df_b(d) / plot_util.GB | ||||||
n_plots = len(dir_plots) | ||||||
priority = compute_priority(ph, gb_free, n_plots) | ||||||
|
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 | ||||
---|---|---|---|---|---|---|
|
@@ -14,9 +14,6 @@ def df_b(d: str) -> int: | |||||
usage = shutil.disk_usage(d) | ||||||
return usage.free | ||||||
|
||||||
def get_k32_plotsize() -> int: | ||||||
return get_plotsize(32) | ||||||
|
||||||
def get_plotsize(k: int) -> int: | ||||||
return (int)(_get_plotsize_scaler(k) * k * pow(2, k)) | ||||||
|
||||||
|
@@ -54,18 +51,19 @@ def split_path_prefix(items: typing.List[str]) -> typing.Tuple[str, typing.List[ | |||||
remainders = [ os.path.relpath(i, prefix) for i in items ] | ||||||
return (prefix, remainders) | ||||||
|
||||||
def list_k32_plots(d: str) -> typing.List[str]: | ||||||
'List completed k32 plots in a directory (not recursive)' | ||||||
def list_k_plots(d: str) -> typing.List[str]: | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
'List completed plots in a directory (not recursive)' | ||||||
plots = [] | ||||||
for plot in os.listdir(d): | ||||||
if re.match(r'^plot-k32-.*plot$', plot): | ||||||
if matches := re.search(r"^plot-k(\d*)-.*plot$", plot): | ||||||
grps = matches.groups() | ||||||
plot_k = int(grps[0]) | ||||||
plot = os.path.join(d, plot) | ||||||
try: | ||||||
if os.stat(plot).st_size > (0.95 * get_k32_plotsize()): | ||||||
if os.stat(plot).st_size > (0.95 * get_plotsize(plot_k)): | ||||||
plots.append(plot) | ||||||
except FileNotFoundError: | ||||||
continue | ||||||
|
||||||
return plots | ||||||
|
||||||
def column_wrap( | ||||||
|
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add test files for another size or two?