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 to run post processing job for ManagerRefresh (Graph Refresh) #15678

Merged

Conversation

Ladas
Copy link
Contributor

@Ladas Ladas commented Jul 28, 2017

Allow to run post processing job for ManagerRefresh (Graph Refresh).

This post processing can leverage existing data in the
InventoryCollection and especially each collection's created_records,
updated_records and deleted_records, to queue up specific post
processing jobs.

Allow to run post processing job for ManagerRefresh (Graph Refresh).
This post processing can leverage existing data in the
InventoryCollection and especially each collection's created_records,
updated_records and deleted_records, to queue up specific post
processing jobs.
@Ladas
Copy link
Contributor Author

Ladas commented Jul 28, 2017

@miq-bot assign @agrare
@miq-bot add_label enhancement

@miq-bot
Copy link
Member

miq-bot commented Jul 28, 2017

Checked commit Ladas@04f82ac with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0
1 file checked, 3 offenses detected

app/models/ems_refresh/refreshers/ems_refresher_mixin.rb

end
end

def manager_refresh_post_processing(_ems, _target, _inventory_collections)
Copy link
Member

Choose a reason for hiding this comment

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

Can we re-use the existing post_refresh method? If you need the inv collections maybe we could move that into the refresh_targets_for_ems?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

From what I see we can't, the current post refresh is called to late, so at a point where all InventoryCollections are thrown away. And we cannot simply store them, since it goes over many targets, so there is possibility of having more Persiters there

Copy link
Member

Choose a reason for hiding this comment

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

Yeah I was wondering if we could move the existing post_refresh here, but this is per target and that is global so not a great fit.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah, the old refresh is kind of disconnected from the processing, so only thing we can do (and are doing) are timestamp based queries to figure out what have changed

@@ -90,9 +91,20 @@ def refresh_targets_for_ems(ems, targets)

Benchmark.realtime_block(:save_inventory) { save_inventory(ems, target, hashes) }
_log.info "#{log_header} Refreshing target #{target.class} [#{target.name}] id [#{target.id}]...Complete"

if hashes.kind_of?(Array)
Copy link
Member

Choose a reason for hiding this comment

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

I really dislike checking if hashes is an array to imply manager_refresh, we already do that here save_ems_inventory and I don't want to add another.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah, it's a funky condition, but we don't really have better. We could extract that condition somewhere though.

Copy link
Member

@agrare agrare Aug 1, 2017

Choose a reason for hiding this comment

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

Yeah I was wondering if we could move the existing post_refresh here, but this is per target and that is global so not a great fit.
Responded to the wrong comment

Copy link
Member

Choose a reason for hiding this comment

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

I think we should at least be sending a ManagerRefresh::Inventory::Persister instead of an Array here so it is more obvious what case we are dealing with, but that can be a follow-up refactoring PR lets just not lose track of it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

right, but the problem is that we throw away the Persister too now. All we send is a list of ICs. Might be good to refactor it all to pass Persister though.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah I was thinking if instead of sending the inventory collections here we could just send the persister but I'll need to play around with it a bit

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, that would make sense

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.

I think its to the point where we need to refactor this method, this will be the third if manager_refresh then do something completely different case

I'm good with this for now but we need to re-visit how we handle this

@agrare agrare merged commit 7d10409 into ManageIQ:master Aug 1, 2017
@agrare agrare added this to the Sprint 66 Ending Aug 7, 2017 milestone Aug 1, 2017
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.

4 participants