Skip to content

CLN: use wait_for_job rather than sleep #48

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

Closed
jreback opened this issue Jun 7, 2017 · 3 comments
Closed

CLN: use wait_for_job rather than sleep #48

jreback opened this issue Jun 7, 2017 · 3 comments
Labels
type: process A process-related concern. May include testing, release, or the like.

Comments

@jreback
Copy link
Contributor

jreback commented Jun 7, 2017

code here: #24 (comment)
to replace sleep calls in tests.

def wait_for_job(job):

    # from https://github.com/GoogleCloudPlatform/python-docs-samples/blob/master/bigquery/cloud-client/snippets.py

    while True:
        job.reload()  # Refreshes the state via a GET request.
        if job.state == 'DONE':
            if job.error_result:
                raise RuntimeError(job.errors)
            return
        logger.info("Waiting for {} to complete".format(job))
        time.sleep(1)
@jreback jreback added the type: process A process-related concern. May include testing, release, or the like. label Jun 7, 2017
@jreback
Copy link
Contributor Author

jreback commented Jun 7, 2017

cc @MaximilianR
cc @mr-mcox

@max-sixty
Copy link
Contributor

And the logging is at the author's discretion; probably not needed for tests

@tswast
Copy link
Collaborator

tswast commented Feb 12, 2018

The latest version uses .result() on the job object to do something similar to wait for the job to finish.

@tswast tswast closed this as completed Feb 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: process A process-related concern. May include testing, release, or the like.
Projects
None yet
Development

No branches or pull requests

3 participants