Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Implement initial Dataset class#31

Merged
vinnysenthil merged 6 commits into
googleapis:devgoogleapis/python-aiplatform:devfrom
vinnysenthil:devvinnysenthil/python-aiplatform:devCopy head branch name to clipboard
Oct 20, 2020
Merged

Implement initial Dataset class#31
vinnysenthil merged 6 commits into
googleapis:devgoogleapis/python-aiplatform:devfrom
vinnysenthil:devvinnysenthil/python-aiplatform:devCopy head branch name to clipboard

Conversation

@vinnysenthil

Copy link
Copy Markdown
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

@sasha-gitg sasha-gitg left a comment

Copy link
Copy Markdown
Member

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.

Comment thread google/cloud/aiplatform/datasets.py Outdated
Comment thread google/cloud/aiplatform/datasets.py Outdated
Comment thread google/cloud/aiplatform/datasets.py
Comment thread google/cloud/aiplatform/datasets.py Outdated
Comment thread google/cloud/aiplatform/datasets.py Outdated
Comment thread google/cloud/aiplatform/datasets.py
Comment thread google/cloud/aiplatform/datasets.py Outdated
Comment thread google/cloud/aiplatform/datasets.py Outdated
Comment thread google/cloud/aiplatform/utils.py Outdated
Comment thread google/cloud/aiplatform/datasets.py
Comment thread google/cloud/aiplatform/datasets.py Outdated
Comment thread google/cloud/aiplatform/datasets.py
if not source:
return dataset_obj

return dataset_obj.import_data(

Copy link
Copy Markdown
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
Copy Markdown
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

Comment thread google/cloud/aiplatform/initializer.py Outdated
@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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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

Morty Proxy This is a proxified and sanitized view of the page, visit original site.