Skip to content

Commit

Permalink
Merge pull request #1020 from guydavis/develop
Browse files Browse the repository at this point in the history
More warnings fixes.
  • Loading branch information
guydavis authored Feb 17, 2025
2 parents ef86007 + 27111db commit 2ec4609
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 43 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/main-blockchains.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:

jobs:
cactus:
runs-on: ubuntu-24.04
runs-on: ubuntu-22.04
steps:
-
name: Checkout
Expand Down Expand Up @@ -42,7 +42,7 @@ jobs:
provenance: false
push: true
build-args: |
"UBUNTU_VER=noble"
"UBUNTU_VER=jammy"
"MACHINARIS_STREAM=latest"
"CACTUS_BRANCH=main"
tags: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test-blockchains.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:

jobs:
cactus:
runs-on: ubuntu-24.04
runs-on: ubuntu-22.04
steps:
-
name: Checkout
Expand Down Expand Up @@ -41,7 +41,7 @@ jobs:
provenance: false
push: true
build-args: |
"UBUNTU_VER=noble"
"UBUNTU_VER=jammy"
"MACHINARIS_STREAM=develop"
"CHIADOG_BRANCH=dev"
"CACTUS_BRANCH=main"
Expand Down
38 changes: 19 additions & 19 deletions api/models/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,19 @@ def __init__(self, cli_stdout, blockchain):
try:
if blockchain == 'mmx':
self.rows.append({
'challenge_id': re.search('eligible for height (\d+)', line, re.IGNORECASE).group(1),
'plots_past_filter': str(re.search('INFO:\s*(\d+) plots were eligible', line, re.IGNORECASE).group(1)),
'challenge_id': re.search(r'eligible for height (\d+)', line, re.IGNORECASE).group(1),
'plots_past_filter': str(re.search(r'INFO:\s*(\d+) plots were eligible', line, re.IGNORECASE).group(1)),
'proofs_found': 0, # TODO What does log line with a proof look like?
'time_taken': str(re.search('took ([0-9]+\.?[0-9]*(?:[Ee]\ *-?\ *[0-9]+)?) sec', line, re.IGNORECASE).group(1)) + ' secs',
'time_taken': str(re.search(r'took ([0-9]+\.?[0-9]*(?:[Ee]\ *-?\ *[0-9]+)?) sec', line, re.IGNORECASE).group(1)) + ' secs',
'created_at': line[:19] # example at line start: 2022-01-25 10:14:33
})
else: # All Chia forks
self.rows.append({
'challenge_id': re.search('eligible for farming (\w+)', line, re.IGNORECASE).group(1) + '...',
'plots_past_filter': str(re.search('INFO\s*(\d+) plots were eligible', line, re.IGNORECASE).group(1)) + \
'/' + str(re.search('Total (\d+) plots', line, re.IGNORECASE).group(1)),
'proofs_found': int(re.search('Found (\d+) proofs', line, re.IGNORECASE).group(1)),
'time_taken': str(re.search('Time: (\d+\.?\d*) s.', line, re.IGNORECASE).group(1)) + ' secs',
'challenge_id': re.search(r'eligible for farming (\w+)', line, re.IGNORECASE).group(1) + '...',
'plots_past_filter': str(re.search(r'INFO\s*(\d+) plots were eligible', line, re.IGNORECASE).group(1)) + \
'/' + str(re.search(r'Total (\d+) plots', line, re.IGNORECASE).group(1)),
'proofs_found': int(re.search(r'Found (\d+) proofs', line, re.IGNORECASE).group(1)),
'time_taken': str(re.search(r'Time: (\d+\.?\d*) s.', line, re.IGNORECASE).group(1)) + ' secs',
'created_at': line.split()[0].replace('T', ' ')
})
except:
Expand All @@ -51,8 +51,8 @@ def __init__(self, cli_stdout):
if "Submitting partial" in line:
app.logger.debug(line)
created_at = line.split()[0].replace('T', ' ')
launcher_id = re.search('partial for (\w+) to', line, re.IGNORECASE).group(1)
pool_url = re.search('to (.*)$', line, re.IGNORECASE).group(1)
launcher_id = re.search(r'partial for (\w+) to', line, re.IGNORECASE).group(1)
pool_url = re.search(r'to (.*)$', line, re.IGNORECASE).group(1)
self.rows.append({
'launcher_id': launcher_id,
'pool_url': pool_url.strip(),
Expand Down Expand Up @@ -88,20 +88,20 @@ def parse_chia(self, cli_stdout):
try:
#app.logger.info(line)
if "proofs in" in line:
plot_files.append(re.search('proofs in (.*) in (\d+\.?\d*) s$', line, re.IGNORECASE).group(1))
plot_files.append(re.search(r'proofs in (.*) in (\d+\.?\d*) s$', line, re.IGNORECASE).group(1))
elif "eligible for farming" in line:
challenge_id = re.search('eligible for farming (\w+)', line, re.IGNORECASE).group(1)
plots_past_filter = str(re.search('INFO\s*(\d+) plots were eligible', line, re.IGNORECASE).group(1)) + \
'/' + str(re.search('Total (\d+) plots', line, re.IGNORECASE).group(1))
proofs_found = int(re.search('Found (\d+) proofs', line, re.IGNORECASE).group(1))
time_taken = str(re.search('Time: (\d+\.?\d*) s.', line, re.IGNORECASE).group(1)) + ' secs'
challenge_id = re.search(r'eligible for farming (\w+)', line, re.IGNORECASE).group(1)
plots_past_filter = str(re.search(r'INFO\s*(\d+) plots were eligible', line, re.IGNORECASE).group(1)) + \
'/' + str(re.search(r'Total (\d+) plots', line, re.IGNORECASE).group(1))
proofs_found = int(re.search(r'Found (\d+) proofs', line, re.IGNORECASE).group(1))
time_taken = str(re.search(r'Time: (\d+\.?\d*) s.', line, re.IGNORECASE).group(1)) + ' secs'
elif "Farmed unfinished_block" in line:
created_at = line[:line.rfind(':')].split()[0].replace('T', ' ')
if "debug.log:" in created_at:
created_at = created_at[(created_at.index('debug.log:') + len('debug.log:')):]
elif "debug.log.1:" in created_at:
created_at = created_at[(created_at.index('debug.log.1:') + len('debug.log.1:')):]
farmed_block = re.search('Farmed unfinished_block (\w+)', line, re.IGNORECASE).group(1)
farmed_block = re.search(r'Farmed unfinished_block (\w+)', line, re.IGNORECASE).group(1)
elif "--" == line:
if challenge_id and plots_past_filter and time_taken and farmed_block:
self.rows.append({
Expand Down Expand Up @@ -134,9 +134,9 @@ def parse_mmx(self, cli_stdout):
for line in cli_stdout:
try:
#app.logger.info(line)
time_taken = str(re.search('took (\d+\.?\d*) sec', line, re.IGNORECASE).group(1)) + ' secs'
time_taken = str(re.search(r'took (\d+\.?\d*) sec', line, re.IGNORECASE).group(1)) + ' secs'
created_at = "{0}.000".format(line[:19])
farmed_block = re.search('Created block at height (\d+)', line, re.IGNORECASE).group(1)
farmed_block = re.search(r'Created block at height (\d+)', line, re.IGNORECASE).group(1)
self.rows.append({
'challenge_id': '',
'plot_files': '',
Expand Down
2 changes: 1 addition & 1 deletion api/models/plotman.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def parse_transfer_log(self, log_file, running_transfers):
elif line.startswith("Completed"):
self.end_date = line[line.index(' at ')+4:].strip()
elif line.startswith("+ rsync"):
m = re.search("plot(?:-mmx)?-k(\d+)(?:-c\d+)?-(\d+)-(\d+)-(\d+)-(\d+)-(\d+)-(\w+).plot", line)
m = re.search(r"plot(?:-mmx)?-k(\d+)(?:-c\d+)?-(\d+)-(\d+)-(\d+)-(\d+)-(\d+)-(\w+).plot", line)
if m:
self.plot_id = m.group(7)[:16].strip()
self.k = int(m.group(1).strip())
Expand Down
12 changes: 6 additions & 6 deletions common/utils/converters.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,22 +148,22 @@ def etw_to_minutes(etw):
week_minutes = 7 * day_minutes
months_minutes = 43800
year_minutes = 12 * months_minutes
match = re.search("(\d+) year", etw)
match = re.search(r"(\d+) year", etw)
if match:
etw_total_minutes += int(match.group(1)) * year_minutes
match = re.search("(\d+) month", etw)
match = re.search(r"(\d+) month", etw)
if match:
etw_total_minutes += int(match.group(1)) * months_minutes
match = re.search("(\d+) week", etw)
match = re.search(r"(\d+) week", etw)
if match:
etw_total_minutes += int(match.group(1)) * week_minutes
match = re.search("(\d+) day", etw)
match = re.search(r"(\d+) day", etw)
if match:
etw_total_minutes += int(match.group(1)) * day_minutes
match = re.search("(\d+) hour", etw)
match = re.search(r"(\d+) hour", etw)
if match:
etw_total_minutes += int(match.group(1)) * hour_minutes
match = re.search("(\d+) minute", etw)
match = re.search(r"(\d+) minute", etw)
if match:
etw_total_minutes += int(match.group(1))
return etw_total_minutes
Expand Down
4 changes: 2 additions & 2 deletions web/actions/plotman.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ def load_key_pk(type, blockchain):
#app.logger.info("Searching for {0} replacement in {1}".format(type, blockchain))
key = db.session.query(k.Key).filter(k.Key.blockchain==blockchain).first()
#app.logger.info(key.details)
m = re.search('{0} public key.*:\s+(\w+)'.format(type.lower()), key.details.lower())
m = re.search(r'{0} public key.*:\s+(\w+)'.format(type.lower()), key.details.lower())
if m:
#app.logger.info("Found: {0}".format(m.group(1)))
return m.group(1)
Expand All @@ -173,7 +173,7 @@ def load_pool_contract_address(blockchain):
pool_blockchain = blockchain
plotnfts = p.load_plotnfts_by_blockchain(pool_blockchain)
if len(plotnfts.rows) == 1:
m = re.search('Pool contract address .*: (\w+)'.format(type), plotnfts.rows[0]['details'])
m = re.search(r'Pool contract address .*: (\w+)'.format(type), plotnfts.rows[0]['details'])
if m:
return m.group(1)
elif len(plotnfts.rows) > 1:
Expand Down
2 changes: 1 addition & 1 deletion web/actions/pools.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def get_first_pool_wallet_id():
for plotnft in load_plotnfts().rows:
for line in plotnft['details'].splitlines():
app.logger.info(line)
m = re.search("Wallet id (\d+):", line)
m = re.search(r"Wallet id (\d+):", line)
if m:
return m.group(1)
return None
Expand Down
20 changes: 10 additions & 10 deletions web/models/chia.py
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ def link_to_wallet_transactions(self, blockchain, details):
return '\n'.join(lines)

def sum_chia_wallet_balance(self, hostname, blockchain, include_cold_balance=True):
numeric_const_pattern = '-Total\sBalance:\s+((?: (?: \d* \. \d+ ) | (?: \d+ \.? ) )(?: [Ee] [+-]? \d+ )?)'
numeric_const_pattern = r'-Total\sBalance:\s+((?: (?: \d* \. \d+ ) | (?: \d+ \.? ) )(?: [Ee] [+-]? \d+ )?)'
rx = re.compile(numeric_const_pattern, re.VERBOSE)
sum = 0
for wallet in self.wallets:
Expand Down Expand Up @@ -494,9 +494,9 @@ def extract_status(self, blockchain, details, updated_at, worker_status):
if updated_at and updated_at <= (datetime.datetime.now() - datetime.timedelta(minutes=5)):
return "Paused"
if blockchain == 'mmx':
pattern = '^Synced:\s+(.*)$'
pattern = r'^Synced:\s+(.*)$'
else:
pattern = '^Sync status: (.*)$'
pattern = r'^Sync status: (.*)$'
for line in details.split('\n'):
m = re.match(pattern, line)
if m:
Expand Down Expand Up @@ -614,11 +614,11 @@ def extract_status(self, blockchain, details, worker_status):
if not details:
return None
if blockchain == 'mmx':
pattern = '^Synced: (.*)$'
pattern = r'^Synced: (.*)$'
elif blockchain == 'staicoin': # Staicoin being different for no good reason...
pattern = '^Current Node Status: (.*)$'
pattern = r'^Current Node Status: (.*)$'
else:
pattern = '^Current Blockchain Status: (.*)$'
pattern = r'^Current Blockchain Status: (.*)$'
for line in details.split('\n'):
m = re.match(pattern, line)
if m:
Expand All @@ -643,9 +643,9 @@ def extract_height(self, blockchain, details):
if not details:
return None
if blockchain == 'mmx':
pattern = '^Height:\s+(\d+)$'
pattern = r'^Height:\s+(\d+)$'
else:
pattern = '^.* Height:\s+(\d+)$'
pattern = r'^.* Height:\s+(\d+)$'
for line in details.split('\n'):
m = re.match(pattern, line)
if m:
Expand All @@ -657,7 +657,7 @@ def extract_time(self, blockchain, details):
return None
if blockchain == 'mmx':
return '-' # None for MMX
pattern = '^\s+Time:\s+(.*)\sHeight:.*$'
pattern = r'^\s+Time:\s+(.*)\sHeight:.*$'
for line in details.split('\n'):
m = re.match(pattern, line)
if m:
Expand Down Expand Up @@ -751,7 +751,7 @@ def parse_chia(self, connection, blockchain, geoip_cache, lang):
self.columns = line.lower().replace('last connect', 'last_connect') \
.replace('mib up|down', 'mib_up mib_down').strip().split()
elif line.strip().startswith('-SB Height') or line.strip().startswith('-Height'):
groups = re.search("Height:\s+(\d+)\s+-Hash:\s+(\w+)...", line.strip())
groups = re.search(r"Height:\s+(\d+)\s+-Hash:\s+(\w+)...", line.strip())
if not groups:
app.logger.info("Malformed Height line: {0}".format(line))
else:
Expand Down

0 comments on commit 2ec4609

Please sign in to comment.