Skip to content

Bigtable createInstance Public Api#1086

Closed
mohitq wants to merge 20 commits intogoogleapis:bigtablefrom
mohitq:bigtable_public-api
Closed

Bigtable createInstance Public Api#1086
mohitq wants to merge 20 commits intogoogleapis:bigtablefrom
mohitq:bigtable_public-api

Conversation

@mohitq
Copy link
Copy Markdown

@mohitq mohitq commented Jun 7, 2018

Review Public API

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Jun 7, 2018
@jdpedrie jdpedrie changed the title createIntsance Public Api createInstance Public Api Jun 7, 2018
@sduskis
Copy link
Copy Markdown

sduskis commented Jun 8, 2018

@mohitq The tests are failing. They need to pass before a review can happen.

@jdpedrie jdpedrie added api: bigquery Issues related to the BigQuery API. do not merge Indicates a pull request not ready for merge, due to either quality or timing. labels Jun 8, 2018
@dwsupplee dwsupplee added api: bigtable Issues related to the Bigtable API. and removed api: bigquery Issues related to the BigQuery API. labels Jun 8, 2018
Comment thread Bigtable/src/BigtableClient.php Outdated
use Google\Auth\FetchAuthTokenInterface;
use Google\Cloud\Core\ClientTrait;
use Google\Cloud\Core\Exception\GoogleException;
use Google\Cloud\Core\Int64;

This comment was marked as spam.

use Google\Cloud\Core\LongRunning\LROTrait;
use Google\Cloud\Bigtable\Admin\V2\BigtableInstanceAdminClient as InstanceAdminClient;
use Google\Cloud\Bigtable\Connection\Grpc;
use Google\Cloud\Bigtable\Connection\LongRunningConnection;

This comment was marked as spam.

This comment was marked as spam.

@sduskis
Copy link
Copy Markdown

sduskis commented Jun 12, 2018

@jdpedrie, do you have any idea why the builds failed?

@jdpedrie
Copy link
Copy Markdown
Contributor

jdpedrie commented Jun 12, 2018

@sduskis appveyor can be a bit flaky when installing dependencies. I've restarted the build there. There's no action that is required to fix that so long as the restarted build successfully gets through the install step.

On travis, there was a segfault, which can sometimes be fixed with a re-run, but more often indicates an underlying problem which can be somewhat difficult to debug. I'm re-running that job. If it fails again I'll see if I can uncover the problem.

Comment thread Bigtable/src/BigtableClient.php Outdated
* $ pecl install protobuf
* ```
*
* Example

This comment was marked as spam.

Comment thread Bigtable/src/Instance.php Outdated
* @type string $pageToken A previously-returned page token used to
* resume the loading of results from a specific point.
* }
* @return ItemIterator<InstanceConfiguration>

This comment was marked as spam.

use Google\Cloud\Core\LongRunning\LROTrait;
use Google\Cloud\Bigtable\Admin\V2\BigtableInstanceAdminClient as InstanceAdminClient;
use Google\Cloud\Bigtable\Connection\Grpc;
use Google\Cloud\Bigtable\Connection\LongRunningConnection;

This comment was marked as spam.

@dwsupplee
Copy link
Copy Markdown
Contributor

@mohitq Did you want to include tests in this PR or as a follow up?

@mohitq mohitq changed the title createInstance Public Api Bigtable createInstance Public Api Jun 13, 2018
@mohitq
Copy link
Copy Markdown
Author

mohitq commented Jun 14, 2018

@dwsupplee Is it possible this PR without tests? If yes, then i will create a new PR for tests.

Comment thread Bigtable/src/BigtableClient.php Outdated
* @method resumeOperation() {
* Resume a Long Running Operation
*
* Example

This comment was marked as spam.

/**
* @param ConnectionInterface $connection
*/
public function __construct(ConnectionInterface $connection)

This comment was marked as spam.

This comment was marked as spam.

@dwsupplee
Copy link
Copy Markdown
Contributor

@mohitq I would recommend to write tests alongside the code, so that if the tests reveal any issues you don't need to circle back again. However, if you would prefer to add them later I don't have a major issue with that.

@jdpedrie
Copy link
Copy Markdown
Contributor

jdpedrie commented Jun 18, 2018

@mohitq looks like you've got some snippet test failures. Don't forget, you can run all the tests except the system tests locally using dev/sh/tests. You can also run test suites individually:

# unit tests
$ vendor/bin/phpunit

# snippet tests
$ vendor/bin/phpunit -c phpunit-snippets.xml.dist

If you want to run just the bigtable tests, use the --group option, like so:

# run bigtable unit tests
$ vendor/bin/phpunit --group=bigtable`

# run bigtable snippet tests
$ vendor/bin/phpunit -c phpunit-snippets.xml.dist --group=bigtable

Apologies if I'm reiterating information you already know. Just want to be sure. :)

@sduskis
Copy link
Copy Markdown

sduskis commented Jun 25, 2018

@jdpedrie and @dwsupplee I think that we're ready for a review.

Comment thread Bigtable/src/Instance.php Outdated
$id = $value['clusterId'];
$clusters[$id] = [
'location' => InstanceAdminClient::locationName($this->projectId, $value['locationId']),
'serveNodes' => isset($value['nodeCount']) ? $value['nodeCount'] : 1,

This comment was marked as spam.

Comment thread Bigtable/src/BigtableClient.php Outdated
* string $clusterId
* string $locationId
* int $nodeCount **Defaults to** `1`.
* int $storageType **Defaults to** `0`.

This comment was marked as spam.

This comment was marked as spam.

Comment thread Bigtable/src/Instance.php Outdated
* Configuration options
*
* @type string $displayName **Defaults to** the value of $name.
* @type int $instanceType **Defaults to** `0`.

This comment was marked as spam.

Comment thread Bigtable/src/BigtableClient.php Outdated
* requests specifically for authentication.
* @type FetchAuthTokenInterface $credentialsFetcher A credentials
* fetcher instance.
* @type callable $httpHandler A handler used to deliver Psr7 requests.

This comment was marked as spam.

@mohitq
Copy link
Copy Markdown
Author

mohitq commented Jun 25, 2018

Updated as per comment.

Comment thread Bigtable/src/BigtableClient.php Outdated
*
* @type string $displayName **Defaults to** the value of $instanceId.
* @type int $instanceType Possible values include `Instance_Type::PRODUCTION`
* and `Instance_Type::DEVELOPMENT`.

This comment was marked as spam.

@mohitq
Copy link
Copy Markdown
Author

mohitq commented Jun 26, 2018

@jdpedrie Updated all comment changes.

*
* @type string $projectId The project ID from the Google Developer's
* Console.
* @type array $authCacheOptions Cache configuration options.

This comment was marked as spam.

This comment was marked as spam.

* @type string $projectId The project ID from the Google Developer's
* Console.
* @type array $authCacheOptions Cache configuration options.
* @type callable $authHttpHandler A handler used to deliver Psr7

This comment was marked as spam.

This comment was marked as spam.

Copy link
Copy Markdown
Contributor

@jdpedrie jdpedrie left a comment

Choose a reason for hiding this comment

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

Client is looking very good. I found a couple of style issues and a couple of suggested improvements, but this is getting close.

The new classes need unit test coverage. I'd prefer if it we could test as we go, rather than trying to play catch up later. If you feel strongly otherwise, please let me know and we'll talk about it.

Comment thread Bigtable/src/BigtableClient.php Outdated
* **Defaults to**`Instance_Type::TYPE_UNSPECIFIED`.
* @type array $labels For more information, see
* [Using labels to organize Google Cloud Platform resources](https://cloudplatform.googleblog.com/2015/10/using-labels-to-organize-Google-Cloud-Platform-resources.html).
* @type array $clusters [] {

This comment was marked as spam.

This comment was marked as spam.

Comment thread Bigtable/src/Instance.php Outdated
* }
* @return array
*/
private function clustersArray($args)

This comment was marked as spam.

Comment thread Bigtable/src/Instance.php Outdated
$clusters[$id] = [
'location' => InstanceAdminClient::locationName($this->projectId, $value['locationId']),
'serveNodes' => isset($value['serveNodes']) ? $value['serveNodes'] : '',
'defaultStorageType' => isset($value['storageType'])?$value['storageType']

This comment was marked as spam.

Copy link
Copy Markdown
Contributor

@dwsupplee dwsupplee left a comment

Choose a reason for hiding this comment

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

Really nice progress @mohitq, this is shaping up well.

* @type array $authCacheOptions Cache configuration options.
* @type callable $authHttpHandler A handler used to deliver Psr7
* requests specifically for authentication.
* @type FetchAuthTokenInterface $credentialsFetcher A credentials

This comment was marked as spam.

Comment thread Bigtable/src/BigtableClient.php Outdated

namespace Google\Cloud\Bigtable;

use Google\Cloud\Core\ArrayTrait;

This comment was marked as spam.

* @type int $retries Number of retries for a failed request.
* **Defaults to** `3`.
* }
* @throws GoogleException If the gRPC extension is not enabled.

This comment was marked as spam.

This comment was marked as spam.

Comment thread Bigtable/src/BigtableClient.php Outdated
* ```
*
* @codingStandardsIgnoreStart
* @see https://cloud.google.com/bigtable/docs/reference/admin/rpc/google.bigtable.admin.v2#CreateInstanceRequest CreateInstanceRequest

This comment was marked as spam.

Comment thread Bigtable/src/BigtableClient.php Outdated
*
* @type string $displayName **Defaults to** the value of $instanceId.
* @type int $instanceType Possible values include `Instance_Type::PRODUCTION` and `Instance_Type::DEVELOPMENT`.
* **Defaults to**`Instance_Type::TYPE_UNSPECIFIED`.

This comment was marked as spam.

Comment thread Bigtable/src/Instance.php Outdated
public function exists(array $options = [])
{
try {
$this->reload($options = []);

This comment was marked as spam.

Comment thread Bigtable/src/Instance.php Outdated
* Configuration options
*
* @type string $displayName **Defaults to** the value of $instanceId.
* @type int $instanceType Possible values include `Instance_Type::PRODUCTION` and `Instance_Type::DEVELOPMENT`.

This comment was marked as spam.

Comment thread Bigtable/src/Instance.php Outdated
*/
private function fullyQualifiedInstanceName($instanceId, $projectId)
{
try {

This comment was marked as spam.

use Google\Cloud\Bigtable\Admin\V2\BigtableInstanceAdminClient as InstanceAdminClient;
use Google\Cloud\Bigtable\BigtableClient;
use Google\Cloud\Bigtable\Instance;
use Google\Cloud\Bigtable\Connection\ConnectionInterface;

This comment was marked as spam.

Comment thread Bigtable/tests/Snippet/InstanceTest.php Outdated
}

/**
* @group bigtabladmin

This comment was marked as spam.

@mohitq mohitq force-pushed the bigtable_public-api branch from 0c63349 to c1ed412 Compare July 2, 2018 04:50
@sduskis
Copy link
Copy Markdown

sduskis commented Jul 2, 2018

This PR got larger than it needed to be, and still has some points of contention. I'd propose that we break up this PR into the following PRs:

  1. Finally, add BigtableClient.

How does this sound?

* int $storageType The storage media type for persisting Bigtable data. Possible values include `Google\Cloud\Bigtable\Instance::STORAGE_TYPE_SSD` and `Google\Cloud\Bigtable\Instance::STORAGE_TYPE_HDD`.
* **Defaults to** `Google\Cloud\Bigtable\Instance::STORAGE_TYPE_UNSPECIFIED`.
* }]
* Ex. [

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

* @param array $args
*/
public function getOperation(array $args);
/**

This comment was marked as spam.


/**
* @group bigtable
* @group bigtable-admin

This comment was marked as spam.

Comment thread Bigtable/src/Instance.php

$clustersArray = [];
foreach ($clusters as $value) {
$id = $value['clusterId'];

This comment was marked as spam.

Comment thread Bigtable/src/Instance.php
private function cluster($args)
{
$cluster = [];
$cluster['location'] = InstanceAdminClient::locationName($this->projectId, $args['locationId']);

This comment was marked as spam.

@dwsupplee
Copy link
Copy Markdown
Contributor

Sounds good to me @sduskis

@sduskis
Copy link
Copy Markdown

sduskis commented Jul 3, 2018

Long running connection PR was submitted: #1148

@dwsupplee
Copy link
Copy Markdown
Contributor

#1148 is merged, if we could please rebase now.

Comment thread Bigtable/src/Instance.php
* $instance = $bigtable->instance('my-instance');
* ```
*
* @method resumeOperation() {

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

Comment thread Bigtable/src/Instance.php
* @param array $info [optional] The operation data.
* @return LongRunningOperation
* }
* @method longRunningOperations() {

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

Copy link
Copy Markdown

@sduskis sduskis left a comment

Choose a reason for hiding this comment

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

@dwsupplee, I rebased.

@sduskis
Copy link
Copy Markdown

sduskis commented Jul 3, 2018

The GrpcTest was updated in #1149.

@dwsupplee
Copy link
Copy Markdown
Contributor

Thank you @sduskis. I hope you don't mind, I edited your comment to reflect the status of the items on the PR.

It looks like we just need this last round of reviews to be addressed. From there, it would be great if @jdpedrie / @fiboknacky don't mind doing a final pass to make sure everything looks good to them as well.

Copy link
Copy Markdown

@fiboknacky fiboknacky left a comment

Choose a reason for hiding this comment

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

I'm quite confused now.
We have #1158 open for similar changes.
Shall we continue reviewing this PR or move to do on that PR instead?

* int $storageType The storage media type for persisting Bigtable data. Possible values include `Google\Cloud\Bigtable\Instance::STORAGE_TYPE_SSD` and `Google\Cloud\Bigtable\Instance::STORAGE_TYPE_HDD`.
* **Defaults to** `Google\Cloud\Bigtable\Instance::STORAGE_TYPE_UNSPECIFIED`.
* }]
* Ex. [

This comment was marked as spam.

@sduskis
Copy link
Copy Markdown

sduskis commented Jul 9, 2018

Closing this in favor of #1158

@sduskis sduskis closed this Jul 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: bigtable Issues related to the Bigtable API. cla: yes This human has signed the Contributor License Agreement. do not merge Indicates a pull request not ready for merge, due to either quality or timing.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants