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

Fixing groups in config file not considered for group migration job #943

Merged
merged 6 commits into from
Feb 15, 2024

Conversation

william-conti
Copy link
Contributor

Changes

If the customer runs the assessment, then changes the configuration file to add a new group, UCX won't be able to reflect the changes.
This change fixes the above scenario and aims towards an incremental group migration.

Linked issues

Closes #941

Tests

  • manually tested
  • added unit tests

Copy link

codecov bot commented Feb 13, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (f951aac) 87.76% compared to head (1612907) 87.78%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #943      +/-   ##
==========================================
+ Coverage   87.76%   87.78%   +0.02%     
==========================================
  Files          43       43              
  Lines        5213     5223      +10     
  Branches      939      943       +4     
==========================================
+ Hits         4575     4585      +10     
  Misses        434      434              
  Partials      204      204              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@mwojtyczka mwojtyczka left a comment

Choose a reason for hiding this comment

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

I am not sure this is the best way to solve the issue. It would be better to filter the groups when we fetch them (in _fetcher method). We are already filtering the groups when we crawl. We just need to add simple filter when we fetch as well. This would be one-liner fix.

@william-conti
Copy link
Contributor Author

@mwojtyczka I would like to identify groups specified in the conf that aren't in the groups table. Today if you specify random groups in the conf it is completely silented.

@mwojtyczka
Copy link
Contributor

mwojtyczka commented Feb 14, 2024

@mwojtyczka I would like to identify groups specified in the conf that aren't in the groups table. Today if you specify random groups in the conf it is completely silented.

Got it. It's another use case then. There is another issue with the fetcher that is not filtering the groups from the config.

@william-conti
Copy link
Contributor Author

@mwojtyczka After discussion with Jince, it's better to move the logic to the fetcher() because of what you mention and also for keeping the consistency of the logic. Let's keep things as clean as possible

if not self._include_group_names:
return state

new_state = []
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need this detailed log? If you look at get_filtered_groups method that we use for crawler, we just filter out the groups based on _include_group_names. If you report issues with _include_group_names here then we should also do it in get_filtered_groups method to make it consistent.

Can we eliminate all the additional loops?

shouldn't something like below be enough?

for row in self._backend.fetch(f"SELECT * FROM {self._full_name}"):
  g = MigratedGroup(*row)
  if not self._include_group_names or g.name_in_workspace in self._include_group_names:
      yield g

@william-conti william-conti added this pull request to the merge queue Feb 15, 2024
github-merge-queue bot pushed a commit that referenced this pull request Feb 15, 2024
…943)

## Changes
If the customer runs the assessment, then changes the configuration file
to add a new group, UCX won't be able to reflect the changes.
This change fixes the above scenario and aims towards an incremental
group migration.

### Linked issues
Closes #941

### Tests

- [X] manually tested
- [X] added unit tests
@nfx nfx removed this pull request from the merge queue due to a manual request Feb 15, 2024
@nfx nfx merged commit 784ba01 into main Feb 15, 2024
7 checks passed
@nfx nfx deleted the fix/migation_state branch February 15, 2024 14:05
nfx added a commit that referenced this pull request Feb 16, 2024
* Added CLI Command `databricks labs ucx principal-prefix-access` ([#949](#949)).
* Added a widget with all jobs to track migration progress ([#940](#940)).
* Added legacy cluster types to the assessment result ([#932](#932)).
* Cleanup of install documentation ([#951](#951), [#947](#947)).
* Fixed `WorkspaceConfig` initialization for `DEBUG` notebook ([#934](#934)).
* Fixed installer not opening config file during the installation ([#945](#945)).
* Fixed groups in config file not considered for group migration job ([#943](#943)).
* Fixed bug where `tenant_id` inside secret scope is not detected ([#942](#942)).
@nfx nfx mentioned this pull request Feb 16, 2024
nfx added a commit that referenced this pull request Feb 16, 2024
* Added CLI Command `databricks labs ucx principal-prefix-access`
([#949](#949)).
* Added a widget with all jobs to track migration progress
([#940](#940)).
* Added legacy cluster types to the assessment result
([#932](#932)).
* Cleanup of install documentation
([#951](#951),
[#947](#947)).
* Fixed `WorkspaceConfig` initialization for `DEBUG` notebook
([#934](#934)).
* Fixed installer not opening config file during the installation
([#945](#945)).
* Fixed groups in config file not considered for group migration job
([#943](#943)).
* Fixed bug where `tenant_id` inside secret scope is not detected
([#942](#942)).
dmoore247 pushed a commit that referenced this pull request Mar 23, 2024
* Added CLI Command `databricks labs ucx principal-prefix-access`
([#949](#949)).
* Added a widget with all jobs to track migration progress
([#940](#940)).
* Added legacy cluster types to the assessment result
([#932](#932)).
* Cleanup of install documentation
([#951](#951),
[#947](#947)).
* Fixed `WorkspaceConfig` initialization for `DEBUG` notebook
([#934](#934)).
* Fixed installer not opening config file during the installation
([#945](#945)).
* Fixed groups in config file not considered for group migration job
([#943](#943)).
* Fixed bug where `tenant_id` inside secret scope is not detected
([#942](#942)).
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.

[BUG]: Groups in config file not considered for group migration job
3 participants