df32d4cf58
This removes the RPC call (Gearman) in zuul-web to look up the live log streaming address from the build objects in the scheduler and instead uses the build requests stored in ZooKeeper. As the address lookup is implemented as a shared library function which is used by zuul-web and the fingergw, the fingergw is also switched from RPC to ZooKeeper. The implementation itself was moved from zuul.rpclistener to zuul.lib.streamer_utils. To make the lookup via ZooKeeper work, the executor now stores its worker information (hostname, log_port) on the build request when it locks the request. Additionally, the rpc client was removed from the fingergw as it's not needed anymore. Instead the fingergw has now access to the component registry and the executor api in ZooKeeper as both are needed to look up the streaming address. To not create unnecessary watches for build requests in each fingergw and zuul-web component, the executor api (resp. the job_request_queue base class) now provides a "use_cache" flag. The cache is enabled by default, but if the flag is set to False, no watches will be created. Overall this should reduce the load on the scheduler as it doesn't need to handle the related RPC calls anymore. Change-Id: I359b70f2d5700b0435544db3ce81d64cb8b73464
28 lines
978 B
Python
28 lines
978 B
Python
# Copyright 2021 BMW Group
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
# not use this file except in compliance with the License. You may obtain
|
|
# a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
# License for the specific language governing permissions and limitations
|
|
# under the License.
|
|
|
|
import logging
|
|
|
|
from zuul.model import MergeRequest
|
|
from zuul.zk.job_request_queue import JobRequestQueue
|
|
|
|
|
|
class MergerApi(JobRequestQueue):
|
|
log = logging.getLogger("zuul.MergerApi")
|
|
request_class = MergeRequest
|
|
|
|
def __init__(self, client, use_cache=True, merge_request_callback=None):
|
|
root = '/zuul/merger'
|
|
super().__init__(client, root, use_cache, merge_request_callback)
|