This repository was archived by the owner on Jul 13, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 17
Set Pyworker errror for Autoscaler to handle reliability descrease only for such #39
Open
nakinnubis
wants to merge
5
commits into
vast-ai:main
Choose a base branch
from
nakinnubis:AUTO-914
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
9d75829
Enhance error handling in delete requests by distinguishing between e…
nakinnubis 6929244
Refactor delete request
nakinnubis 12cb625
Refactor delete request handling to simplify payload structure and im…
nakinnubis 657c7a8
Refactor and remove deadcode
nakinnubis fc3eb21
Refactor delete request payload
nakinnubis File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -151,13 +151,17 @@ def _set_mtoken(self, mtoken: str) -> None: | |
| #######################################Private####################################### | ||
|
|
||
| async def __send_delete_requests_and_reset(self): | ||
| async def post(report_addr: str, idxs: list[int], success_flag: bool) -> bool: | ||
| async def post( | ||
| report_addr: str, idxs: list[int], success_flag: bool, is_pyworker_error: bool | None = None | ||
| ) -> bool: | ||
| data = { | ||
| "worker_id": self.id, | ||
| "mtoken": self.mtoken, | ||
| "request_idxs": idxs, | ||
| "success": success_flag, | ||
| } | ||
| if is_pyworker_error is not None: | ||
| data["is_pyworker_error"] = is_pyworker_error | ||
|
nakinnubis marked this conversation as resolved.
Outdated
|
||
| log.debug( | ||
| f"Deleting requests that {'succeeded' if success_flag else 'failed'}: {data['request_idxs']}" | ||
| ) | ||
|
nakinnubis marked this conversation as resolved.
Outdated
|
||
|
|
@@ -180,28 +184,32 @@ async def post(report_addr: str, idxs: list[int], success_flag: bool) -> bool: | |
| # Take a snapshot of what we plan to send this tick. | ||
| # New arrivals after this snapshot will remain in the queue for the next tick. | ||
| snapshot = list(self.model_metrics.requests_deleting) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. requests_payload is now just
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I miswrote this: this was supposed to be "request_payload is now a snapshot", not "just snapshot, meaning that Passing snapshot to post won't work work. |
||
| success_idxs = [r.request_idx for r in snapshot if r.success is True] | ||
| failed_idxs = [r.request_idx for r in snapshot if r.success is False] | ||
| success_idxs = [r.request_idx for r in snapshot if r.success is True] | ||
| failed_error_idxs = [r.request_idx for r in snapshot if r.success is False and r.status == "Error"] | ||
|
nakinnubis marked this conversation as resolved.
Outdated
|
||
| failed_other_idxs = [r.request_idx for r in snapshot if r.success is False and r.status != "Error"] | ||
|
nakinnubis marked this conversation as resolved.
Outdated
|
||
|
|
||
| if not success_idxs and not failed_idxs: | ||
| if not success_idxs and not failed_error_idxs and not failed_other_idxs: | ||
| return # nothing to do | ||
|
|
||
| for report_addr in self.report_addr: | ||
| # TODO: Add a Redis subscriber queue for delete_requests | ||
| if report_addr == "https://cloud.vast.ai/api/v0": | ||
| # Patch: ignore the Redis API report_addr | ||
| continue | ||
| sent_success = True | ||
| sent_failed = True | ||
| sent_success = True | ||
| sent_failed_error = True | ||
|
nakinnubis marked this conversation as resolved.
Outdated
|
||
| sent_failed_other = True | ||
|
|
||
| if success_idxs: | ||
| sent_success = await post(report_addr, success_idxs, True) | ||
| if failed_idxs: | ||
| sent_failed = await post(report_addr, failed_idxs, False) | ||
| if failed_error_idxs: | ||
| sent_failed_error = await post(report_addr, failed_error_idxs, False, True) | ||
| if failed_other_idxs: | ||
| sent_failed_other = await post(report_addr, failed_other_idxs, False, False) | ||
|
|
||
| if sent_success and sent_failed: | ||
| if sent_success and sent_failed_error and sent_failed_other: | ||
| # Remove only the items we actually sent from the live queue. | ||
| sent_set = set(success_idxs) | set(failed_idxs) | ||
| sent_set = set(success_idxs) | set(failed_error_idxs) | set(failed_other_idxs) | ||
| self.model_metrics.requests_deleting[:] = [ | ||
| r for r in self.model_metrics.requests_deleting | ||
| if r.request_idx not in sent_set | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.