Skip to content

Commit

Permalink
- Fix bug where failure to get GRC price causes crash
Browse files Browse the repository at this point in the history
- Change default window to 90 days
  • Loading branch information
makeasnek committed Dec 1, 2023
1 parent 9f7ed95 commit d65719a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion config.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def TEMP_FUNCTION():
PRICE_CHECK_INTERVAL = 1440 # how often to check GRC price in minutes, minimum delay of 60 minutes between checks. Default is 1440 (24 hrs)
LOG_LEVEL = "WARNING" # Options are: 'DEBUG','INFO','WARNING','ERROR','NONE', default is 'WARNING'
MAX_LOGFILE_SIZE_IN_MB = 10 # Default: 10
ROLLING_WEIGHT_WINDOW = 60 # Use stats up to x days old for calculating intended weights vs actual crunch time, Default: 60. Note that "benchmarking" is applied to total time, not windowed time. Benchmarking will take 1% of ALL crunching time across ALL time history. This enables you set smaller "windows" and get faster reaction to weight changes without over-doing benchmarking.
ROLLING_WEIGHT_WINDOW = 90 # Use stats up to x days old for calculating intended weights vs actual crunch time, Default: 90. Note that "benchmarking" is applied to total time, not windowed time. Benchmarking will take 1% of ALL crunching time across ALL time history. This enables you set smaller "windows" and get faster reaction to weight changes without over-doing benchmarking.

# BENCHMARKING SETTINGS:
# Benchmarking is needed to determine profitability of a project. It is strongly suggested you keep these settings as they are, they are sane defaults.
Expand Down
9 changes: 8 additions & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2858,6 +2858,11 @@ def cache_full(project_name: str, messages) -> bool:
if difference.seconds > 60 * 5: # If message is > 5 min old, skip
continue
uppered_message_body = message["body"].upper()
if (
"""NOT REQUESTING TASKS: "NO NEW TASKS" REQUESTED VIA MANAGER"""
in uppered_message_body
):
continue
if uppered_project == message["project"].upper():
if (
"CPU: JOB CACHE FULL" in uppered_message_body
Expand Down Expand Up @@ -3365,10 +3370,12 @@ def profitability_check(
combined_stats: dict,
) -> bool:
"""
Returns True if crunching is profitable right now. False otherwise.
Returns True if crunching is profitable right now. False if otherwise or unable to determine.
"""
if not grc_sell_price:
grc_sell_price = 0.00
if not grc_price:
return False
combined_stats_extract = combined_stats.get(project)
if not combined_stats_extract:
log.error(
Expand Down

0 comments on commit d65719a

Please sign in to comment.