2018-01-29 14:28:51 +00:00
|
|
|
import json, xmlrpc.client, zmq
|
2018-01-24 11:17:15 +00:00
|
|
|
|
2018-01-31 14:50:52 +00:00
|
|
|
from .config.envvars import SUPERVISOR_HTTP_URI
|
2017-11-27 17:42:34 +00:00
|
|
|
|
|
|
|
|
|
|
|
def parse_anchor_from_message(message):
|
|
|
|
message_json = json.loads(message)
|
|
|
|
return message_json['anchor']
|
2018-01-10 15:49:23 +00:00
|
|
|
|
|
|
|
|
|
|
|
def create_source_code_response_data(filename, content, language):
|
|
|
|
return {
|
|
|
|
'filename': filename,
|
|
|
|
'content': content,
|
|
|
|
'language': language
|
2018-01-24 11:17:15 +00:00
|
|
|
}
|
|
|
|
|
2018-01-29 14:28:51 +00:00
|
|
|
|
2018-01-24 11:17:15 +00:00
|
|
|
class SupervisorMixin:
|
2018-01-29 14:28:51 +00:00
|
|
|
supervisor = xmlrpc.client.ServerProxy(SUPERVISOR_HTTP_URI).supervisor
|
|
|
|
|
|
|
|
|
|
|
|
class ZMQConnectorBase:
|
|
|
|
def __init__(self, zmq_context=None):
|
|
|
|
self._zmq_context = zmq_context or zmq.Context.instance()
|