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 proper targeted refresh #272

Merged
merged 3 commits into from
Aug 14, 2018

Conversation

Ladas
Copy link
Contributor

@Ladas Ladas commented Aug 11, 2018

Depends on:

Allow proper targeted refresh. For passing specs, we must define the correct targeted_arel queries.

Ladas added 2 commits August 11, 2018 20:57
Add correct targeted queries for the complex ICs
We can use targeted => true and targeted specs are still passing
@Ladas
Copy link
Contributor Author

Ladas commented Aug 11, 2018

@agrare @gtanzillo and we need to build proper targeted_arel queries. Although I think those can be also auto-generated later.

So with this, the targeted persistor should be working (the specs probably do not have 100% coverage, so as we do streaming refresh, we'll be adding more specs)

)

targeted_arel = lambda do |inventory_collection|
# TODO(lsmola): if we use :association ^ instead of :arel, this can be autogenerated
p_collection = inventory_collection.parent_inventory_collections.first
Copy link
Contributor

Choose a reason for hiding this comment

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

is this distinct from parent_collection defined above?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

should be the same, but it's safer to load it from the inventory_collection context

p_collection = inventory_collection.parent_inventory_collections.first
rel = p_collection.db_collection_for_comparison_for(p_collection.targeted_scope.primary_references)

query = Tagging.where(
Copy link
Contributor

Choose a reason for hiding this comment

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

the query = part here does nothing, you just need return value from the lambda, right?

end

def shared_options
Copy link
Contributor

Choose a reason for hiding this comment

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

why is this deleted?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it's defined in the base persister

Remove unused assignment
@miq-bot
Copy link
Member

miq-bot commented Aug 14, 2018

Checked commits Ladas/manageiq-providers-kubernetes@b6a7c7c~...995524e with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0
2 files checked, 0 offenses detected
Everything looks fine. 🏆

Copy link
Contributor

@cben cben left a comment

Choose a reason for hiding this comment

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

I'm not following the details of what p_collection.db_collection_for_comparison_for(p_collection.targeted_scope.primary_references) would resolve to exactly, but looks plausible :-)

Why is it that the parametric add_foos() functions are exactly the places that needed a targetted_arel?

There is some duplication between the regular queries and their targeted counterparts but it's not easy to DRY, would just obfuscate the code.

@Ladas
Copy link
Contributor Author

Ladas commented Aug 14, 2018

@cben the targeted_arel is needed because we are not able to build it automatically. Instead of DRYing it, we can rather rewrite the :arel attributes to relations on ems. Then the targeted_arel should be able to generate itself. :-)

Copy link
Contributor

@cben cben left a comment

Choose a reason for hiding this comment

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

LGTM.

@cben cben merged commit 815c2fa into ManageIQ:master Aug 14, 2018
@cben
Copy link
Contributor

cben commented Aug 14, 2018

@JPrause the Milestone github offers me here is Sprint 92 ending yesterday — should I use that one? Is it normal that 93 doesn't exist yet?

@cben
Copy link
Contributor

cben commented Aug 14, 2018

@agrare @gtanzillo I merged assuming you already reviewed this and I'm the one this is blocked on, but seems not (or you didn't say anything)?
I think it's worth a 2nd review.

Copy link
Member

@agrare agrare left a comment

Choose a reason for hiding this comment

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

LGTM

@JPrause
Copy link
Member

JPrause commented Aug 14, 2018

@cben yes, please use 92. The milestones are closed Tuesday mornings. If 92 gets closed before you can assign, you can use 93.

@JPrause
Copy link
Member

JPrause commented Aug 14, 2018

@cben I should have said,...every two weeks on the Tuesday morning before sprint review.

@cben cben added this to the Sprint 92 Ending Aug 13, 2018 milestone Aug 14, 2018
@djberg96 djberg96 mentioned this pull request Apr 28, 2020
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants