[Pkg-debile-commits] [debile-master] 22/26: Improving re-installation of lucy

Sylvestre Ledru sylvestre at alioth.debian.org
Tue Aug 20 16:22:39 UTC 2013


This is an automated email from the git hooks/post-receive script.

sylvestre pushed a commit to branch master
in repository debile-master.

commit 92afb4a3e1a633eb31a1f30315338987f7c93f2d
Author: Léo Cavaillé <leo at cavaille.net>
Date:   Fri Aug 16 11:02:57 2013 +0200

    Improving re-installation of lucy
---
 lucy/cli/init.py |   20 ++++++++++++++++++++
 lucy/server.py   |   23 ++++++++++++++++++++++-
 2 files changed, 42 insertions(+), 1 deletion(-)

diff --git a/lucy/cli/init.py b/lucy/cli/init.py
index df5edd9..a9b442f 100644
--- a/lucy/cli/init.py
+++ b/lucy/cli/init.py
@@ -6,6 +6,8 @@ from sqlalchemy.orm import sessionmaker
 from lucy.config import Config
 
 import json
+import shutil
+import os
 
 metadata = lucymodel.Base.metadata
 
@@ -15,8 +17,20 @@ def main():
     Session = sessionmaker(bind=engine)
     session = Session()
 
+    pool = config.get('paths', 'pool')
+    incoming = config.get('paths', 'incoming')
+    jobs = config.get('paths', 'job')
+
+
     if args.flags.contains('--drop'):
+        print "Dropping the database schema"
         metadata.drop_all(bind=engine)
+        print "Erasing the pool"
+        shutil.rmtree(pool)
+        print "Erasing the incoming"
+        shutil.rmtree(incoming)
+        print "Erasing the job attachments"
+        shutil.rmtree(jobs)
 
     metadata.create_all(bind=engine)
     initialadmin = lucymodel.User(login='admin',
@@ -27,6 +41,12 @@ def main():
                                   admin=True)
     session.add(initialadmin)
     session.commit()
+    print "Create the pool"
+    os.makedirs(pool)
+    print "Create the incoming"
+    os.makedirs(incoming)
+    print "Create the job attachments"
+    os.makedirs(jobs)
 
 if __name__ == "__main__":
     main()
diff --git a/lucy/server.py b/lucy/server.py
index a2fdff5..453091c 100644
--- a/lucy/server.py
+++ b/lucy/server.py
@@ -31,6 +31,8 @@ Session = scoped_session(session_factory)
 gnupg_default_home = os.path.join(os.environ['HOME'], '.gnupg')
 gpg = gnupg.GPG(gnupghome=gnupg_default_home, verbose=False)
 
+PAUSED = False
+
 def row2dict(row):
     d = {}
     for column in row.__table__.columns:
@@ -86,6 +88,19 @@ def admin_method(fn):
     return _
 
 class LucyInterface(object):
+    @admin_method
+    def get_paused_status(self):
+        return PAUSED
+
+    @admin_method
+    def set_paused_status(self, status):
+        PAUSED = status
+        if PAUSED:
+            logging.info("PAUSING ALL THE WORKERS UNTIL FURTHER INSTRUCTION RECEIVED")
+        else:
+            logging.info("RESUMING WORKERS")
+        return PAUSED
+
     @user_method
     def get_server_info(self):
         """
@@ -252,8 +267,14 @@ class LucyInterface(object):
     @machine_method
     def get_next_job(self, suites, arches, types):
         """
-        Get an unassigned lint job from suite suites, arches arches
+        Get an unassigned lint job given the following information from the builder :
+          * a list of suites supported
+          * a list of arches supported
+          * a list of job types supported
+        If lucy is paused, return nothing.
         """
+        if PAUSED:
+            return None
         session = Session()
 
         j = session.query(Job).\

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-debile/debile-master.git



More information about the Pkg-debile-commits mailing list