Skip to content

Commit

Permalink
Merge pull request #200 from guydavis/develop
Browse files Browse the repository at this point in the history
More fixes and improvements.
  • Loading branch information
guydavis authored Jul 22, 2021
2 parents ea20de4 + add4a5f commit 1d4b7a1
Show file tree
Hide file tree
Showing 10 changed files with 107 additions and 57 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

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.1] - 2021-07-?
## [0.5.1] - 2021-07-22

- Wizard on Workers page to create a Docker run/compose based on your settings. [Issue #97](https://github.com/guydavis/machinaris/issues/97)
- Update to patch release of Chia 1.2.2, including a fix for harvester cache updates. See their [changelog for details](https://github.com/Chia-Network/chia-blockchain/releases/tag/1.2.2).
- Latest Madmax plotter with support for n_buckets3 and n_rmulti2 settings in Plotman.

## [0.5.0] - 2021-07-09

Expand Down
3 changes: 3 additions & 0 deletions api/commands/chiadog_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ def start_chiadog():
for blockchain in blockchains:
try:
workdir = "/{0}dog".format(blockchain)
offset_file = "{0}/debug.log.offset".format(workdir)
if os.path.exists(offset_file):
os.remove(offset_file)
configfile = "/root/.chia/{0}dog/config.yaml".format(blockchain)
logfile = "/root/.chia/{0}dog/logs/{0}dog.log".format(blockchain)
proc = Popen("nohup /{0}-blockchain/venv/bin/python3 -u main.py --config {1} >> {2} 2>&1 &".format(blockchain, configfile, logfile), \
Expand Down
20 changes: 11 additions & 9 deletions config/plotman.sample.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -92,26 +92,28 @@ scheduling:

# Configure the plotter. See: https://github.com/guydavis/machinaris/wiki/Plotman#plotting
plotting:
# Your farmer public key is always required for plotting
# farmer_pk: YOUR_FARMER_PUBLIC_KEY (always required)
# Your pool public key is only required for solo plotting, else comment it out!
#pool_pk: YOUR_POOL_PUBLIC_KEY (comment this out if portable pool plotting)
# Your pool contract address is only required for portable pool plotting, else comment it out!
#pool_contract_address: YOUR_POOL_CONTRACT_ADDRESS (comment this out if solo plotting)
# See Keys page, for 'Farmer public key' value
farmer_pk: REPLACE_WITH_THE_REAL_VALUE
# ONLY FOR OLD SOLO PLOTS, COMMENT OUT IF PORTABLE PLOTTING!!!
pool_pk: REPLACE_WITH_THE_REAL_VALUE
# See 'Settings | Pools' page, for 'P2 singleton address' value, UNCOMMENT IF PORTABLE PLOTTING!!!
#pool_contract_address: REPLACE_WITH_THE_REAL_VALUE

# If you enable 'chia', plot in *parallel* with higher tmpdir_max_jobs and global_max_jobs
# If you enable 'madmax', plot in *sequence* with very low tmpdir_max_jobs and global_max_jobs
type: chia

# The chia plotter: https://github.com/Chia-Network/chia-blockchain
chia:
# The stock plotter: https://github.com/Chia-Network/chia-blockchain
k: 32 # k-size of plot, leave at 32 most of the time
e: False # Disable bitfield back sorting (default is True)
e: False # Use -e plotting option
n_threads: 2 # Threads per job
n_buckets: 128 # Number of buckets to split data into
job_buffer: 3389 # Per job memory

# The madmax plotter: https://github.com/madMAx43v3r/chia-plotter
madmax:
# madMAx plotter: https://github.com/madMAx43v3r/chia-plotter
n_threads: 4 # Default is 4, SLOWLY crank up if you have many cores
n_buckets: 256 # Default is 256
n_buckets3: 256 # Default is 256
n_rmulti2: 1 # Default is 1
2 changes: 1 addition & 1 deletion scripts/chiadog_launch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ cp -f /machinaris/scripts/chiadog_notifier.sh /root/.chia/chiadog/notifier.sh &&
echo 'Starting Chiadog...'
cd /chiadog
chiadog_pids=$(pidof python3)
if [ ! -z $chiadog_pids ]; then
if [[ ! -z $chiadog_pids ]]; then
kill $chiadog_pids
fi
/chia-blockchain/venv/bin/python3 -u main.py --config /root/.chia/chiadog/config.yaml > /root/.chia/chiadog/logs/chiadog.log 2>&1 &
2 changes: 1 addition & 1 deletion scripts/plotman_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#

cd /chia-blockchain
PLOTMAN_REPO_URL=https://github.com/ericaltendorf/plotman@main
PLOTMAN_REPO_URL=https://github.com/ericaltendorf/plotman@development
from="${PLOTMAN_GIT_URL:-${PLOTMAN_REPO_URL}}"

echo 'Installing Plotman from:${from}...'
Expand Down
17 changes: 12 additions & 5 deletions web/actions/plotman.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,15 +157,15 @@ def load_config_replacements():
farmer_pk = load_key_pk('Farmer')
if farmer_pk:
#app.logger.info("FARMER_PK: {0}".format(farmer_pk))
replacements.append([ 'farmer_pk:.*$', 'farmer_pk: '+ farmer_pk])
replacements.append([ 'farmer_pk:\s+REPLACE_WITH_THE_REAL_VALUE.*$', 'farmer_pk: '+ farmer_pk])
pool_pk = load_key_pk('Pool')
if pool_pk:
#app.logger.info("POOL_PK: {0}".format(pool_pk))
replacements.append([ 'pool_pk:.*$', 'pool_pk: '+ pool_pk])
replacements.append([ 'pool_pk:\s+REPLACE_WITH_THE_REAL_VALUE.*$', 'pool_pk: '+ pool_pk])
pool_contract_address = load_pool_contract_address()
if pool_contract_address:
#app.logger.info("POOL_CONTRACT_ADDRESS: {0}".format(pool_contract_address))
replacements.append([ 'pool_contract_address:.*$', 'pool_contract_address: '+ pool_contract_address])
replacements.append([ 'pool_contract_address:\s+REPLACE_WITH_THE_REAL_VALUE.*$', 'pool_contract_address: '+ pool_contract_address])
return replacements

def load_config(plotter):
Expand All @@ -177,11 +177,18 @@ def load_config(plotter):
app.logger.info(traceback.format_exc())
lines = []
config = utils.send_get(plotter, "/configs/plotting", debug=False).content.decode('utf-8')
replaces = 0
for line in config.splitlines():
for replacement in replacements:
line = re.sub(replacement[0], replacement[1], line)
(line, num_replaces) = re.subn(replacement[0], replacement[1], line)
replaces += num_replaces
lines.append(line)
return '\n'.join(lines)
if replaces > 0:
#app.logger.info("Return true for replaced.")
return [ True, '\n'.join(lines) ]
else:
#app.logger.info("Return false for replaced.")
return [ False, '\n'.join(lines) ]

def save_config(plotter, config):
try: # Validate the YAML first
Expand Down
4 changes: 3 additions & 1 deletion web/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,9 @@ def views_settings_config(path):
elif config_type == "farming":
response = make_response(chia.load_config(w, request.args.get('blockchain')), 200)
elif config_type == "plotting":
response = make_response(plotman.load_config(w), 200)
[replaced, config] = plotman.load_config(w)
response = make_response(config, 200)
response.headers.set('ConfigReplacementsOccurred', replaced)
else:
abort("Unsupported config type: {0}".format(config_type), 400)
response.mimetype = "application/x-yaml"
Expand Down
2 changes: 1 addition & 1 deletion web/templates/alerts.html
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
<table id="data" class="table table-dark">
<thead>
<tr>
<th scope="col" class="text-success">
<th scope="col" class="text-success text-center">
<input type="checkbox" name="unique_id_master" onclick="checkPage(this)"/>
</th>
<th scope="col" class="text-success">Worker</th>
Expand Down
11 changes: 10 additions & 1 deletion web/templates/settings/plotting.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
{% endwith %}
</div>

<div class="alert alert-warning" role="error" id="xhr_error" style="display: none"></div>
<form method="POST">
<fieldset>
<div class="row mb-3">
Expand Down Expand Up @@ -66,13 +67,21 @@
{% block scripts %}
<script>
$(document).ready(function () {
$('#xhr_error').hide();
function load_config(worker) {
$.ajax({
jqxhr = $.ajax({
type: "GET",
url: "{{ url_for('views_settings_config') }}?type=plotting&worker=" + worker,
})
.done(function (data) {
//console.log(data);
replacements_occurred = jqxhr.getResponseHeader('ConfigReplacementsOccurred');
if (replacements_occurred == 'True') {
$('#xhr_error').html("Plotting keys automatically replaced below. Please review and Save at least once!");
$('#xhr_error').show();
} else {
$('#xhr_error').hide();
}
$("#config").val(data)
}).fail(function (jqXHR, textStatus, errorThrown) {
console.log(jqXHR, textStatus, errorThrown);
Expand Down
Loading

0 comments on commit 1d4b7a1

Please sign in to comment.