summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/cooker.py
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2022-12-20 14:17:49 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-12-31 17:05:17 +0000
commitcb8efd4d20d7643632b04ce8350c1b58aed49122 (patch)
tree6b8bbc5edf3e53fcb148b12a60861d7237356d9d /bitbake/lib/bb/cooker.py
parent2c5bc0379675c11a84056b2ac5ccaad766c3e766 (diff)
downloadpoky-cb8efd4d20d7643632b04ce8350c1b58aed49122.tar.gz
bitbake: event: Add enable/disable heartbeat code
Currently heartbeat events are always generated by the server whilst it is active. Change this so they only appear when builds are running, which is when most code would expect to be executed. This removes a number of races around changes in the datastore which can happen outside of builds. (Bitbake rev: 8c36c90afc392980d999a981a924dc7d22e2766e) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/cooker.py')
-rw-r--r--bitbake/lib/bb/cooker.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py
index 4e49b0e90b..c712744382 100644
--- a/bitbake/lib/bb/cooker.py
+++ b/bitbake/lib/bb/cooker.py
@@ -1467,6 +1467,7 @@ class BBCooker:
1467 buildname = self.databuilder.mcdata[mc].getVar("BUILDNAME") 1467 buildname = self.databuilder.mcdata[mc].getVar("BUILDNAME")
1468 if fireevents: 1468 if fireevents:
1469 bb.event.fire(bb.event.BuildStarted(buildname, [item]), self.databuilder.mcdata[mc]) 1469 bb.event.fire(bb.event.BuildStarted(buildname, [item]), self.databuilder.mcdata[mc])
1470 bb.event.enable_heartbeat()
1470 1471
1471 # Execute the runqueue 1472 # Execute the runqueue
1472 runlist = [[mc, item, task, fn]] 1473 runlist = [[mc, item, task, fn]]
@@ -1500,6 +1501,7 @@ class BBCooker:
1500 if not retval: 1501 if not retval:
1501 if fireevents: 1502 if fireevents:
1502 bb.event.fire(bb.event.BuildCompleted(len(rq.rqdata.runtaskentries), buildname, item, failures, interrupted), self.databuilder.mcdata[mc]) 1503 bb.event.fire(bb.event.BuildCompleted(len(rq.rqdata.runtaskentries), buildname, item, failures, interrupted), self.databuilder.mcdata[mc])
1504 bb.event.disable_heartbeat()
1503 self.command.finishAsyncCommand(msg) 1505 self.command.finishAsyncCommand(msg)
1504 # We trashed self.recipecaches above 1506 # We trashed self.recipecaches above
1505 self.parsecache_valid = False 1507 self.parsecache_valid = False
@@ -1545,6 +1547,7 @@ class BBCooker:
1545 for mc in self.multiconfigs: 1547 for mc in self.multiconfigs:
1546 bb.event.fire(bb.event.BuildCompleted(len(rq.rqdata.runtaskentries), buildname, targets, failures, interrupted), self.databuilder.mcdata[mc]) 1548 bb.event.fire(bb.event.BuildCompleted(len(rq.rqdata.runtaskentries), buildname, targets, failures, interrupted), self.databuilder.mcdata[mc])
1547 finally: 1549 finally:
1550 bb.event.disable_heartbeat()
1548 self.command.finishAsyncCommand(msg) 1551 self.command.finishAsyncCommand(msg)
1549 return False 1552 return False
1550 if retval is True: 1553 if retval is True:
@@ -1578,6 +1581,7 @@ class BBCooker:
1578 1581
1579 for mc in self.multiconfigs: 1582 for mc in self.multiconfigs:
1580 bb.event.fire(bb.event.BuildStarted(buildname, ntargets), self.databuilder.mcdata[mc]) 1583 bb.event.fire(bb.event.BuildStarted(buildname, ntargets), self.databuilder.mcdata[mc])
1584 bb.event.enable_heartbeat()
1581 1585
1582 rq = bb.runqueue.RunQueue(self, self.data, self.recipecaches, taskdata, runlist) 1586 rq = bb.runqueue.RunQueue(self, self.data, self.recipecaches, taskdata, runlist)
1583 if 'universe' in targets: 1587 if 'universe' in targets: