Skip to content

Conversation

@vinnysenthil
Copy link
Contributor

Summary of changes:

  • Implement Dataset class with following methods
    • __init__
    • _create
    • _import
    • create
    • import_data
    • export_data
  • Ten unit tests covering 98% of Dataset class
  • Add two helper functions to utils.pyvalidate_id and validate_string_list
  • Add an error when project is not initialized or set in credentials

Fixes b/169781839

* Add global_config unset project error

* Add two validation functions to utils

* Implement initial Dataset class

* Lint utils.py
@google-cla google-cla bot added the cla: yes This human has signed the Contributor License Agreement. label Oct 20, 2020
Copy link
Member

@sasha-gitg sasha-gitg left a comment

Choose a reason for hiding this comment

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

Looks great! I really like how you used pytest fixtures for patching.

if not source:
return dataset_obj

return dataset_obj.import_data(
Copy link
Contributor

Choose a reason for hiding this comment

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

This would return an LRO, while in the "no data import" case, we wait until the create_dataset LRO completes. We need to document clearly (e.g. in the docstring) this inconsistent behavior.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah these multiple LROs under-the-hood can be misleading to the user. I'm adding this discussion to b/171275584

@pytest.fixture
def get_dataset_mock(self):
with patch.object(DatasetServiceClient, "get_dataset") as get_dataset_mock:
get_dataset_mock.return_value = GapicDataset(
Copy link
Contributor

Choose a reason for hiding this comment

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

this can become difficult to maintain to make sure the mocks return correct responses. we should look into replays.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Captured in b/171334022

reload(aip)

@pytest.fixture
def get_dataset_mock(self):
Copy link
Contributor

Choose a reason for hiding this comment

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

perhaps move the mock fixtures into conftest.py so they could be more easily reused.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Captured in b/171333554

@dizcology dizcology added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Oct 20, 2020
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Oct 20, 2020
@vinnysenthil vinnysenthil added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Oct 20, 2020
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Oct 20, 2020
@vinnysenthil vinnysenthil merged commit d65512e into googleapis:dev Oct 20, 2020
dizcology pushed a commit to dizcology/python-aiplatform that referenced this pull request Nov 30, 2020
* Dataset class (#1)

* Add global_config unset project error

* Add two validation functions to utils

* Implement initial Dataset class

* Lint utils.py

* Address reviewer comments + remove aip alias

* Change re.Match to typing.Match

* Lint with Py 3.8

* Address flake8 errors, remove unused vars
dizcology pushed a commit to dizcology/python-aiplatform that referenced this pull request Nov 30, 2020
* Dataset class (#1)

* Add global_config unset project error

* Add two validation functions to utils

* Implement initial Dataset class

* Lint utils.py

* Address reviewer comments + remove aip alias

* Change re.Match to typing.Match

* Lint with Py 3.8

* Address flake8 errors, remove unused vars
dizcology pushed a commit to dizcology/python-aiplatform that referenced this pull request Nov 30, 2020
* Dataset class (#1)

* Add global_config unset project error

* Add two validation functions to utils

* Implement initial Dataset class

* Lint utils.py

* Address reviewer comments + remove aip alias

* Change re.Match to typing.Match

* Lint with Py 3.8

* Address flake8 errors, remove unused vars
dizcology pushed a commit to dizcology/python-aiplatform that referenced this pull request Nov 30, 2020
* Dataset class (#1)

* Add global_config unset project error

* Add two validation functions to utils

* Implement initial Dataset class

* Lint utils.py

* Address reviewer comments + remove aip alias

* Change re.Match to typing.Match

* Lint with Py 3.8

* Address flake8 errors, remove unused vars
dizcology pushed a commit to dizcology/python-aiplatform that referenced this pull request Nov 30, 2020
* Dataset class (#1)

* Add global_config unset project error

* Add two validation functions to utils

* Implement initial Dataset class

* Lint utils.py

* Address reviewer comments + remove aip alias

* Change re.Match to typing.Match

* Lint with Py 3.8

* Address flake8 errors, remove unused vars
dizcology pushed a commit to dizcology/python-aiplatform that referenced this pull request Dec 22, 2020
* Dataset class (#1)

* Add global_config unset project error

* Add two validation functions to utils

* Implement initial Dataset class

* Lint utils.py

* Address reviewer comments + remove aip alias

* Change re.Match to typing.Match

* Lint with Py 3.8

* Address flake8 errors, remove unused vars
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants