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

Fix dashboard deployment/creation #230

Merged
merged 25 commits into from
Jul 22, 2024
Merged

Fix dashboard deployment/creation #230

merged 25 commits into from
Jul 22, 2024

Conversation

JCZuurmond
Copy link
Member

@JCZuurmond JCZuurmond commented Jul 19, 2024

Fixes the dashboard deployment by:

  • Raising an error when dashboard is invalid
  • Deprecating the deploy_dashboard for the create_dashboard as this is more accurate and available after refactoring Lakeview dashboard creation to be part of DashboardMetadata
  • Add publish flag to create_dashboard

Related issues

Below the dashboard created through the deprecated deploy_dashboard:

Screenshot 2024-07-19 at 14 30 25

@JCZuurmond JCZuurmond requested a review from nfx July 19, 2024 12:24
@JCZuurmond JCZuurmond self-assigned this Jul 19, 2024
Copy link

This PR breaks backwards compatibility for databrickslabs/ucx downstream. See build logs for more details.

Running from downstreams #320


def deploy_dashboard(self, dashboard: Dashboard, **kwargs) -> SDKDashboard:
"""Legacy method use :meth:create_dashboard instead."""
warnings.warn("Deprecated method use `create_dashboard` instead.", category=DeprecationWarning)
Copy link
Member Author

Choose a reason for hiding this comment

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

To use the DashboardMetadata.validate on the before dashboard creation, the signature is updated to expect DashboardMetadata instead of Dashboard. For backwards capability, the deploy_dashboard signature is unchanged, but intended to be deprecated. The implementation below creates the DashboardMetadata from the Dashboard through saving the dashboard to a temporary folder.

@nfx: Do you want to add a date to the deprecation warning?

Copy link
Collaborator

Choose a reason for hiding this comment

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

one transition version is fine

Copy link

github-actions bot commented Jul 19, 2024

✅ 35/35 passed, 2 skipped, 8m45s total

Running from acceptance #324


assert ws.lakeview.get(sdk_dashboard.dashboard_id)


def test_dashboards_deploys_dashboard_with_invalid_query(ws, make_dashboard, tmp_path):
Copy link
Member Author

Choose a reason for hiding this comment

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

Removed as we want the dashboard creation with an invalid query to fail

Copy link
Collaborator

@nfx nfx left a comment

Choose a reason for hiding this comment

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

lgtm


def deploy_dashboard(self, dashboard: Dashboard, **kwargs) -> SDKDashboard:
"""Legacy method use :meth:create_dashboard instead."""
warnings.warn("Deprecated method use `create_dashboard` instead.", category=DeprecationWarning)
Copy link
Collaborator

Choose a reason for hiding this comment

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

one transition version is fine

@nfx nfx merged commit 05451a9 into main Jul 22, 2024
8 checks passed
@nfx nfx deleted the fix/dashboard-deployment branch July 22, 2024 12:00
nfx added a commit that referenced this pull request Jul 22, 2024
* Fixed dashboard deployment/creation ([#230](#230)). The recent changes to our open-source library address issues related to dashboard deployment and creation, enhancing their reliability and consistency. The `deploy_dashboard` function has been deprecated in favor of the more accurate `create_dashboard` function, which now includes a `publish` flag. A `validate` method has been added to the `Tile`, `MarkdownTile`, and `QueryTile` classes to raise an error if the dashboard is invalid. The `test_dashboards.py` file has been updated to reflect these changes. These enhancements address issues [#222](#222), [#229](#229), and partially resolve [#220](#220). The commit includes an image of a dashboard created through the deprecated `deploy_dashboard` method. These improvements ensure better dashboard creation, validation, and deployment, while also maintaining backward compatibility through the deprecation of `deploy_dashboard`.
@nfx nfx mentioned this pull request Jul 22, 2024
nfx added a commit that referenced this pull request Jul 22, 2024
* Fixed dashboard deployment/creation
([#230](#230)). The recent
changes to our open-source library address issues related to dashboard
deployment and creation, enhancing their reliability and consistency.
The `deploy_dashboard` function has been deprecated in favor of the more
accurate `create_dashboard` function, which now includes a `publish`
flag. A `validate` method has been added to the `Tile`, `MarkdownTile`,
and `QueryTile` classes to raise an error if the dashboard is invalid.
The `test_dashboards.py` file has been updated to reflect these changes.
These enhancements address issues
[#222](#222),
[#229](#229), and partially
resolve [#220](#220). The
commit includes an image of a dashboard created through the deprecated
`deploy_dashboard` method. These improvements ensure better dashboard
creation, validation, and deployment, while also maintaining backward
compatibility through the deprecation of `deploy_dashboard`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants