1
0
mirror of https://git.yoctoproject.org/poky synced 2026-05-31 00:39:46 +00:00

bitbake-dev: Include the worker's PID in events

When the runqueue forks off we save the pid inside the event module for that
thread. When we next fire an event then that PID gets included in the events.
This commit is contained in:
Rob Bradford
2008-10-21 15:33:38 +01:00
parent e1155bcd79
commit f51afdc7b6
2 changed files with 15 additions and 2 deletions
+5
View File
@@ -25,12 +25,17 @@ BitBake build tools.
import os, re import os, re
import bb.utils import bb.utils
# This is the pid for which we should generate the event. This is set when
# the runqueue forks off.
worker_pid = 0
class Event: class Event:
"""Base class for events""" """Base class for events"""
type = "Event" type = "Event"
def __init__(self, d): def __init__(self, d):
self._data = d self._data = d
self.pid = worker_pid
def getData(self): def getData(self):
return self._data return self._data
+10 -2
View File
@@ -971,8 +971,6 @@ class RunQueue:
self.stats.taskSkipped() self.stats.taskSkipped()
continue continue
bb.event.fire(runQueueTaskStarted(task, self.stats, self, self.cfgData))
bb.msg.note(1, bb.msg.domain.RunQueue, "Running task %d of %d (ID: %s, %s)" % (self.stats.completed + self.stats.active + 1, self.stats.total, task, self.get_user_idstring(task)))
sys.stdout.flush() sys.stdout.flush()
sys.stderr.flush() sys.stderr.flush()
try: try:
@@ -980,6 +978,16 @@ class RunQueue:
except OSError, e: except OSError, e:
bb.msg.fatal(bb.msg.domain.RunQueue, "fork failed: %d (%s)" % (e.errno, e.strerror)) bb.msg.fatal(bb.msg.domain.RunQueue, "fork failed: %d (%s)" % (e.errno, e.strerror))
if pid == 0: if pid == 0:
# Save out the PID so that the event can include it the
# events
bb.event.worker_pid = os.getpid()
bb.event.fire(runQueueTaskStarted(task, self.stats, self, self.cfgData))
bb.msg.note(1, bb.msg.domain.RunQueue,
"Running task %d of %d (ID: %s, %s)" % (self.stats.completed + self.stats.active + 1,
self.stats.total,
task,
self.get_user_idstring(task)))
self.state = runQueueChildProcess self.state = runQueueChildProcess
# Make the child the process group leader # Make the child the process group leader
os.setpgid(0, 0) os.setpgid(0, 0)