diff options
author | Jannis Pohlmann <jannis.pohlmann@codethink.co.uk> | 2012-01-24 14:23:34 +0000 |
---|---|---|
committer | Jannis Pohlmann <jannis.pohlmann@codethink.co.uk> | 2012-01-24 14:40:08 +0000 |
commit | 14e768ce2e5693ebf6418e7a6e94fe4fb9a71844 (patch) | |
tree | 6c629c56aa6e32092a5745bc6de3b50d5c86fbc5 /morphlib/buildcontroller.py | |
parent | 10122174305ac5c6040212a8b526a77ee473577b (diff) | |
download | morph-14e768ce2e5693ebf6418e7a6e94fe4fb9a71844.tar.gz |
Share functionality in BuildWorker, implement SSH, add name/ident concept.
All BuildWorker subclasses are likely to make use of the multiprocessing
library anyway, so most of the functionality can be shared.
All workers now have an ident (e.g. "user@hostname" or "local") which
is used by the BuildController to generate enumerated names for them
(e.g. "user@hostname-1", "user@hostname-2" or "local-1" and "local-2"),
which makes it easier to identify who does what.
The RemoteBuildWorker now runs "ssh HOSTNAME fakeroot morph" for
building stuff remotely.
Diffstat (limited to 'morphlib/buildcontroller.py')
-rw-r--r-- | morphlib/buildcontroller.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/morphlib/buildcontroller.py b/morphlib/buildcontroller.py index ea9719c0..f794928c 100644 --- a/morphlib/buildcontroller.py +++ b/morphlib/buildcontroller.py @@ -43,6 +43,10 @@ class BuildController(object): spaces = ' ' * self.indent self.real_msg('%s%s' % (spaces, text)) + def generate_worker_name(self, ident): + similar_workers = [x for x in self.workers if x.ident == ident] + return '%s-%s' % (ident, len(similar_workers) + 1) + def add_worker(self, worker): self.workers.add(worker) self.mark_idle(worker) |