-
Notifications
You must be signed in to change notification settings - Fork 324
Check for existence of job before polling. Closes #330. #331
Conversation
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed, please reply here (e.g.
|
bd7556f
to
2f4b54d
Compare
@peihe any comment on this one? |
Pei: please take a look |
* | ||
* <p>Returns null if the {@code maxAttempts} retries reached. | ||
*/ | ||
Boolean exists(JobReference jobRef, int maxAttempts) throws InterruptedException; |
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.
I suggests to define the new function as:
/**
Gets the Job by {@link JobReference}.
Returns null if the job is not found. */ Job getJob(JobReference jobRef) throws InterruptedException, IOException;
The reason is: 1. getJob doesn't need to wait for the job to finish. 2. getJob is more general than exists.
Use the default BackOff for IOException:
new AttemptBoundedExponentialBackOff(MAX_RPC_ATTEMPTS, INITIAL_RPC_BACKOFF_MILLIS)
And, In the CleanupOperation, you can replace the pollJob() with getJob().
…#330. In case of local runners, export job does not exists, check if job exists before polling for result. This will prevent unnecessary exceptions, polling in local mode.
2f4b54d
to
ff45995
Compare
@peihe applied your suggestions. |
ff45995
to
e2c9d8f
Compare
ping @peihe |
sorry for the delay. This PR looks good to me. Thanks for submitting the fix! |
This RP is merged in #351 |
@peihe for some reason I can't find my commits in the history? Do you know what happen? |
Ping @peihe |
Hi Rav, It looks like I messed up. GitHub automatically squashes pull requests into a single commit when merging, unless you specifically opt out. When I merged #351, which Pei sent as 3 commits, they got squashed fully into 1 commit. On the command line, rebase+squash like this will result in Sorry for the gaffe. This difference in functionality is something I will watch out for this in the future. At this point, we cannot retroactively repair the history. However, if you like I will revert (at HEAD) the squash and try to manually merge #351 again to properly attribute credit to you. |
@dhalperi I see. No need for manual fix. Thanks. |
In case of local runners, export job does not exists, check if job
exists before polling for result. This will prevent unnecessary
exceptions, polling in local mode.