aboutsummaryrefslogtreecommitdiff
path: root/slave
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek.chauhan@gmail.com>2008-08-16 18:30:33 +0530
committerNirbheek Chauhan <nirbheek.chauhan@gmail.com>2008-08-16 18:30:33 +0530
commitc2d11859491622380703ea21954f07fb484e04ba (patch)
tree8232b2b3f76dd884711407ae2f8ec95199ecc3e7 /slave
parent- Add ~username/jobs/ page (diff)
downloadautotua-c2d11859491622380703ea21954f07fb484e04ba.tar.gz
autotua-c2d11859491622380703ea21954f07fb484e04ba.tar.bz2
autotua-c2d11859491622380703ea21954f07fb484e04ba.zip
Link the master and the slave in a simplistic (for now) way:
* stage url processing is shifted to the master now * Communication is via protocol 2 (binary) pickles * slave API can be accessed via /slave_api/jobs /slave_api/jobs/<username> /slave_api/jobs/<username>/<job_name>
Diffstat (limited to 'slave')
-rw-r--r--slave/autotua/__init__.py50
-rw-r--r--slave/autotua/const.py26
2 files changed, 9 insertions, 67 deletions
diff --git a/slave/autotua/__init__.py b/slave/autotua/__init__.py
index bdcd56b..f390c7a 100644
--- a/slave/autotua/__init__.py
+++ b/slave/autotua/__init__.py
@@ -6,8 +6,9 @@
# Immortal lh!
#
-import os, sys, shutil
+import os, shutil, urllib2
import os.path as osp
+import cPickle as pickle
from autotua import fetch, const, sync, chroot, jobuild
class Jobs:
@@ -22,7 +23,8 @@ class Jobs:
(skeleton code atm)
"""
jobs = []
- for job_data in const.job_list:
+ job_list = pickle.load(urllib2.urlopen(const.AUTOTUA_MASTER+'/slave_api/jobs'))
+ for job_data in job_list:
jobs.append(Job(job_data))
return jobs
@@ -30,9 +32,10 @@ class Job:
"""A Job."""
def __init__(self, job_data):
- self.maint = job_data['maintainer']
+ self.maint_details = job_data['maintainer']
+ self.maint = job_data['maintainer']['username']
self.name = job_data['name']
- self.stage = self._stage_fetchable(job_data)
+ self.stage = fetch.Fetchable(uri=[job_data['stage']])
self.jobdir = osp.join(const.WORKDIR, self.maint, self.name)
self.jobtagerev = job_data['jobtagerev']
self.atoms = job_data['atoms']
@@ -45,45 +48,6 @@ class Job:
def __str__(self):
return '%s object' % self.name
- def _generic_arch(self, arch):
- """
- Convert specific archs to generic archs
- i686 -> x86
- mips4 -> mips
- """
- if arch in ['alpha', 'amd64', 'ia64', 'x86']:
- return arch
-
- if arch == 'i686':
- return 'x86'
- elif arch == 'sparc64':
- return 'sparc'
- elif arch in ['hppa1.1', 'hppa2.0']:
- return 'hppa'
- elif arch.startswith('mips'):
- return 'mips'
- else:
- sys.exit('Invalid arch: '+arch+'\n')
-
- def _stage_fetchable(self, job_data):
- stage = job_data['stage']
- if stage.startswith('gentoo://'):
- job_data['stage'] = stage[9:]
- mirrors = const.GENTOO_MIRRORS
- else:
- # Assume it's a proper URL
- return fetch.Fetchable(uri=[stage])
-
- job_data['gen_arch'] = self._generic_arch(job_data['arch'])
- filename = const.STAGE_FILENAME % job_data
- uri = []
- for mirror in mirrors:
- mirror += "/" + const.STAGE_MIRROR_PATH % job_data
- mirror += "/" + filename
- uri.append(mirror)
- stage = fetch.Fetchable(uri=uri)
- return stage
-
# Get jobuild SRC_URI -> $tmpdir/jobfiles
# jobfile -(link)-> $chroot_tmpdir/jobfiles
def _setup_jobfiles(self):
diff --git a/slave/autotua/const.py b/slave/autotua/const.py
index db2be3f..8719570 100644
--- a/slave/autotua/const.py
+++ b/slave/autotua/const.py
@@ -25,17 +25,13 @@ JOBFILE_DIR = TARBALL_DIR+'/jobfiles'
CHROOT_DIR = TMPDIR+'/chroots/pristine'
WORKDIR = TMPDIR+'/work'
JOBTAGE_DIR = TMPDIR+'/jobtage'
+
+AUTOTUA_MASTER = 'http://www.autotua.org:8000'
JOBTAGE_URI = 'git://git.overlays.gentoo.org/proj/jobtage.git'
# Autotua variables inside the chroot
CHAUTOTUA_DIR = '/tmp/autotua'
-# Example:
-# http://gentoo.osuosl.org/releases/hppa/2008.0_beta2/stages/stage3-hppa2.0-2008.0_beta2.tar.bz2
-GENTOO_MIRRORS = ['http://gentoo.osuosl.org']
-STAGE_MIRROR_PATH = 'releases/%(gen_arch)s/%(release)s/stages'
-STAGE_FILENAME = '%(stage)s-%(arch)s-%(release)s.tar.bz2'
-
# Bind mounted inside the chroots for use if defined
PORTAGE_DIR = ''
DISTFILES_DIR = ''
@@ -48,21 +44,3 @@ if os.environ.has_key('http_proxy'):
if os.access(path+"/git-proxy-cmd.sh", os.X_OK):
prefix = ''
os.environ['GIT_PROXY_COMMAND'] = prefix+'git-proxy-cmd.sh'
-
-# Let's define a couple of jobs for now.
-# We'll get them from the server later :P
-job_list = [
- {
- # need to quantify the uniqueness of 'name'
- 'maintainer': 'bheekling',
- 'name': 'Test libbeagle',
- 'stage': 'gentoo://stage3',
- 'arch': 'i686',
- 'type': '',
- 'release': '2008.0',
- 'jobtagerev': '',
- #'overlays': ['overlays/bheekling/tag1', 'overlays/bonsaikitten/tag2']
- # These are in order of running
- 'atoms': ['>=bheekling/test-beagle-1.0', '<=bheekling/test-libbeagle-1.0', '=bheekling/build-brasero-1.0'],
- },
-]