summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ARCH13
-rwxr-xr-xlorry-controller-webapp11
2 files changed, 23 insertions, 1 deletions
diff --git a/ARCH b/ARCH
index 7a81fbb..4151076 100644
--- a/ARCH
+++ b/ARCH
@@ -335,6 +335,19 @@ whether WEBAPP is giving out jobs to run from the run-queue. This
value is controlled by `/1.0/start-queue` and `/1.0/stop-queue`
requests.
+The `lorries` table implements the run-queue: all the Lorry specs that
+WEBAPP knows about. It has the following columns:
+
+* `path` is the path of the git repository on the local Trove, i.e.,
+ the git repository to which Lorry will push. This is a unique
+ identifier. It is used, for example, to determine if a Lorry spec
+ is obsolete after a CONFGIT update.
+* `text` has the text of the Lorry spec. This may be read from a file
+ or generated by Lorry Controller itself. This text will be given to
+ Lorry when a job is run.
+* `generated` is set to 0 or 1, depending on if the Lorry came from an
+ actual `.lorry` file or was generated by Lorry Controller.
+
Implementation plan
===================
diff --git a/lorry-controller-webapp b/lorry-controller-webapp
index ab4e343..a8c7fdd 100755
--- a/lorry-controller-webapp
+++ b/lorry-controller-webapp
@@ -66,8 +66,12 @@ class StateDB(object):
def _initialise_tables(self):
c = self._conn.cursor()
c.execute('BEGIN TRANSACTION')
+
c.execute('CREATE TABLE IF NOT EXISTS running_queue (running INT)')
c.execute('INSERT INTO running_queue VALUES (0)')
+
+ c.execute('CREATE TABLE IF NOT EXISTS lorries (path TEXT, text TEXT, generated INT)')
+
self._conn.commit()
def get_running_queue(self):
@@ -86,6 +90,11 @@ class StateDB(object):
c.execute('UPDATE running_queue SET running = ?', str(new_value))
self._conn.commit()
+ def get_lorries(self):
+ self._open()
+ c = self._conn.cursor()
+ return c.execute('SELECT * FROM lorries')
+
class LorryControllerRoute(object):
@@ -208,7 +217,7 @@ class ListQueue(LorryControllerRoute):
def run(self, **kwargs):
return {
- 'queue': [],
+ 'queue': [row.path for row in self.statedb.get_lorries()],
}