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

[WIP] Add support for federated webUI #1414

Closed
wants to merge 21 commits into from

Conversation

foursixnine
Copy link
Member

@foursixnine foursixnine commented Aug 4, 2017

So, after some digging I've got to a point where I can say that the federation could work.

The approach is simple, have a separate script/app that will check a master webUI for jobs available under a certain worker class, if there are, create the respective jobs on the slave webUI and monitor them.

For this mode, we require an explicit setting that will allow openQA to know what jobs must run on a separate instance. This allows to use WORKER_CLASS=:my_location:our_worker_class

To improve and isolate the federation support, a new dedicated api route is needed, given the latest changes to the API and grab job, thus I added /federation, for now this is just mimicking the behavior of job#list

Add proxy_job_monitor as a stub to spawn a new ioloop timer that will monitor the state of a job, but I'm not 100% sure that this could be efficient, but another idea is to simply have a timer every N seconds and query all jobs's status that have PROXIED=1 in their job settings on the slaveUI

Status PROXIED has also been added, so these jobs can be tagged properly on the masterUI

@foursixnine foursixnine changed the title Improvements on the slave job handling Add new API route for federation Minor changes in job monitoring Add proxied to list of filters Properly update job on MasterWebUI Properly add support for setup state Add support for Proxied status Add max_redirects to OpenQA::Client Add proxied status Use Mojo::IOLoop for monitoring Use OpenQA::Client Add worker_bridge script Add CLUSTER setting for job filtering Add support for colons on worker class Add WORKER_CLASS to job_list filter [WIP] Add support for federated webUI Aug 4, 2017
This allows to be able to use the json api to get not only
a job information but also the details if there are any

Add tests to get test results from the job json api
In order to allow better filtering and proper grouping of jobs when
they belong to an instance in another location, so that bridged
worker can query all the jobs available to be "proxied", without
extra need for more worker settings and redefinition of worker
classes. This allows to use :my_location:our_worker_class
For the federated mode, we require an explicit setting
that will allow openQA to know what jobs must run on
a separate instance.
Trigger the monitoring of the master WebUI and slave WebUI, and
use events to handle new data.

Initially being set up as stubs but the bridge should be able to find
new items on the WebUI that are scheduled for it, and transfer
them to the newer slave, after changing the job settings.
Add proxy_job_monitor as a stub to spawn a new ioloop timer
that will monitor the state of a job.

Improve logging
To improve and isolate the federation support, a new dedicated api
route is needed, given the latest changes to the api and grab job.

For now, this is just mimicking the behaviour of job#list
@codecov
Copy link

codecov bot commented Aug 9, 2017

Codecov Report

Merging #1414 into master will decrease coverage by 18.47%.
The diff coverage is 47.36%.

Impacted file tree graph

@@             Coverage Diff             @@
##           master    #1414       +/-   ##
===========================================
- Coverage   87.22%   68.75%   -18.48%     
===========================================
  Files         105       95       -10     
  Lines        7874     7396      -478     
===========================================
- Hits         6868     5085     -1783     
- Misses       1006     2311     +1305
Impacted Files Coverage Δ
lib/OpenQA/WebAPI/Controller/API/V1/Job.pm 53.18% <ø> (-26.13%) ⬇️
lib/OpenQA/Schema/ResultSet/Jobs.pm 72.36% <100%> (-24.66%) ⬇️
lib/OpenQA/WebAPI.pm 89.93% <100%> (-1.93%) ⬇️
lib/OpenQA/Client.pm 81.39% <100%> (-18.61%) ⬇️
lib/OpenQA/Schema/ResultSet/JobSettings.pm 14.28% <14.28%> (-59.05%) ⬇️
lib/OpenQA/Schema/Result/Jobs.pm 65.52% <55.55%> (-25.39%) ⬇️
lib/db_profiler.pm 12% <0%> (-88%) ⬇️
lib/OpenQA/Scheduler/Locks.pm 7.46% <0%> (-85.08%) ⬇️
lib/OpenQA/Scheduler/FakeApp.pm 17.39% <0%> (-78.27%) ⬇️
lib/OpenQA/Schema/Result/Assets.pm 9.63% <0%> (-74.1%) ⬇️
... and 49 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3763450...aba358f. Read the comment docs.


#We have only one job
$t->get_ok('/api/v1/jobs/' . $get->tx->res->json->{jobs}[0]{id})->status_is(200);
$t->json_is(
Copy link
Member Author

Choose a reason for hiding this comment

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

This particular test is failing for now

for my $key (qw(ISO HDD_1)) {
# Check if the settings are between the arguments passed via query url
# they come in lowercase, so mace sure $key is lc'ed
for my $key (qw(ISO HDD_1 WORKER_CLASS PROXIED)) {
Copy link
Member Author

Choose a reason for hiding this comment

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

currently I'd like to think that one could filter by every job setting... and this list could be dynamically generated by searching for unique job settings.

@foursixnine
Copy link
Member Author

I just noticed I had comments that never made it to public :P

@Martchus
Copy link
Contributor

Is there a related progress issue? I'm just wondering what the motivation behind this feature is.

@AdamWill
Copy link
Contributor

@Martchus
Copy link
Contributor

@AdamWill Thanks

@Martchus
Copy link
Contributor

I'm closing this for now due to inactivity.

@Martchus Martchus closed this Nov 28, 2018
@foursixnine foursixnine deleted the worker_bridge branch December 1, 2018 18:45
@foursixnine foursixnine restored the worker_bridge branch December 1, 2018 18:45
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.

None yet

3 participants