Skip to content

Commit

Permalink
Merge branch 'master' into sleep
Browse files Browse the repository at this point in the history
  • Loading branch information
tardyp committed Feb 2, 2022
2 parents 3fb53f9 + aae8fc9 commit 4e0f8ad
Show file tree
Hide file tree
Showing 273 changed files with 3,916 additions and 2,571 deletions.
2 changes: 2 additions & 0 deletions common/code_spelling_ignore_words.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1430,13 +1430,15 @@ tac
taichino
tarball
targetname
taskkill
tbl
tcp
tcpdump
teardown
teardownbasedir
tempfile
terminateprocess
testbuildstepmixin
testcase
testcases
testchanges
Expand Down
23 changes: 13 additions & 10 deletions master/buildbot/changes/gerritchangesource.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,12 +327,14 @@ def __init__(self, change_source):
@defer.inlineCallbacks
def outLineReceived(self, line):
if self.change_source.debug:
log.msg(b"gerrit: " + line)
log.msg("{} stdout: {}".format(self.change_source.name,
line.decode('utf-8', errors='replace')))
yield self.change_source.lineReceived(line)

def errLineReceived(self, line):
if self.change_source.debug:
log.msg(b"gerrit stderr: " + line)
log.msg("{} stderr: {}".format(self.change_source.name,
line.decode('utf-8', errors='replace')))

def processEnded(self, status):
super().processEnded(status)
Expand All @@ -350,9 +352,9 @@ def streamProcessStopped(self):
self.STREAM_GOOD_CONNECTION_TIME:
# bad startup; start the stream process again after a timeout,
# and then increase the timeout
log.msg(
"'gerrit stream-events' failed; restarting after %ds"
% round(self.streamProcessTimeout))
log.msg(("{}: stream-events failed; restarting after {}s"
).format(self.name, round(self.streamProcessTimeout)))

self.master.reactor.callLater(
self.streamProcessTimeout, self.startStreamProcess)
self.streamProcessTimeout *= self.STREAM_BACKOFF_EXPONENT
Expand All @@ -364,7 +366,7 @@ def streamProcessStopped(self):

# make sure we log the reconnection, so that it might be detected
# and network connectivity fixed
log.msg("gerrit stream-events lost connection. Reconnecting...")
log.msg("{}: stream-events lost connection. Reconnecting...".format(self.name))
self.startStreamProcess()
self.streamProcessTimeout = self.STREAM_BACKOFF_MIN

Expand All @@ -388,7 +390,7 @@ def _buildGerritCommand(self, *gerrit_args):

def startStreamProcess(self):
if self.debug:
log.msg("starting 'gerrit stream-events'")
log.msg("{}: starting 'gerrit stream-events'".format(self.name))

cmd = self._buildGerritCommand("stream-events")
self.lastStreamProcessStart = util.now()
Expand All @@ -400,8 +402,8 @@ def getFiles(self, change, patchset):
"--files", "--patch-sets")

if self.debug:
log.msg("querying gerrit for changed files in change {}/{}: {}".format(change, patchset,
cmd))
log.msg("{}: querying for changed files in change {}/{}: {}".format(self.name, change,
patchset, cmd))

rc, out = yield runprocess.run_process(self.master.reactor, cmd, env=None,
collect_stderr=False)
Expand Down Expand Up @@ -491,7 +493,8 @@ def poll(self):
last_event_formatted = last_event.strftime("%Y-%m-%d %H:%M:%S")

if self.debug:
log.msg("Polling gerrit: {}".format(last_event_formatted).encode("utf-8"))
log.msg("{}: Polling gerrit: {}".format(self.name,
last_event_formatted).encode("utf-8"))

res = yield self._http.get("/plugins/events-log/events/",
params=dict(t1=last_event_formatted))
Expand Down
4 changes: 2 additions & 2 deletions master/buildbot/master.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
from twisted.python import log

import buildbot
import buildbot.pbmanager
from buildbot import config
from buildbot import monkeypatches
from buildbot.buildbot_net_usage_data import sendBuildbotNetUsageData
Expand All @@ -49,6 +48,7 @@
from buildbot.util.eventual import eventually
from buildbot.wamp import connector as wampconnector
from buildbot.worker import manager as workermanager
from buildbot.worker.protocols.manager.pb import PBManager
from buildbot.www import service as wwwservice


Expand Down Expand Up @@ -141,7 +141,7 @@ def create_child_services(self):
self.caches = cache.CacheManager()
yield self.caches.setServiceParent(self)

self.pbmanager = buildbot.pbmanager.PBManager()
self.pbmanager = PBManager()
yield self.pbmanager.setServiceParent(self)

self.workers = workermanager.WorkerManager(self)
Expand Down
202 changes: 0 additions & 202 deletions master/buildbot/pbmanager.py

This file was deleted.

20 changes: 16 additions & 4 deletions master/buildbot/process/buildstep.py
Original file line number Diff line number Diff line change
Expand Up @@ -613,10 +613,25 @@ def isNewStyle(self):
warn_deprecated('3.0.0', 'BuildStep.isNewStyle() always returns True')
return True

@defer.inlineCallbacks
def _maybe_interrupt_cmd(self, reason):
if not self.cmd:
return

try:
yield self.cmd.interrupt(reason)
except Exception as e:
log.err(e, 'while cancelling command')

@defer.inlineCallbacks
def interrupt(self, reason):
if self.stopped:
# If we are in the process of interruption and connection is lost then we must tell
# the command not to wait for the interruption to complete.
if isinstance(reason, Failure) and reason.check(error.ConnectionLost):
yield self._maybe_interrupt_cmd(reason)
return

self.stopped = True
if self._acquiringLocks:
for (lock, access, d) in self._acquiringLocks:
Expand All @@ -629,10 +644,7 @@ def interrupt(self, reason):
else:
yield self.addCompleteLog('cancelled', str(reason))

if self.cmd:
d = self.cmd.interrupt(reason)
d.addErrback(log.err, 'while cancelling command')
yield d
yield self._maybe_interrupt_cmd(reason)

def releaseLocks(self):
log.msg("releaseLocks({}): {}".format(self, self.locks))
Expand Down

0 comments on commit 4e0f8ad

Please sign in to comment.