-
Notifications
You must be signed in to change notification settings - Fork 244
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
[qob][batch] do not list all jobs on failure (plus: types!) #13500
Conversation
CHANGELOG: In Query-on-Batch, the client-side Python code will not try to list every job when a QoB batch fails. This could take hours for long-running pipelines or pipelines with many partitions. I also added API types to the list jobs end point because I have to go hunting for this every time anyway. Seems better to have this information at our digital fingertips.
@@ -462,14 +474,21 @@ async def wait(self, | |||
with BatchProgressBar(disable=disable_progress_bar) as progress2: | |||
return await self._wait(description, progress2, disable_progress_bar, starting_job) | |||
|
|||
async def debug_info(self): | |||
async def debug_info(self, | |||
_job_filter: Optional[Callable[[JobListEntry], bool]] = None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a drive by comment: You can use the query string q
to search for failed jobs instead of filtering client-side
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
from typing_extensions import NotRequired | ||
|
||
|
||
class JobListEntry(TypedDict): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These both need to be versioned. Otherwise, we're going to run into issues with backwards compatibility.
I don't understand how the backwards compatibility is going to work in this case:
|
A V1 client cannot hit the V2 endpoint because it doesn't know it exists. |
To be clear, all this does is encode in the types what we already guarantee: if version X returns |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just so I understand correctly, we can add fields to the V1Alpha type later on, but not remove them or change the type?
@@ -252,7 +253,9 @@ async def _handle_api_error(f: Callable[P, Awaitable[T]], *args: P.args, **kwarg | |||
raise e.http_response() | |||
|
|||
|
|||
async def _query_batch_jobs(request: web.Request, batch_id: int, version: int, q: str, last_job_id: Optional[int]): | |||
async def _query_batch_jobs( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're missing the V1Alpha
here.
85381a0
to
902ac13
Compare
I merged main and was forced to fix the pyright errors, which was great! I found two bugs with these new types:
I also noticed |
We should not remove or change fields, the types of fields, or the meaning of fields of JSON dicts returned by our API endpoints because that would break backwards compatibility. The types on the other hand can change willy nilly, mypy and pyright have no way of knowing that we changed the definition of, for example, GetJobResponseV1Alpha. They will however, go report all the places in our codebase where we expected certain fields to exist if we remove those fields from GetJobResponseV1Alpha. |
@jigold bump |
CHANGELOG: In Query-on-Batch, the client-side Python code will not try to list every job when a QoB batch fails. This could take hours for long-running pipelines or pipelines with many partitions.
I also added API types to the list jobs end point because I have to go hunting for this every time anyway. Seems better to have this information at our digital fingertips.