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

[qob] Add ability to attach to existing batch #14829

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jigold
Copy link
Contributor

@jigold jigold commented Mar 4, 2025

Change Description

This PR allows you to reuse an existing batch when submitting QoB jobs. The goal of this change is to be able to group QoB queries together to allow for easier visibility of how much a pipeline costs as well as make the batches page less cluttered so it's easier to tell what is running.

Security Assessment

  • This change has no security impact

Impact Description

This change only affects the client library and doesn't touch the backend code.

(Reviewers: please confirm the security impact before approving)


You all changed how the tests are structured. Please rewrite the test if it doesn't make sense given the current infrastructure.

@@ -197,7 +198,7 @@ async def create(
if batch_client is None:
batch_client = await BatchClient.create(billing_project, _token=credentials_token)
async_exit_stack.push_async_callback(batch_client.close)
batch_attributes: Dict[str, str] = dict()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code was unused.

Copy link
Member

@ehigham ehigham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

await self._batch.submit(disable_progress_bar=True)
self._batch_was_submitted = True
with timings.step("wait driver"):
try:
await asyncio.sleep(0.6) # it is not possible for the batch to be finished in less than 600ms
await self._batch.wait(
description=name,
disable_progress_bar=self.disable_progress_bar,
progress=progress,
starting_job=j.job_id,
)

^ these line makes me scared. What happens if this is submitted from an existing batch that waits for this job. Is this effectively a deadlock? I'm guessing yes and the solution is job groups in the batch client...

@jigold
Copy link
Contributor Author

jigold commented Mar 4, 2025

To my understanding and a quick glance at the code, each new query is in its own job group and the driver waits on jobs within it's child job group.

job_group=self._batch.create_job_group(attributes={'name': name}),

I could be wrong though and it's a legitimate concern.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants