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

Fix upper bound for expiration time in no-offers warning #582

Merged
merged 1 commit into from
Aug 9, 2021
Merged
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
19 changes: 12 additions & 7 deletions yapapi/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,10 @@ class ProviderInfo:
subnet_tag: Optional[str]


MAX_AGREEMENT_EXPIRATION_MINUTES = round(MAX_AGREEMENT_EXPIRATION.seconds / 60)
MIN_AGREEMENT_EXPIRATION_MINUTES = round(MIN_AGREEMENT_EXPIRATION.seconds / 60)


class SummaryLogger:
"""Aggregates information from computation events to provide a high-level summary.

Expand Down Expand Up @@ -399,12 +403,12 @@ def _handle(self, event: events.Event):
if not MIN_AGREEMENT_EXPIRATION <= provider_timeout <= MAX_AGREEMENT_EXPIRATION:
min, sec = divmod(round(timeout.total_seconds()), 60)
seconds_str = f" {sec} sec " if sec else " "
max_minutes = round(MAX_AGREEMENT_EXPIRATION.seconds / 60)
self.logger.warning(
f"Expiration time for your tasks is set to {min} min{seconds_str}from now."
" Providers may not be willing to take up tasks which expire sooner than 5 min"
f" or later than {max_minutes} min, counting from the moment they get your"
" demand."
f" Providers may not be willing to take up tasks which expire sooner than"
f" {MIN_AGREEMENT_EXPIRATION_MINUTES} min or later than"
f" {MAX_AGREEMENT_EXPIRATION_MINUTES} min, counting"
f" from the moment they get your demand."
)

elif isinstance(event, events.ProposalReceived):
Expand All @@ -427,9 +431,10 @@ def _handle(self, event: events.Event):
f"{self.time_waiting_for_proposals.seconds}s."
)
msg += (
" Make sure you're using the latest released versions of yagna and yapapi,"
" and the correct subnet. Also make sure that the timeout for computing all"
" tasks is within the 5 min to 30 min range."
f" Make sure you're using the latest released versions of yagna and yapapi,"
f" and the correct subnet. Also make sure that the timeout for computing all"
f" tasks is within the {MIN_AGREEMENT_EXPIRATION_MINUTES} min to"
f" {MAX_AGREEMENT_EXPIRATION_MINUTES} min range."
)
self.logger.warning(msg)

Expand Down