[Pkg-debile-commits] [debile-master] 01/26: Removed some old stuff relative to mongo

Sylvestre Ledru sylvestre at alioth.debian.org
Tue Aug 20 16:22:34 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 d7f6cec9a16e61d75ea37106db505d652a7f7cf9
Author: Léo Cavaillé <leo at cavaille.net>
Date:   Thu Aug 8 20:59:40 2013 +0200

    Removed some old stuff relative to mongo
---
 LICENSE => LICENSE.txt    |    0
 NOTES                     |    1 -
 PACKAGING.md => PACKAGING |    0
 eg/config.json            |   67 --------------------
 lucy/models/binary.py     |   30 ---------
 lucy/models/job.py        |  153 ---------------------------------------------
 lucy/models/machine.py    |   38 -----------
 lucy/models/report.py     |   56 -----------------
 lucy/models/source.py     |   62 ------------------
 lucy/models/user.py       |   30 ---------
 scripts/create-index.js   |   49 ---------------
 scripts/lucy-janitor      |   31 ---------
 12 files changed, 517 deletions(-)

diff --git a/LICENSE b/LICENSE.txt
similarity index 100%
rename from LICENSE
rename to LICENSE.txt
diff --git a/NOTES b/NOTES
deleted file mode 100644
index 12891b3..0000000
--- a/NOTES
+++ /dev/null
@@ -1 +0,0 @@
-db.jobs.update({"builder": "loki", "finished_at": null}, {"$set": {"builder": null}}, multi=true, safe=true)
diff --git a/PACKAGING.md b/PACKAGING
similarity index 100%
rename from PACKAGING.md
rename to PACKAGING
diff --git a/eg/config.json b/eg/config.json
deleted file mode 100644
index 0faa0a0..0000000
--- a/eg/config.json
+++ /dev/null
@@ -1,67 +0,0 @@
-{
-    "configs": [
-        {
-            "_id": "default",
-            "arches": [
-                "amd64"
-            ],
-            "incoming": "/srv/lucy.pault.ag/incoming",
-            "job_classes": {
-                "binary": [
-                    "piuparts",
-                    "adequate",
-                    "lintian",
-                    "lintian4py"
-                ],
-                "source": [
-                    "lintian",
-                    "lintian4py"
-                ]
-            },
-            "keyring": "/var/lib/lucy/keyring",
-            "pool": "/srv/lucy.pault.ag/pool",
-            "public": "http://localhost/pool",
-            "suites": [
-                "unstable",
-                "testing",
-                "stable"
-            ]
-        }
-    ],
-    "machines": [
-        {
-            "_id": "leliel",
-            "auth": "password",
-            "gpg": "A998491ADCCB93C7A73A27403D3FDC7A47036CF7",
-            "owner": "paultag"
-        },
-        {
-            "_id": "chayot",
-            "auth": "password",
-            "gpg": "BDCF0DF8B500A91BFDD26103ED557BBBC1EB3C94",
-            "owner": "paultag"
-        },
-        {
-            "_id": "loki",
-            "auth": "password",
-            "gpg": "C1C274ACEA4F7879378DC6960943D06F6CA9F2D8",
-            "owner": "paultag"
-        }
-    ],
-    "users": [
-        {
-            "_id": "paultag",
-            "email": "tag at pault.ag",
-            "gpg": "57DC4BD33F73E0CDBA98D22AF7EBEE8EB7982329",
-            "name": "Paul R. Tagliamonte",
-            "auth": "secret"
-        },
-        {
-            "_id": "rebuilder",
-            "email": "paultag at debian.org",
-            "gpg": "2EA5C67F0A37D37C64C7B5EDC0A1FC9FD80D7B69",
-            "name": "Archive Rebuilder",
-            "auth": "secret"
-        }
-    ]
-}
diff --git a/lucy/models/binary.py b/lucy/models/binary.py
deleted file mode 100644
index fd545b7..0000000
--- a/lucy/models/binary.py
+++ /dev/null
@@ -1,30 +0,0 @@
-from lucy.models import LucyObject
-
-
-class Binary(LucyObject):
-    _type = 'binaries'
-
-    def __init__(self, job, arch, suite, binaries, builder, **kwargs):
-        from lucy.models.job import Job
-        job = Job.load(job)
-        if job['package_type'] != 'source':
-            raise ValueError("Package from Job isn't a source package")
-
-        if 'source' not in kwargs:
-            kwargs['source'] = job['package']
-
-        super(Binary, self).__init__(job=job['_id'],
-                                     arch=arch,
-                                     suite=suite,
-                                     builder=builder,
-                                     binaries=binaries,
-                                     **kwargs)
-
-    def get_source(self):
-        from lucy.models.source import Source
-        return Source.load(self['source'])
-
-    def get_reports(self):
-        from lucy.models.report import Report
-        for x in Report.query({"package": self['_id']}):
-            yield x
diff --git a/lucy/models/job.py b/lucy/models/job.py
deleted file mode 100644
index c0c59c2..0000000
--- a/lucy/models/job.py
+++ /dev/null
@@ -1,153 +0,0 @@
-import datetime as dt
-
-from lucy.models.machine import Machine
-from lucy.models import LucyObject
-
-
-class Job(LucyObject):
-    _type = 'jobs'
-
-    def __init__(self, type, package, package_type, arch, suite,
-                 builder=None, finished_at=None, assigned_at=None,
-                 source=None, **kwargs):
-
-        from lucy.models.source import Source
-        from lucy.models.binary import Binary
-
-        if package_type not in ["source", "binary"]:
-            raise ValueError("package_type needs to be binary or source")
-
-        if package_type == "source":
-            package = Source.load(package)
-            if source is None:
-                source = package['_id']
-
-        if package_type == "binary":
-            package = Binary.load(package)
-            if source is None:
-                source = package['source']
-
-        if package is None:
-            raise ValueError("Bad package")
-
-        package = package['_id']
-
-        if builder:
-            builder = Machine.load(builder)['_id']
-
-        if source is None:
-            raise ValueError("Bad source :(")
-
-        super(Job, self).__init__(
-            type=type,
-            arch=arch,
-            suite=suite,
-            source=source,
-            package=package,
-            builder=builder,
-            finished_at=finished_at,
-            assigned_at=assigned_at,
-            package_type=package_type,
-            **kwargs)
-
-    def get_package(self):
-        from lucy.models.source import Source
-        from lucy.models.binary import Binary
-
-        if self['package_type'] == 'binary':
-            return Binary.load(self['package'])
-
-        if self['package_type'] == 'source':
-            return Source.load(self['package'])
-
-    def get_source(self):
-        from lucy.models.source import Source
-        return Source.load(self['source'])
-
-    def get_reports(self, spec):
-        from lucy.models.report import Report
-        spec = spec.copy()
-        spec.update({"job": self['_id']})
-        for x in Report.query(spec):
-            yield x
-
-    def get_builder(self):
-        builder = self.get('builder', None)
-        if builder is None:
-            return None
-        return Machine.load(builder)
-
-    def is_finished(self):
-        return not self.get('finished_at', None) is None
-
-    @classmethod
-    def unassigned_jobs(cls, **kwargs):
-        k = kwargs.copy()
-        k.update({"builder": None, "finished_at": None})
-
-        for x in cls.query(k):
-            yield x
-
-    @classmethod
-    def next_job(cls, suites, arches, types, **kwargs):
-        k = kwargs.copy()
-        k.update({"builder": None,
-                  "finished_at": None,
-                  "type": {"$in": types},
-                  "suite": {"$in": suites},
-                  "arch": {"$in": arches}})
-        v = cls.single(k)
-        return v
-
-    @classmethod
-    def dead_jobs(cls, howlong, **kwargs):
-        cutoff = dt.datetime.utcnow() - howlong
-        for x in cls.unfinished_jobs(**{
-            "assigned_at": {"$lt": cutoff},
-            "builder": {"$ne": None},
-            "finished_at": None
-        }):
-            yield x
-
-    @classmethod
-    def by_package(cls, package, **kwargs):
-        for x in cls.query({"package": package}):
-            yield x
-
-    def is_pending(self):
-        if self['finished_at'] is None:
-            return True
-        return False
-
-    def is_failed(self):
-        try:
-            next(self.get_reports({"failed": False}))
-            return False
-        except StopIteration:
-            return True
-
-    def is_critical(self):
-        if self['type'] in [
-            "build",
-            "piuparts",
-            "adequite",
-        ]:
-            return True
-        return False
-
-    @classmethod
-    def by_source(cls, source, **kwargs):
-        return cls.query({"source": source})
-
-    @classmethod
-    def unfinished_jobs(cls, **kwargs):
-        k = {}
-        k.update({"finished_at": None,
-                  "builder": {"$ne": None}})
-        k.update(kwargs.copy())
-
-        return cls.query(k)
-
-    @classmethod
-    def assigned_jobs(cls, builder, **kwargs):
-        return cls.unfinished_jobs(**{"builder": builder})
diff --git a/lucy/models/machine.py b/lucy/models/machine.py
deleted file mode 100644
index 624ee79..0000000
--- a/lucy/models/machine.py
+++ /dev/null
@@ -1,38 +0,0 @@
-from lucy.models import LucyObject
-from lucy.models.user import User
-import datetime as dt
-
-
-class Machine(LucyObject):
-    _type = 'machines'
-
-    def __init__(self, _id, owner, auth, last_ping=None, **kwargs):
-        owner = User.load(owner)['_id']
-
-        super(Machine, self).__init__(_id=_id,
-                                      owner=owner,
-                                      auth=auth,
-                                      last_ping=last_ping,
-                                      **kwargs)
-
-    def auth(self, auth):
-        return self['auth'] == auth
-
-    @classmethod
-    def get_by_key(cls, key):
-        return cls.single({"gpg": key})
-
-    def get_owner(self):
-        return User.load(self['owner'])
-
-    def ping(self):
-        self['last_ping'] = dt.datetime.utcnow()
-        self.save()
-
-    def get_jobs(self):
-        from lucy.models.job import Job
-        return Job.assigned_jobs(self['_id'])
-
-    @classmethod
-    def get_builders(cls):
-        return cls.query({})
diff --git a/lucy/models/report.py b/lucy/models/report.py
deleted file mode 100644
index 93dd531..0000000
--- a/lucy/models/report.py
+++ /dev/null
@@ -1,56 +0,0 @@
-from lucy.models.machine import Machine
-from lucy.models.source import Source
-from lucy.models.binary import Binary
-from lucy.models import LucyObject
-from lucy.models.job import Job
-
-
-class Report(LucyObject):
-    _type = 'reports'
-
-    def __init__(self, report, builder, package,
-                 package_type, job, failed,
-                 source=None, type=None, **kwargs):
-
-        if package_type not in ["source", "binary"]:
-            raise ValueError("Bad package type")
-
-        loaded_package = None
-        if package_type == 'source':
-            try:
-                loaded_package = Source.load(package)
-                if source is None:
-                    source = loaded_package['_id']
-            except KeyError:
-                pass
-
-        if package_type == 'binary':
-            try:
-                loaded_package = Binary.load(package)
-                if source is None:
-                    source = loaded_package['source']
-            except KeyError:
-                pass
-
-        if loaded_package is None:
-            raise KeyError("No such package")
-
-        builder = Machine.load(builder)['_id']
-
-        job = Job.load(job)
-
-        if type is None:
-            type = job['type']
-
-        if source is None:
-            raise ValueError("No source :(")
-
-        super(Report, self).__init__(package_type=package_type,
-                                     source=source,
-                                     builder=builder,
-                                     package=loaded_package['_id'],
-                                     report=report,
-                                     job=job['_id'],
-                                     type=type,
-                                     failed=failed,
-                                     **kwargs)
diff --git a/lucy/models/source.py b/lucy/models/source.py
deleted file mode 100644
index bc8fcec..0000000
--- a/lucy/models/source.py
+++ /dev/null
@@ -1,62 +0,0 @@
-from lucy.models import LucyObject
-from lucy.models.user import User
-from lucy.models.job import Job
-import lucy.core
-
-
-class Source(LucyObject):
-    _type = 'sources'
-
-    def __init__(self, source, version, owner, dsc, group=None, **kwargs):
-        owner = User.load(owner)['_id']
-        super(Source, self).__init__(source=source,
-                                     version=version,
-                                     group=group,
-                                     owner=owner,
-                                     dsc=dsc,
-                                     **kwargs)
-
-
-    def get_owner(self):
-        return User.load(self['owner'])
-
-    def get_jobs(self):
-        for x in Job.by_package(self['_id']):
-            yield x
-
-    def get_pending_jobs(self):
-        for x in Job.query({
-            "source": self['_id'],
-            "finished_at": None
-        }):
-            yield x
-
-    def get_reports(self):
-        from lucy.models.report import Report
-        for x in Report.query({"package": self['_id']}):
-            yield x
-
-    def get_binaries(self):
-        from lucy.models.binary import Binary
-        for x in Binary.query({"source": self['_id']}):
-            yield x
-
-    def get_all_jobs(self):
-        from lucy.models.source import Source
-        return Job.by_source(self['_id'])
-
-    def get_job_status(self):
-        db = lucy.core.db
-        total = db.jobs.find({
-            "source": self['_id']
-        }).count()
-        unfinished = db.jobs.find({
-            "source": self['_id'],
-            "finished_at": None
-        }).count()
-        return (total, unfinished)
-
-    @classmethod
-    def get_uploads_for_user(cls, who):
-        for x in cls.query({"owner": who}):
-            yield x
diff --git a/lucy/models/user.py b/lucy/models/user.py
deleted file mode 100644
index b939353..0000000
--- a/lucy/models/user.py
+++ /dev/null
@@ -1,30 +0,0 @@
-from lucy.models import LucyObject
-
-
-class User(LucyObject):
-    _type = 'users'
-
-    def __init__(self, _id, auth, name, email, gpg, **kwargs):
-        super(User, self).__init__(_id=_id,
-                                   auth=auth,
-                                   gpg=gpg,
-                                   name=name,
-                                   email=email,
-                                   **kwargs)
-
-    @classmethod
-    def get_by_email(cls, email):
-        return cls.single({"email": email})
-
-    @classmethod
-    def get_by_key(cls, key):
-        return cls.single({"gpg": key})
-
-    def get_uploads(self):
-        from lucy import Source
-        return Source.get_uploads_for_user(self['_id'])
-
-    def auth(self, auth):
-        return self['auth'] == auth
-
-    get_by_uid = LucyObject.load
diff --git a/scripts/create-index.js b/scripts/create-index.js
deleted file mode 100755
index 74cb641..0000000
--- a/scripts/create-index.js
+++ /dev/null
@@ -1,49 +0,0 @@
-#!/usr/bin/mongo lucy
-
-db.binaries.ensureIndex({"package": 1});
-db.binaries.ensureIndex({"package": -1});
-db.binaries.ensureIndex({"source": -1});
-db.binaries.ensureIndex({"source": 1});
-db.jobs.ensureIndex({"package": -1});
-db.jobs.ensureIndex({"package": 1});
-db.jobs.ensureIndex({"job": 1});
-db.jobs.ensureIndex({"job": -1});
-db.jobs.ensureIndex({"builder": -1});
-db.jobs.ensureIndex({"builder": 1});
-db.jobs.ensureIndex({"finished_at": 1});
-db.jobs.ensureIndex({"finished_at": -1});
-db.jobs.ensureIndex({"builder": 1, "finished_at": 1, "type": 1, "suite": 1, "arch": 1});
-db.jobs.ensureIndex({"builder": -1, "finished_at": -1, "type": -1, "suite": -1, "arch": -1});
-db.jobs.ensureIndex({"assigned_at": 1, "builder": 1, "finished_at": 1});
-db.jobs.ensureIndex({"assigned_at": -1, "builder": -1, "finished_at": -1});
-db.jobs.ensureIndex({"builder": -1, "finished_at": -1});
-db.machines.ensureIndex({"gpg": 1});
-db.machines.ensureIndex({"gpg": -1});
-db.machines.ensureIndex({"owner": -1});
-db.machines.ensureIndex({"owner": 1});
-db.machines.ensureIndex({"auth": 1});
-db.machines.ensureIndex({"auth": -1});
-db.machines.ensureIndex({"last_ping": 1});
-db.machines.ensureIndex({"last_ping": -1});
-db.reports.ensureIndex({"package": 1});
-db.reports.ensureIndex({"package": -1});
-db.sources.ensureIndex({"owner": 1});
-db.sources.ensureIndex({"owner": -1});
-db.sources.ensureIndex({"group": 1});
-db.sources.ensureIndex({"group": -1});
-db.sources.ensureIndex({"updated_at": 1});
-db.sources.ensureIndex({"updated_at": -1});
-db.sources.ensureIndex({"group": 1, "updated_at": 1});
-db.sources.ensureIndex({"group": 1, "updated_at": -1});
-db.sources.ensureIndex({"group": -1, "updated_at": 1});
-db.sources.ensureIndex({"group": -1, "updated_at": -1});
-db.reports.ensureIndex({"package": -1});
-db.reports.ensureIndex({"package": 1});
-db.binaries.ensureIndex({"source": 1});
-db.binaries.ensureIndex({"source": -1});
-db.users.ensureIndex({"email": 1});
-db.users.ensureIndex({"email": -1});
-db.users.ensureIndex({"gpg": 1});
-db.users.ensureIndex({"gpg": -1});
-
-print("complete.");
diff --git a/scripts/lucy-janitor b/scripts/lucy-janitor
deleted file mode 100755
index fcf0efc..0000000
--- a/scripts/lucy-janitor
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/usr/bin/env python
-
-from lucy.models.job import Job
-#from lucy.cli.incoming import main as process_incoming
-
-import datetime as dt
-import schedule
-import time
-
-
-def cron():
-    # process_incoming()
-    cleanup_jobs()
-
-
-def cleanup_jobs():
-    length = dt.timedelta(hours=2)
-    jobs = Job.dead_jobs(length)
-    for job in jobs:
-        job['builder'] = None
-        job['assigned_at'] = None
-        job.save()
-        print("Pushing %s back into the pool" % (job['_id']))
-
-
-schedule.every(30).seconds.do(cron)
-
-
-while True:
-    schedule.run_pending()
-    time.sleep(1)

-- 
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