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

Always report Scheduler abort reasons to Discord #348

Merged
merged 1 commit into from
Oct 31, 2024
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
28 changes: 9 additions & 19 deletions netkan/netkan/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,8 @@ def can_schedule(self, max_queued: int, dev: bool = False,
if not dev:
github_remaining = github_limit_remaining(self.github_token)
if github_remaining < min_gh:
logging.error(
"Run skipped, GitHub API limit nearing exhaustion (Current: %s)",
github_remaining
)
logging.error("Run skipped for %s; GitHub API rate limit remaining %s below %s",
self.game_id, github_remaining, min_gh)
return False

end = datetime.datetime.utcnow()
Expand All @@ -131,9 +129,8 @@ def can_schedule(self, max_queued: int, dev: bool = False,
# https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/burstable-performance-instances-monitoring-cpu-credits.html
cpu_credits = self.cpu_credits(cloudwatch, instance_id, start, end)
if cpu_credits < min_cpu:
logging.info(
"Run skipped, below cpu credit target (Current Avg: %s)", cpu_credits
)
logging.error("Run skipped for %s: cpu credit %s below target %s",
self.game_id, cpu_credits, min_cpu)
return False

# https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-volume-types.html
Expand All @@ -144,21 +141,14 @@ def can_schedule(self, max_queued: int, dev: bool = False,
vol_credits_percent = self.volume_credits_percent(
cloudwatch, instance_id, start, end)
if vol_credits_percent < min_io:
logging.error(
"Run skipped, below volume credit target percentage (Current Avg: %s)",
vol_credits_percent
)
logging.error("Run skipped for %s: volume credit percentage %s below target %s",
self.game_id, vol_credits_percent, min_io)
return False

message_count = int(
self.queue.attributes.get(
'ApproximateNumberOfMessages', 0)
)
message_count = int(self.queue.attributes.get('ApproximateNumberOfMessages', 0))
if message_count > max_queued:
logging.info(
"Run skipped, too many NetKANs to process (%s left)",
message_count
)
logging.error("Run skipped for %s: %s messages in queue exceeds %s",
self.game_id, message_count, max_queued)
return False

return True