[llvm-commits] [zorg] r125878 - in /zorg/trunk/llvmlab/llvmlab/ci: ./ __init__.py config.py

Daniel Dunbar daniel at zuster.org
Fri Feb 18 08:41:35 PST 2011


Author: ddunbar
Date: Fri Feb 18 10:41:35 2011
New Revision: 125878

URL: http://llvm.org/viewvc/llvm-project?rev=125878&view=rev
Log:
llvmlab: Start sketching Config object for representing how the lab is currently
configured.

Added:
    zorg/trunk/llvmlab/llvmlab/ci/
    zorg/trunk/llvmlab/llvmlab/ci/__init__.py
    zorg/trunk/llvmlab/llvmlab/ci/config.py

Added: zorg/trunk/llvmlab/llvmlab/ci/__init__.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/llvmlab/llvmlab/ci/__init__.py?rev=125878&view=auto
==============================================================================
--- zorg/trunk/llvmlab/llvmlab/ci/__init__.py (added)
+++ zorg/trunk/llvmlab/llvmlab/ci/__init__.py Fri Feb 18 10:41:35 2011
@@ -0,0 +1 @@
+__all__ = []

Added: zorg/trunk/llvmlab/llvmlab/ci/config.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/llvmlab/llvmlab/ci/config.py?rev=125878&view=auto
==============================================================================
--- zorg/trunk/llvmlab/llvmlab/ci/config.py (added)
+++ zorg/trunk/llvmlab/llvmlab/ci/config.py Fri Feb 18 10:41:35 2011
@@ -0,0 +1,118 @@
+"""
+Configuration information for the CI infrastructure, for use by the dashboard.
+"""
+
+from llvmlab import util
+
+class Phase(util.simple_repr_mixin):
+    """
+    A Phase object represents a single phase of the CI process, which is
+    essentially a name for a group of builders which get reported in aggregate.
+    """
+
+    @staticmethod
+    def fromdata(data):
+        version = data['version']
+        if version != 0:
+            raise ValueError, "Unknown version"
+
+        return Phase(data['name'], data['number'], data['builder_names'])
+
+    def todata(self):
+        return { 'version' : 0,
+                 'name' : self.name,
+                 'number' : self.number,
+                 'builder_names' : self.builder_names}
+
+    def __init__(self, name, number, builder_names):
+        self.name = name
+        self.number = number
+        self.builder_names = builder_names
+
+
+class Builder(util.simple_repr_mixin):
+    """
+    A Builder object stores information for an individual builder which
+    participates in some phase.
+    """
+
+    @staticmethod
+    def fromdata(data):
+        version = data['version']
+        if version != 0:
+            raise ValueError, "Unknown version"
+
+        return Builder(data['name'])
+
+    def todata(self):
+        return { 'version' : 0,
+                 'name' : self.name }
+
+    def __init__(self, name):
+        self.name = name
+
+
+class PublishedBuild(util.simple_repr_mixin):
+    """
+    A PublishedBuild records what artifacts we publicize on the primary
+    dashboard home page.
+    """
+
+    @staticmethod
+    def fromdata(data):
+        version = data['version']
+        if version != 0:
+            raise ValueError, "Unknown version"
+
+        return PublishedBuild(data['product'], data['os'],
+                              data['arch'], data['archive_name'])
+
+    def todata(self):
+        return { 'version' : 0,
+                 'product' : self.product,
+                 'os' : self.os,
+                 'arch' : self.arch,
+                 'archive_name' : self.archive_name }
+
+    def __init__(self, product, os, arch, archive_name):
+        self.product = product
+        self.os = os
+        self.arch = arch
+        self.archive_name = archive_name
+
+
+class Config(util.simple_repr_mixin):
+    """
+    The Config object holds the current representation of the lab CI
+    organization.
+    """
+
+    # FIXME: How much do we care about dealing with having the dashboard react
+    # to changes in the CIConfig? Might get messy...
+
+    @staticmethod
+    def fromdata(data):
+        version = data['version']
+        if version != 0:
+            raise ValueError, "Unknown version"
+
+        return Config([Phases.fromdata(item)
+                       for item in data['phases']],
+                      [Builder.fromdata(item)
+                       for item in data['builders']],
+                      [PublishedBuild.fromdata(item)
+                       for item in data['published_builds']])
+
+    def todata(self):
+        return { 'version' : 0,
+                 'phases' : [item.todata()
+                             for item in self.phases],
+                 'builders' : [item.todata()
+                               for item in self.builders],
+                 'published_builds' : [item.todata()
+                                       for item in self.published_builds] }
+
+    def __init__(self, phases, builders, published_builds):
+        self.phases = phases
+        self.builders = builders
+        self.published_builds = published_builds





More information about the llvm-commits mailing list