-
Notifications
You must be signed in to change notification settings - Fork 347
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: support dataset update #1416
Conversation
assert dataset.gca_resource.description == _TEST_DATASET_DESCRIPTION | ||
|
||
finally: | ||
if dataset is not None: |
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.
This line is superfluous. dataset
will only exist on assignment after ImageDataset.create
is successful.
The test should start with dataset=None
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.
If the ImageDataset.create
is successful, then we want to delete the dataset finally. But if create()
fails, dataset is None and we shouldn't call dataset.delete()
. So I think it's necessary to add this line.
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.
If create fails then dataset
is not defined and if dataset is not None
will throw a NameError
. dataset
isn't created until after the right side of the statement, dataset = aiplatform.ImageDataset.create()
is successful. You can validate this behavior in Python:
def f():
raise RuntimeError('')
try:
dataset = f()
except:
if dataset is None:
pass
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.
Got it!
But I see other system tests like test_create_and_import_image_dataset
and test_create_tabular_dataset
have the same pattern that checks if dataset is not None
. Is there any reason for that?
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.
No, those should be eventually fixed as well.
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.
Got it. Just removed this line. Thank you!
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:
Fixes #1178 🦕