diff options
author | Rob Bradford <rob@linux.intel.com> | 2008-10-21 15:33:38 +0100 |
---|---|---|
committer | Rob Bradford <rob@linux.intel.com> | 2008-10-21 15:51:32 +0100 |
commit | f51afdc7b6b9cbdcdc32f5b9ed3f60a16e77b82f (patch) | |
tree | 217e81ea62069d258de885b45a3c140875c39a1e /bitbake-dev/lib/bb | |
parent | e1155bcd797b1fde9f6d1ee3cbdae61a022d8382 (diff) | |
download | openembedded-core-f51afdc7b6b9cbdcdc32f5b9ed3f60a16e77b82f.tar.gz openembedded-core-f51afdc7b6b9cbdcdc32f5b9ed3f60a16e77b82f.tar.bz2 openembedded-core-f51afdc7b6b9cbdcdc32f5b9ed3f60a16e77b82f.zip |
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.
Diffstat (limited to 'bitbake-dev/lib/bb')
-rw-r--r-- | bitbake-dev/lib/bb/event.py | 5 | ||||
-rw-r--r-- | bitbake-dev/lib/bb/runqueue.py | 12 |
2 files changed, 15 insertions, 2 deletions
diff --git a/bitbake-dev/lib/bb/event.py b/bitbake-dev/lib/bb/event.py index e5cae275ac..8f0a1961df 100644 --- a/bitbake-dev/lib/bb/event.py +++ b/bitbake-dev/lib/bb/event.py @@ -25,12 +25,17 @@ BitBake build tools. import os, re 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: """Base class for events""" type = "Event" def __init__(self, d): self._data = d + self.pid = worker_pid def getData(self): return self._data diff --git a/bitbake-dev/lib/bb/runqueue.py b/bitbake-dev/lib/bb/runqueue.py index 26e4c32f88..1667205829 100644 --- a/bitbake-dev/lib/bb/runqueue.py +++ b/bitbake-dev/lib/bb/runqueue.py @@ -971,8 +971,6 @@ class RunQueue: self.stats.taskSkipped() 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.stderr.flush() try: @@ -980,6 +978,16 @@ class RunQueue: except OSError, e: bb.msg.fatal(bb.msg.domain.RunQueue, "fork failed: %d (%s)" % (e.errno, e.strerror)) 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 # Make the child the process group leader os.setpgid(0, 0) |