]> git.pld-linux.org Git - projects/pld-builder.new.git/blame - PLD_Builder/notifyq.py
Switch to https for client/request handler server and between builders communication...
[projects/pld-builder.new.git] / PLD_Builder / notifyq.py
CommitLineData
63319e0a
AM
1# vi: encoding=utf-8 ts=8 sts=4 sw=4 et
2
3import path
4import os
5import shutil
6import time
7
8from config import config
9import util
10
11class Notify_Queue:
12 def __init__(self):
13 self.queue = None
14 self.some_failed = 0
15
16 def init(self, g=None):
17 self.queue = []
18 self.requester_email = g.requester_email
19 self.notify_url = config.notify_url
e6376553 20
63319e0a
AM
21 def add(self, file):
22 id = util.uuid()
9be34149 23 f = open(path.notify_queue_dir + '/' + id, 'w')
63319e0a
AM
24 f.write(file.read())
25 f.close()
26 self.queue.append({'id': id})
27
28 def flush(self):
29 def desc(l):
30 return """Target: %s
31Id: %s
32Builder: %s
33Time: %d
34Requester: %s
35END
36""" % (self.notify_url, l['id'], config.builder, time.time(), self.requester_email)
e6376553 37
63319e0a 38 for l in self.queue:
9be34149 39 f = open(path.notify_queue_dir + '/' + l['id'] + ".desc", "w")
63319e0a
AM
40 f.write(desc(l))
41 f.close()
42
43 def kill(self):
44 for l in self.queue:
9be34149 45 os.unlink(path.notify_queue_dir + '/' + l)
63319e0a
AM
46
47queue = Notify_Queue()
48
49def add(notify):
50 queue.add(notify)
51
52def flush():
53 queue.flush()
e6376553 54
63319e0a
AM
55def kill():
56 queue.kill()
57
58def init(r):
59 queue.init(r)
60
61def status():
62 return queue.status
e6376553 63
63319e0a
AM
64def clear_status():
65 queue.status = ""
This page took 0.428273 seconds and 4 git commands to generate.