Skip to content
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

Allow disconnecting service-connector from stack component #1864

Merged
merged 6 commits into from
Oct 30, 2023

Conversation

safoinme
Copy link
Contributor

@safoinme safoinme commented Oct 6, 2023

Describe changes

I implemented/fixed _ to achieve _.

Pre-requisites

Please ensure you have done the following:

  • I have read the CONTRIBUTING.md document.
  • If my change requires a change to docs, I have updated the documentation accordingly.
  • If I have added an integration, I have updated the integrations table and the corresponding website section.
  • I have added tests to cover my changes.
  • I have based my new branch on develop and the open PR is targeting develop. If your branch wasn't based on develop read Contribution guide on rebasing branch to develop.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Other (add details above)

@github-actions github-actions bot added internal To filter out internal PRs and issues enhancement New feature or request labels Oct 6, 2023
Copy link
Contributor

@fa9r fa9r left a comment

Choose a reason for hiding this comment

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

Great functionality, looking forward to using that 👍

Overall the implementation looks good, however I would prefer if disconnect was a separate field in the StackComponentUpdateModel since connector=None usually just means that this value was not provided and should not be updated. See comment below.

Other than that only minor issues, looks like we can merge it today 🚀

src/zenml/zen_stores/rest_zen_store.py Outdated Show resolved Hide resolved
src/zenml/cli/stack_components.py Outdated Show resolved Hide resolved
src/zenml/cli/stack_components.py Outdated Show resolved Hide resolved
src/zenml/client.py Outdated Show resolved Hide resolved
Comment on lines +1528 to +1530
else:
existing_component.connector = None
existing_component.connector_resource_id = None
Copy link
Contributor

Choose a reason for hiding this comment

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

Currently, if any value in an update model is None, it means that this value was not provided and should not be updated. So I think the current design is breaking this convention since connector=None now disconnects the existing connector and thereby leads to updates.

Instead, I would suggest to add disconnect as a field of StackComponentUpdateModel explicitly and then use this here instead:

Suggested change
else:
existing_component.connector = None
existing_component.connector_resource_id = None
elif component_update.disconnect:
existing_component.connector = None
existing_component.connector_resource_id = None

Copy link
Contributor

Choose a reason for hiding this comment

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

I think it's fine as it is, because this immediately fixes the UI as well. The alternative also requires dashboard changes. If it helps, this is the same approach used for service connector updates: some update fields are "special", in the sense that if set to None or omitted from the update request, they are interpreted as a value removal rather than a value omission.

src/zenml/zen_stores/sql_zen_store.py Outdated Show resolved Hide resolved
src/zenml/zen_stores/sql_zen_store.py Outdated Show resolved Hide resolved
Copy link
Contributor

@stefannica stefannica left a comment

Choose a reason for hiding this comment

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

LGTM aside from the changes that Felix already suggested.

@stefannica stefannica requested a review from fa9r October 30, 2023 18:22
@safoinme safoinme merged commit 6b35e9d into develop Oct 30, 2023
29 checks passed
@safoinme safoinme deleted the feature/OSS-2129-add-disconnect-service-connector branch October 30, 2023 21:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request internal To filter out internal PRs and issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants