Skip to content

Commit 77f85e3

Browse files
authored
Merge pull request #866 from altendky/release/v0.5.1
2 parents 3edef7e + c7fc841 commit 77f85e3

File tree

8 files changed

+89
-22
lines changed

8 files changed

+89
-22
lines changed

CHANGELOG.md

+16
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,22 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [0.5.1] - 2021-07-15
9+
### Fixed
10+
- Detects binary-installed Chia plotting processes again after being broken in v0.5.
11+
([#865](https://github.com/ericaltendorf/plotman/pull/865))
12+
- Wrap archival indexes around when there are fewer disks, rather than just pointing all the "extra" indexes at the last disk.
13+
This will distribute the plot transfers better when you have fewer disks than plotters.
14+
([#855](https://github.com/ericaltendorf/plotman/pull/855))
15+
### Added
16+
- `path_suffix` option for rsync and rsyncd archive targets.
17+
Allows adding suffixes to the destination path such as to separate original vs. pool plots.
18+
([#800](https://github.com/ericaltendorf/plotman/pull/800))
19+
- `executable` option for each configurable plotter.
20+
Allows explicit specification of the plotter executable path if this is preferred over setting the `PATH` environment variable to find the program.
21+
Presently does not support executables other than the expected names (`chia`, and `chia_plot`).
22+
([#823](https://github.com/ericaltendorf/plotman/pull/823))
23+
824
## [0.5] - 2021-07-07
925
### Fixed
1026
- `plotman kill` doesn't leave any temporary files behind anymore.

VERSION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.5
1+
0.5.1

src/plotman/archive.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ def archive(dir_cfg: configuration.Directories, arch_cfg: configuration.Archivin
240240
available = [(d, space) for (d, space) in archdir_freebytes.items() if
241241
space > (chosen_plot_size + free_space_margin)]
242242
if len(available) > 0:
243-
index = min(arch_cfg.index, len(available) - 1)
243+
index = arch_cfg.index % len(available)
244244
(archdir, freespace) = sorted(available)[index]
245245

246246
if not archdir:

src/plotman/configuration.py

+33-2
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ def get_validated_configs(config_text: str, config_path: str, preset_target_defi
7373

7474
if loaded.plotting.type == "chia":
7575
if loaded.plotting.chia is None:
76+
# TODO: fix all the `TODO: use the configured executable` so this is not
77+
# needed.
7678
raise ConfigurationException(
7779
"chia selected as plotter but plotting: chia: was not specified in the config",
7880
)
@@ -81,6 +83,12 @@ def get_validated_configs(config_text: str, config_path: str, preset_target_defi
8183
raise ConfigurationException(
8284
"Chia Network plotter accepts up to one of plotting: pool_pk: and pool_contract_address: but both are specified",
8385
)
86+
87+
executable_name = os.path.basename(loaded.plotting.chia.executable)
88+
if executable_name != "chia":
89+
raise ConfigurationException(
90+
"plotting: chia: executable: must refer to an executable named chia"
91+
)
8492
elif loaded.plotting.type == "madmax":
8593
if loaded.plotting.madmax is None:
8694
raise ConfigurationException(
@@ -101,6 +109,14 @@ def get_validated_configs(config_text: str, config_path: str, preset_target_defi
101109
"madMAx plotter accepts only one of plotting: pool_pk: and pool_contract_address: but both are specified",
102110
)
103111

112+
executable_name = os.path.basename(loaded.plotting.madmax.executable)
113+
if executable_name != "chia_plot":
114+
# TODO: fix all the `TODO: use the configured executable` so this is not
115+
# needed.
116+
raise ConfigurationException(
117+
"plotting: madmax: executable: must refer to an executable named chia_plot"
118+
)
119+
104120
if loaded.archiving is not None:
105121
preset_target_objects = yaml.safe_load(preset_target_definitions_text)
106122
preset_target_schema = desert.schema(PresetTargetDefinitions)
@@ -312,6 +328,7 @@ class Scheduling:
312328

313329
@attr.frozen
314330
class ChiaPlotterOptions:
331+
executable: str = "chia"
315332
n_threads: int = 2
316333
n_buckets: int = 128
317334
k: Optional[int] = 32
@@ -321,6 +338,7 @@ class ChiaPlotterOptions:
321338

322339
@attr.frozen
323340
class MadmaxPlotterOptions:
341+
executable: str = "chia_plot"
324342
n_threads: int = 4
325343
n_buckets: int = 256
326344

@@ -369,9 +387,15 @@ class PlotmanConfig:
369387
@contextlib.contextmanager
370388
def setup(self) -> Generator[None, None, None]:
371389
if self.plotting.type == 'chia':
390+
if self.plotting.chia is None:
391+
message = (
392+
"internal plotman error, please report the full traceback and your"
393+
+ " full configuration file"
394+
)
395+
raise Exception(message)
372396
if self.plotting.pool_contract_address is not None:
373397
completed_process = subprocess.run(
374-
args=['chia', 'version'],
398+
args=[self.plotting.chia.executable, 'version'],
375399
capture_output=True,
376400
check=True,
377401
encoding='utf-8',
@@ -384,9 +408,16 @@ def setup(self) -> Generator[None, None, None]:
384408
f' plots but found: {version}'
385409
)
386410
elif self.plotting.type == 'madmax':
411+
if self.plotting.madmax is None:
412+
message = (
413+
"internal plotman error, please report the full traceback and your"
414+
+ " full configuration file"
415+
)
416+
raise Exception(message)
417+
387418
if self.plotting.pool_contract_address is not None:
388419
completed_process = subprocess.run(
389-
args=['chia_plot', '--help'],
420+
args=[self.plotting.madmax.executable, '--help'],
390421
capture_output=True,
391422
check=True,
392423
encoding='utf-8',

src/plotman/job.py

+20-11
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,22 @@ def job_phases_for_dstdir(d: str, all_jobs: typing.List["Job"]) -> typing.List["
3131
return sorted([j.progress() for j in all_jobs if os.path.normpath(j.dstdir) == os.path.normpath(d)])
3232

3333
def is_plotting_cmdline(cmdline: typing.List[str]) -> bool:
34-
if cmdline and 'python' in cmdline[0].lower(): # Stock Chia plotter
35-
cmdline = cmdline[1:]
34+
if len(cmdline) == 0:
35+
return False
36+
37+
if 'chia_plot' == os.path.basename(cmdline[0].lower()): # Madmax plotter
38+
# TODO: use the configured executable
39+
return True
40+
else:
41+
if 'python' in cmdline[0].lower(): # Stock Chia plotter
42+
cmdline = cmdline[1:]
3643
return (
3744
len(cmdline) >= 3
45+
# TODO: use the configured executable
3846
and 'chia' in cmdline[0]
3947
and 'plots' == cmdline[1]
4048
and 'create' == cmdline[2]
4149
)
42-
elif cmdline and 'chia_plot' == os.path.basename(cmdline[0].lower()): # Madmax plotter
43-
return True
44-
return False
4550

4651
def parse_chia_plot_time(s: str) -> pendulum.DateTime:
4752
# This will grow to try ISO8601 as well for when Chia logs that way
@@ -54,9 +59,16 @@ def parse_chia_plots_create_command_line(
5459
) -> "ParsedChiaPlotsCreateCommand":
5560
command_line = list(command_line)
5661
# Parse command line args
57-
if 'python' in command_line[0].lower(): # Stock Chia plotter
58-
command_line = command_line[1:]
62+
63+
if 'chia_plot' == os.path.basename(command_line[0].lower()): # Madmax plotter
64+
# TODO: use the configured executable
65+
all_command_arguments = command_line[1:]
66+
command = madmax._cli_c8121b9
67+
else:
68+
if 'python' in command_line[0].lower(): # Stock Chia plotter
69+
command_line = command_line[1:]
5970
assert len(command_line) >= 3
71+
# TODO: use the configured executable
6072
assert 'chia' in command_line[0]
6173
assert 'plots' == command_line[1]
6274
assert 'create' == command_line[2]
@@ -65,10 +77,6 @@ def parse_chia_plots_create_command_line(
6577
# associated command. For now we'll just use the latest one we have
6678
# copied.
6779
command = chia.commands.latest_command()
68-
elif 'chia_plot' in command_line[0].lower(): # Madmax plotter
69-
command_line = command_line[1:]
70-
all_command_arguments = command_line[2:]
71-
command = madmax._cli_c8121b9
7280

7381
# nice idea, but this doesn't include -h
7482
# help_option_names = command.get_help_option_names(ctx=context)
@@ -268,6 +276,7 @@ def __init__(
268276
# 'nobitfield': False,
269277
# 'exclude_final_dir': False,
270278
# }
279+
# TODO: use the configured executable
271280
if proc.name().startswith("chia_plot"): # MADMAX
272281
self.k = 32
273282
self.r = self.args['threads'] # type: ignore[assignment]

src/plotman/manager.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,8 @@ def key(key: str) -> job.Phase:
144144
raise Exception(
145145
"madmax plotter selected but not configured, report this as a plotman bug",
146146
)
147-
plot_args = ['chia_plot',
147+
plot_args = [
148+
plotting_cfg.madmax.executable,
148149
'-n', str(1),
149150
'-r', str(plotting_cfg.madmax.n_threads),
150151
'-u', str(plotting_cfg.madmax.n_buckets),
@@ -158,7 +159,7 @@ def key(key: str) -> job.Phase:
158159
raise Exception(
159160
"chia plotter selected but not configured, report this as a plotman bug",
160161
)
161-
plot_args = ['chia', 'plots', 'create',
162+
plot_args = [plotting_cfg.chia.executable, 'plots', 'create',
162163
'-k', str(plotting_cfg.chia.k),
163164
'-r', str(plotting_cfg.chia.n_threads),
164165
'-u', str(plotting_cfg.chia.n_buckets),

src/plotman/resources/plotman.yaml

+8-2
Original file line numberDiff line numberDiff line change
@@ -150,14 +150,19 @@ scheduling:
150150
# See documentation at
151151
# https://github.com/Chia-Network/chia-blockchain/wiki/CLI-Commands-Reference#create
152152
plotting:
153-
# Your public keys: farmer and pool - Required for madMAx, optional for chia with mnemonic.txt
153+
# Your public keys. Be sure to use the pool contract address for
154+
# portable pool plots. The pool public key is only for original
155+
# non-portable plots that can not be used with the official pooling
156+
# protocol.
154157
# farmer_pk: ...
155158
# pool_pk: ...
156-
159+
# pool_contract_address: ...
160+
157161
# If you enable Chia, plot in *parallel* with higher tmpdir_max_jobs and global_max_jobs
158162
type: chia
159163
chia:
160164
# The stock plotter: https://github.com/Chia-Network/chia-blockchain
165+
# executable: /path/to/chia
161166
k: 32 # k-size of plot, leave at 32 most of the time
162167
e: False # Use -e plotting option
163168
n_threads: 2 # Threads per job
@@ -167,5 +172,6 @@ plotting:
167172
# If you enable madMAx, plot in *sequence* with very low tmpdir_max_jobs and global_max_jobs
168173
madmax:
169174
# madMAx plotter: https://github.com/madMAx43v3r/chia-plotter
175+
# executable: /path/to/chia_plot
170176
n_threads: 4 # Default is 4, crank up if you have many cores
171177
n_buckets: 256 # Default is 256

src/plotman/resources/target_definitions.yaml

+7-3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ target_definitions:
44
command: rsync
55
options: --preallocate --remove-source-files --skip-compress plot --whole-file
66
site_root: null
7+
path_suffix: ""
78

89
# The disk space script must return a line for each directory
910
# to consider archiving to with the following form.
@@ -24,7 +25,8 @@ target_definitions:
2425
transfer_script: |
2526
#!/bin/bash
2627
set -evx
27-
"${command}" ${options} "${source}" "${destination}"
28+
full_destination=$(realpath --canonicalize-missing "${destination}/${path_suffix}")
29+
"${command}" ${options} "${source}" "${full_destination}/"
2830
transfer_process_name: "{command}"
2931
transfer_process_argument_prefix: "{site_root}"
3032
rsyncd:
@@ -38,6 +40,7 @@ target_definitions:
3840
host: null
3941
site_root: null
4042
site: null
43+
path_suffix: ""
4144
disk_space_script: |
4245
#!/bin/bash
4346
set -evx
@@ -49,9 +52,10 @@ target_definitions:
4952
#!/bin/bash
5053
set -evx
5154
echo Launching transfer activity
52-
relative_path=$(realpath --canonicalize-missing --relative-to="${site_root}" "${destination}")
55+
full_destination=$(realpath --canonicalize-missing "${destination}/${path_suffix}")
56+
relative_path=$(realpath --canonicalize-missing --relative-to="${site_root}" "${full_destination}")
5357
url_root="rsync://${user}@${host}:${rsync_port}/${site}"
54-
"${command}" ${options} "${source}" "${url_root}/${relative_path}"
58+
"${command}" ${options} "${source}" "${url_root}/${relative_path}/"
5559
transfer_process_name: "{command}"
5660
transfer_process_argument_prefix: "rsync://{user}@{host}:{rsync_port}/{site}"
5761
# external_script:

0 commit comments

Comments
 (0)