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

[Feature] Skip calling Read after Create/Update operations for notebooks #4173

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

alexott
Copy link
Contributor

@alexott alexott commented Oct 30, 2024

Changes

It's based on #4190.

It was found that the import API returns object_id as a result of its execution, so we don't really need to call the Read operation that will call get-status to fill all attributes (when we create a notebook using the SOURCE format).

The other formats (DBC and JUPYTER) will still call the Read to fill in the missing parameters, such as language.

It also changed the language to optional,computed so we can safely set the value and don't trigger the diff.

This should help when we import a large number of notebooks, i.e., when applying exported resources.

Tests

  • make test run locally
  • relevant change in docs/ folder
  • covered with integration tests in internal/acceptance
  • relevant acceptance tests are passing
  • using Go SDK

@alexott alexott requested review from a team as code owners October 30, 2024 12:21
@alexott alexott requested review from rauchy and removed request for a team October 30, 2024 12:21
@alexott alexott temporarily deployed to test-trigger-is October 30, 2024 12:21 — with GitHub Actions Inactive
@alexott alexott requested a review from mgyucht October 30, 2024 12:21
workspace/resource_notebook.go Outdated Show resolved Hide resolved
workspace/resource_notebook.go Outdated Show resolved Hide resolved
@alexott alexott changed the title [Fix] Skip calling get-status for notebooks in Read after Create/Update operations [Feature] Allow to skip calling Read after Create/Update operations Oct 30, 2024
@alexott alexott changed the title [Feature] Allow to skip calling Read after Create/Update operations [Feature] WIP: Allow to skip calling Read after Create/Update operations Oct 30, 2024
@alexott alexott force-pushed the notebooks-skip-get-status branch from 7ecd15c to 2ddb757 Compare October 30, 2024 17:46
@alexott alexott temporarily deployed to test-trigger-is October 30, 2024 17:46 — with GitHub Actions Inactive
@alexott alexott changed the title [Feature] WIP: Allow to skip calling Read after Create/Update operations [Feature] WIP: Skip calling Read after Create/Update operations for notebooks Nov 3, 2024
alexott added a commit that referenced this pull request Nov 3, 2024
This PR adds the ability for a resource to specify that it may not need to call `Read`
after `Create` and `Update` operations so we can avoid performing another API call(s). The
resource may implement `CanSkipReadAfterCreateAndUpdate` function that can decide if the
`Read` operation should be skipped.

I decided to move common part from #4173 to make it easier to review
@alexott
Copy link
Contributor Author

alexott commented Nov 3, 2024

@mgyucht I've opened #4190 with changes in common so it will be easier to review. This PR will be used only for notebook changes.

github-merge-queue bot pushed a commit that referenced this pull request Nov 4, 2024
## Changes
<!-- Summary of your changes that are easy to understand -->

This PR adds the ability for a resource to specify that it may not need
to call `Read` after `Create` and `Update` operations so we can avoid
performing another API call(s). The resource may implement
`CanSkipReadAfterCreateAndUpdate` function that can decide if the `Read`
operation should be skipped.

I decided to move common part from #4173 to make it easier to review

## Tests
<!-- 
How is this tested? Please see the checklist below and also describe any
other relevant tests
-->

- [x] `make test` run locally
- [ ] relevant change in `docs/` folder
- [ ] covered with integration tests in `internal/acceptance`
- [x] relevant acceptance tests are passing
- [ ] using Go SDK
It was found that the import API returns `object_id` as a result of its execution, so we
don't really need to call get-status to fill all attributes. This should help when we
import a large number of notebooks, i.e., when applying exported resources.

This also changes `format` and `language` attributes to `optional,computed` to avoid
having issues with defaults, and suppress diff.
@alexott alexott force-pushed the notebooks-skip-get-status branch from 2ddb757 to e80cda6 Compare November 5, 2024 13:49
@alexott alexott temporarily deployed to test-trigger-is November 5, 2024 13:50 — with GitHub Actions Inactive
@alexott alexott temporarily deployed to test-trigger-is November 5, 2024 13:50 — with GitHub Actions Inactive
@alexott alexott changed the title [Feature] WIP: Skip calling Read after Create/Update operations for notebooks [Feature] Skip calling Read after Create/Update operations for notebooks Nov 19, 2024
@alexott alexott requested a review from mgyucht November 26, 2024 10:13
Copy link
Contributor

@rauchy rauchy left a comment

Choose a reason for hiding this comment

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

I think this PR is doing a bit more than what the title suggests, especially now that #4190 lets us skip calling Read, and this PR is using that. I'm missing some specific Notebook context, so it's tough for me to fully judge if the change is correct. My review is mainly focused on the tests and code, and I don't see any issues there. @mgyucht, do you think you should have another look at it as well?

workspace/resource_notebook.go Outdated Show resolved Hide resolved
@alexott alexott temporarily deployed to test-trigger-is December 4, 2024 12:04 — with GitHub Actions Inactive
Copy link

github-actions bot commented Dec 4, 2024

If integration tests don't run automatically, an authorized user can run them manually by following the instructions below:

Trigger:
go/deco-tests-run/terraform

Inputs:

  • PR number: 4173
  • Commit SHA: 7f1b4e77d40d18a8a725d72b891ddfd5403a087d

Checks will be approved automatically on success.

@alexott alexott temporarily deployed to test-trigger-is December 4, 2024 12:04 — with GitHub Actions Inactive
@eng-dev-ecosystem-bot
Copy link
Collaborator

Test Details: go/deco-tests/12159341397

@alexott
Copy link
Contributor Author

alexott commented Dec 4, 2024

@rauchy I've added more context to the PR description

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants