Skip to content

Commit

Permalink
use new BuildManager class instantiation signature
Browse files Browse the repository at this point in the history
  • Loading branch information
mpacer committed Mar 19, 2018
1 parent 074091c commit 2034f0f
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions procbuild/test_listen.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,22 @@
from . import MASTER_BRANCH
from .message_proxy import OUT
from .utils import file_age, log
from .pr_list import get_pr_info, status_file
from .pr_list import get_pr_info, status_file, cache
from .builder import BuildManager


def handle_message(data):
print('Message received:', data)

ctx = zmq.Context.instance()
socket = ctx.socket(zmq.SUB)
socket.connect(OUT)

socket.setsockopt(zmq.SUBSCRIBE, 'build_queue'.encode('utf-8'))
def create_listener_socket():
ctx = zmq.Context.instance()
socket = ctx.socket(zmq.SUB)
socket.connect(OUT)

socket.setsockopt(zmq.SUBSCRIBE, 'build_queue'.encode('utf-8'))
return socket


def _build_worker(nr):
pr_info = get_pr_info()
Expand Down Expand Up @@ -47,6 +52,7 @@ def build_and_log(*args, **kwargs):
p = Process(target=build_and_log,
kwargs=dict(user=pr['user'],
branch=pr['branch'],
cache=cache(),
master_branch=MASTER_BRANCH,
target=nr, log=log))
p.start()
Expand All @@ -68,8 +74,9 @@ def killer(process, timeout):
if __name__ == "__main__":
print('Listening for incoming messages...')
while True:
socket = create_listener_socket()
msg = socket.recv_multipart()
target, raw_payload= msg
target, raw_payload = msg
payload = json.loads(raw_payload.decode('utf-8'))
print('received', payload)
paper_to_build = payload.get('build_paper', None)
Expand Down

0 comments on commit 2034f0f

Please sign in to comment.