Doing this in every `step' leads to contention over the database, which
currently isn't handled well.
if not G.idp(G.pow(x, m)):
bad('x not in group: %s^%d /= 1' % (G.str(x), m))
if not G.idp(G.pow(x, m)):
bad('x not in group: %s^%d /= 1' % (G.str(x), m))
+ ## Clear away old workers that aren't doing anything useful any more.
+ ## For each worker pid, check that its lockfile is still locked; if
+ ## not, it's finished and can be disposed of.
+ c.execute("""SELECT pid FROM workers""")
+ for pid, in c:
+ maybe_cleanup_worker(dir, db, pid)
+ for f in OS.listdir(dir):
+ if f.startswith('lk.'):
+ pid = int(f[3:])
+ maybe_cleanup_worker(dir, db, pid)
+
c.execute("""SELECT p.p, p.e, p.k, p.n, p.dpbits, COUNT(d.z)
FROM progress AS p LEFT OUTER JOIN points AS d
ON p.p = d.p AND p.k = d.k
c.execute("""SELECT p.p, p.e, p.k, p.n, p.dpbits, COUNT(d.z)
FROM progress AS p LEFT OUTER JOIN points AS d
ON p.p = d.p AND p.k = d.k
G, g, x, m, n = get_top(db)
if n is not None: raise ExpectedError, 'job done'
G, g, x, m, n = get_top(db)
if n is not None: raise ExpectedError, 'job done'
- ## Clear away old workers that aren't doing anything useful any more.
- ## For each worker pid, check that its lockfile is still locked; if
- ## not, it's finished and can be disposed of.
- c.execute("""SELECT pid FROM workers""")
- for pid, in c:
- maybe_cleanup_worker(dir, db, pid)
- for f in OS.listdir(dir):
- if f.startswith('lk.'):
- pid = int(f[3:])
- maybe_cleanup_worker(dir, db, pid)
-
## Find something to do. Either a job that's small enough for us to
## take on alone, and that nobody else has picked up yet, or one that
## everyone's pitching in on.
## Find something to do. Either a job that's small enough for us to
## take on alone, and that nobody else has picked up yet, or one that
## everyone's pitching in on.