-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Send also workflows as part of unified jobs and send all changes to jobs #6176
Send also workflows as part of unified jobs and send all changes to jobs #6176
Conversation
Build succeeded.
|
2346c1f
to
4fcd2c5
Compare
Build succeeded.
|
748f6cd
to
4a5e596
Compare
Build succeeded.
|
We may want to hold off on this until @AlanCoding's change here lands: #5726 |
awx/main/analytics/collectors.py
Outdated
JOIN main_organization ON main_organization.id = main_project.organization_id | ||
WHERE main_unifiedjob.created > {} | ||
LEFT JOIN main_project ON main_project.unifiedjobtemplate_ptr_id = main_job.project_id | ||
LEFT JOIN main_organization ON main_organization.id = main_project.organization_id |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This join is going to change after @AlanCoding's PR merges.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cool, I am fine fixing this another way. Just keep in mind this was basically filtering out everything except jobs. But we want other stuff like workflowapproval
, worflowjob
, projectupdate
etc. , so we'll need the left join, since not everything has org associated
Also @AlanCoding is your PR going to be backported? We need this backported to all versions sending data to analytics, so we get the workflow and other data.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, we do not plan on backporting. that would be very complicated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, ok, so can we merge this first? Or it doesn't matter for easier backport?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should wait for @AlanCoding's organization schema to land in devel
before changing this in devel
.
If you want to open a PR like this in a backport branch, we'll have to carry a different implementation for that database schema anyways.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sounds good, I'll backport and wait for @AlanCoding here
I don't follow that URL. If you were searching from |
@AlanCoding the tower url was just supposed to show that on the organization page, we don't show any links to workflows. And as I was scanning the db, we only store organization relation in workflow template, not workflow_job. |
@Ladas we've merged @AlanCoding's work - this is probably ready for a rebase and another look now. |
why was the created filter changed to |
@AlanCoding the use of modified is described in the issue (I suppose finished can be used also). If we use created, then finished/modified can be hours later and if we'd already sent the payload, we wouldn't send the job again. We need to send the job again if it's finished (or change occurred) so the analytics contains the terminal state. |
I may not have access to the issue. But awx/awx/main/models/unified_jobs.py Lines 631 to 637 in 4a5e596
can't say the same for modified. So it seems like that'll work as a drop-in replacement here. And the organization field should be on the unified jobs table now, but I think there are more problems you're trying to solve here which I'm not fully aware of. |
@AlanCoding I see. Although finished doesn't have So it looks like we have 2 paths:
GOOD: we'll catch all changes
GOOD: we'll use indexes Looks like 2) is good enough, we just need take in account that when For the orgs, in analytics I expect them to be there for |
7223908
to
274fead
Compare
Build succeeded.
|
@AlanCoding ok I changed the condition to Can you review also the backports please? https://github.com/ansible/tower/pull/4180 and https://github.com/ansible/tower/pull/4179 Btw. we should probably add index to modified column, so we can get the 100% correct data to analytics. (even if that can't be backported) |
What still needs done here? Just a review? |
@wenottingham likely that and verification from somebody. |
@Ladas I submitted a PR against your PR. https://github.com/Ladas/awx/pull/1/files incorporate that test and I'm good with merging this PR 👍 |
@chrismeyersfsu thank you btw. this PR's condition works for backports nicely. But as extension for the next major AWX release, the best would be if we could add index on |
Build failed.
|
@Ladas the CI failures here suggest to me that this branch needs to be rebased against |
It can take several hours for a job to go from pending to successful/failed state and we need to also send the job with a changed state, otherwise the analytics will be incorrect.
Workflows do not have a record in main_job, therefore the JOIN was ignoring those. We need to do LEFT JOIN to include also workflows. It also seems like we are not able to get a link to organizations from workflows? When looking at: <tower_url>#/organizations?organization_search=page_size:20;order_by:name We don't seem to list a relation to workflows. Is it possible to get it from somewhere?
Use created and finished, which are indexed, to try to fetch all states of jobs. If job is not finished, we might not get the right terminal status, but that should be ok for now.
* unified_jobs output should include derived jobs i.e. project update, inventory update, job * This PR adds a test to ensure that.
405ecd3
to
1f9f869
Compare
@ryanpetrello thanks for the hint, rebased |
Build succeeded.
|
@ryanpetrello ok for mergeit with @chrismeyersfsu's approval? |
Build succeeded (gate pipeline).
|
[backport 4.2] removed hostname check when editing hostname on existing host (ansible#13057)
SUMMARY
Workflows do not have a record in main_job, therefore the JOIN
was ignoring those. We need to do LEFT JOIN to include also
workflows.
It can take several hours for a job to go from pending to successful/failed state and we need to also send the job with a changed state, otherwise the analytics will be incorrect.
ISSUE TYPE
COMPONENT NAME
FIXES
#6200
Partially fixing: #6201 (sending workflows as part of unified jobs)
Works with current analytics processor?
Currently the processor will break, since it requires Org name and ID as NOT NULL. I will limit this constraints for only template jobs. (will insert PR here)
TODO