Skip to content
This repository has been archived by the owner on Nov 29, 2023. It is now read-only.

docs: samples for managing reservations #144

Merged

Conversation

tswast
Copy link
Contributor

@tswast tswast commented Aug 10, 2021

TODO: Testing these samples requires a capacity commitment. I created on manually on my dev project, but I think we'll want to programmatically create one in our CI project(s).

Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

  • Make sure to open an issue as a bug/issue before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)

Fixes #56 🦕

@tswast tswast requested a review from a team as a code owner August 10, 2021 19:08
@tswast tswast requested a review from crwilcox August 10, 2021 19:08
@snippet-bot
Copy link

snippet-bot bot commented Aug 10, 2021

Here is the summary of changes.

You are about to add 3 region tags.

This comment is generated by snippet-bot.
If you find problems with this result, please file an issue at:
https://github.com/googleapis/repo-automation-bots/issues.
To update this comment, add snippet-bot:force-run label or use the checkbox below:

  • Refresh this comment

@product-auto-label product-auto-label bot added the api: bigqueryreservation Issues related to the googleapis/python-bigquery-reservation API. label Aug 10, 2021
@google-cla google-cla bot added the cla: yes This human has signed the Contributor License Agreement. label Aug 10, 2021
@product-auto-label product-auto-label bot added the samples Issues that are directly related to samples. label Aug 10, 2021
@tswast
Copy link
Contributor Author

tswast commented Aug 10, 2021

args = (parent: "projects/python-docs-samples-tests/locations/US"
capacity_commitment {
  slot_count: 100
  plan: FLEX
}
,)
kwargs = {'metadata': [('x-goog-request-params', 'parent=projects/python-docs-samples-tests/locations/US'), ('x-goog-api-client', 'gl-python/3.6.13 grpc/1.39.0 gax/1.31.1 gapic/1.2.2')]}

    @six.wraps(callable_)
    def error_remapped_callable(*args, **kwargs):
        try:
            return callable_(*args, **kwargs)
        except grpc.RpcError as exc:
>           six.raise_from(exceptions.from_grpc_error(exc), exc)
E           google.api_core.exceptions.FailedPrecondition: 400 Google owned projects are not allowed to buy FLEX slots, please see go/bq-flex-restrictions for details.

.nox/py-3-6/lib/python3.6/site-packages/google/api_core/grpc_helpers.py:69: FailedPrecondition
- generated xml file: /tmpfs/src/github/python-bigquery-reservation/samples/snippets/sponge_log.xml -

I've requested FLEX slot usage in internal bug 196099709

@tswast tswast added the status: blocked Resolving the issue is dependent on other work. label Aug 10, 2021
@tswast tswast requested a review from shollyman August 10, 2021 22:53
@tswast
Copy link
Contributor Author

tswast commented Aug 12, 2021

It worked! We can now use FLEX commitments on the samples project.

@tswast tswast requested a review from a team August 13, 2021 14:53
@tswast tswast requested a review from a team as a code owner August 13, 2021 14:53
@tswast tswast added the automerge Merge the pull request once unit tests and other checks pass. label Aug 13, 2021
@gcf-merge-on-green gcf-merge-on-green bot merged commit 27b2564 into googleapis:master Aug 13, 2021
@gcf-merge-on-green gcf-merge-on-green bot removed the automerge Merge the pull request once unit tests and other checks pass. label Aug 13, 2021
@tswast tswast deleted the issue56-b195651730-update-sample branch August 13, 2021 15:47
@jamiet-msm
Copy link

@tswast Hugely appreciate you providing these samples, saved me a big job. I was specifically looking for an example for update_reservation, the field_mask stuff was non-obvious to me.

@tswast
Copy link
Contributor Author

tswast commented Oct 14, 2022

@tswast Hugely appreciate you providing these samples, saved me a big job. I was specifically looking for an example for update_reservation, the field_mask stuff was non-obvious to me.

@jamiet-msm I'm so glad that you found them helpful. Thanks for the feedback.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
api: bigqueryreservation Issues related to the googleapis/python-bigquery-reservation API. cla: yes This human has signed the Contributor License Agreement. samples Issues that are directly related to samples. status: blocked Resolving the issue is dependent on other work.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Provide sample codes on how to use methods
3 participants