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

Fixes for stale plotman libs #1019

Merged
merged 2 commits into from
Feb 17, 2025
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: 1 addition & 1 deletion api/commands/plotman_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ def find_plotting_job_log(plot_id):
return None

def analyze(plot_file):
groups = re.match("plot(?:-mmx)?-k(\d+)(?:-c\d+)?-(\d+)-(\d+)-(\d+)-(\d+)-(\d+)-(\w+).plot", plot_file)
groups = re.match(r"plot(?:-mmx)?-k(\d+)(?:-c\d+)?-(\d+)-(\d+)-(\d+)-(\d+)-(\d+)-(\w+).plot", plot_file)
if not groups:
return "Invalid plot file name provided: {0}".format(plot_file)
plot_log_file = find_plotting_job_log(groups[7])
Expand Down
4 changes: 2 additions & 2 deletions api/models/chia.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def __init__(self, cli_stdout, blockchain):
self.plots_size = effective.strip().removesuffix('e (effective)')
elif "status" in line:
self.calc_status(line.split(':')[1].strip())
elif re.match("Total.*farmed:.*$", line):
elif re.match(r"Total.*farmed:.*$", line):
self.total_coins = line.split(':')[1].strip()
elif "network space" in line:
self.calc_netspace_size(line.split(':')[1].strip())
Expand Down Expand Up @@ -142,7 +142,7 @@ def exclude_wallets_from_sum(self, wallet_details):
exclude_wallet = False
lines = chunk.split('\n')
for line in lines:
if re.match('^\s+-Type:\s+CAT$', line) or re.match('^\s+-Type:\s+DISTRIBUTED_ID$', line) or re.match('^\s+-Type:\s+DECENTRALIZED_ID$', line) or re.match('^\s+-Type:\s+NFT$', line):
if re.match(r'^\s+-Type:\s+CAT$', line) or re.match(r'^\s+-Type:\s+DISTRIBUTED_ID$', line) or re.match(r'^\s+-Type:\s+DECENTRALIZED_ID$', line) or re.match(r'^\s+-Type:\s+NFT$', line):
exclude_wallet = True
if exclude_wallet:
app.logger.debug("Ignoring balance of wallet named: {0}".format(lines[0][:-1]))
Expand Down
4 changes: 2 additions & 2 deletions api/models/mmx.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def __init__(self, cli_stdout, blockchain):
self.plot_count = 0
self.plots_size = 0
for line in cli_stdout:
m = re.match('^K(\d+): (\d+) plots$', line)
m = re.match(r'^K(\d+): (\d+) plots$', line)
if m:
self.plot_count += int(m.group(2))
elif line.startswith('Total size'):
Expand Down Expand Up @@ -82,7 +82,7 @@ def __init__(self, entries):
app.logger.info("Skipping non-plot file named: {0}".format(path))
continue
dir,file=os.path.split(path)
groups = re.match("plot-mmx-k(\d+)(-c\d)?-(\d+)-(\d+)-(\d+)-(\d+)-(\d+)-(\w+).plot", file)
groups = re.match(r"plot-mmx-k(\d+)(-c\d)?-(\d+)-(\d+)-(\d+)-(\d+)-(\d+)-(\w+).plot", file)
if not groups:
app.logger.info("Invalid plot file name provided: {0}".format(file))
continue
Expand Down
2 changes: 1 addition & 1 deletion api/schedules/stats_effort.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def get_oldest_plot_file_time():
for plot_dir in globals.get_disks("plots"):
plots = [f for f in os.listdir(plot_dir) if os.path.isfile(os.path.join(plot_dir,f))]
for plot in plots:
match = re.match("plot(?:-mmx)?-k(\d+)(?:-c\d+)?-(\d+)-(\d+)-(\d+)-(\d+)-(\d+)-(\w+).plot", plot)
match = re.match(r"plot(?:-mmx)?-k(\d+)(?:-c\d+)?-(\d+)-(\d+)-(\d+)-(\d+)-(\d+)-(\w+).plot", plot)
if match:
created_at_str = "{0}-{1}-{2} {3}:{4}".format( match.group(2),match.group(3),match.group(4),match.group(5),match.group(6))
created_at_secs = time.mktime(datetime.datetime.strptime(created_at_str, "%Y-%m-%d %H:%M").timetuple())
Expand Down
2 changes: 1 addition & 1 deletion api/schedules/status_plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

def get_plot_attrs(plot_id, filename):
dir,file = os.path.split(filename)
match = re.match("plot(?:-mmx)?-k(\d+)(?:-c\d+)?-(\d+)-(\d+)-(\d+)-(\d+)-(\d+)-(\w+).plot", file)
match = re.match(r"plot(?:-mmx)?-k(\d+)(?:-c\d+)?-(\d+)-(\d+)-(\d+)-(\d+)-(\d+)-(\w+).plot", file)
if match:
short_plot_id = match.group(7)[:16]
created_at = "{0}-{1}-{2} {3}:{4}".format( match.group(2),match.group(3),match.group(4),match.group(5),match.group(6))
Expand Down
4 changes: 2 additions & 2 deletions scripts/plotman_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ if [[ (${mode} =~ ^fullnode.* || ${mode} =~ "plotter") && (${blockchains} == 'c
cd plotman
/chia-blockchain/venv/bin/pip install .
# Workaround for broken dependency ordering
/chia-blockchain/venv/bin/pip install pendulum~=2.1
/chia-blockchain/venv/bin/pip install packaging~=21.0
/chia-blockchain/venv/bin/pip install pendulum~=3.0
/chia-blockchain/venv/bin/pip install packaging~=24.2
/chia-blockchain/venv/bin/pip install attrs~=21.2
/chia-blockchain/venv/bin/pip install desert~=2020.11.18
/chia-blockchain/venv/bin/pip install appdirs~=1.4
Expand Down
2 changes: 1 addition & 1 deletion web/actions/warnings.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def check_warnings(args):

def get_plot_attrs(filename):
dir,file = os.path.split(filename)
match = re.match("plot(?:-mmx)?-k(\d+)(?:-c\d+)?-(\d+)-(\d+)-(\d+)-(\d+)-(\d+)-(\w+).plot", file)
match = re.match(r"plot(?:-mmx)?-k(\d+)(?:-c\d+)?-(\d+)-(\d+)-(\d+)-(\d+)-(\d+)-(\w+).plot", file)
if match:
short_plot_id = match.group(7)[:16]
created_at = "{0}-{1}-{2} {3}:{4}".format( match.group(2),match.group(3),match.group(4),match.group(5),match.group(6))
Expand Down
4 changes: 2 additions & 2 deletions web/models/chia.py
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ def exclude_wallets_from_sum(self, wallet_details):

def extract_wallet_id(self, lines):
for line in lines:
wallet_match = re.match("^\s+-Wallet ID:\s+(\d)+$", line)
wallet_match = re.match(r"^\s+-Wallet ID:\s+(\d)+$", line)
if wallet_match:
return wallet_match.group(1)
return None
Expand Down Expand Up @@ -796,7 +796,7 @@ def parse_mmx(self, connection, blockchain, geoip_cache, lang):
for line in connection.details.split('\n'):
try:
#app.logger.info(line)
m = re.match("\[(.+)\]\s+height\s+=\s+(\!?\d+), (\w+) \(\d+\.\d+\), (\d+\.?\d*) (\w)B recv, (\d*\.?\d*) (\w)B sent,.* since (\d+) min, .* (\d+\.?\d?) sec timeout", line.strip(), re.IGNORECASE)
m = re.match(r"\[(.+)\]\s+height\s+=\s+(\!?\d+), (\w+) \(\d+\.\d+\), (\d+\.?\d*) (\w)B recv, (\d*\.?\d*) (\w)B sent,.* since (\d+) min, .* (\d+\.?\d?) sec timeout", line.strip(), re.IGNORECASE)
if m:
connection = {
'type': m.group(3),
Expand Down
Loading