|
@ -112,7 +112,7 @@ connection = Connection(CONF.transport_url) |
|
|
def index(page=1): |
|
|
def index(page=1): |
|
|
hostname = socket.gethostname() |
|
|
hostname = socket.gethostname() |
|
|
fractals = Fractal.query.filter( |
|
|
fractals = Fractal.query.filter( |
|
|
(Fractal.checksum != None) & (Fractal.size != None)).paginate( |
|
|
|
|
|
|
|
|
(Fractal.checksum is not None) & (Fractal.size is not None)).paginate( |
|
|
page=page, per_page=5) |
|
|
page=page, per_page=5) |
|
|
return flask.render_template('index.html', fractals=fractals, hostname=hostname) |
|
|
return flask.render_template('index.html', fractals=fractals, hostname=hostname) |
|
|
|
|
|
|
|
@ -137,7 +137,7 @@ def get_fractal(fractalid): |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def generate_fractal(**kwargs): |
|
|
def generate_fractal(**kwargs): |
|
|
print("Postprocessor called!" + str(kwargs)) |
|
|
|
|
|
|
|
|
LOG.debug("Postprocessor called!" + str(kwargs)) |
|
|
with producers[connection].acquire(block=True) as producer: |
|
|
with producers[connection].acquire(block=True) as producer: |
|
|
producer.publish(kwargs['result'], |
|
|
producer.publish(kwargs['result'], |
|
|
serializer='json', |
|
|
serializer='json', |
|
@ -145,13 +145,14 @@ def generate_fractal(**kwargs): |
|
|
declare=[queues.task_exchange], |
|
|
declare=[queues.task_exchange], |
|
|
routing_key='normal') |
|
|
routing_key='normal') |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def convert_image_to_binary(**kwargs): |
|
|
def convert_image_to_binary(**kwargs): |
|
|
print("Preprocessor call: " + str(kwargs)) |
|
|
|
|
|
|
|
|
LOG.debug("Preprocessor call: " + str(kwargs)) |
|
|
if 'image' in kwargs['data']['data']['attributes']: |
|
|
if 'image' in kwargs['data']['data']['attributes']: |
|
|
print("Converting image to binary...") |
|
|
|
|
|
kwargs['data']['data']['attributes']['image'] = str(kwargs['data']['data']['attributes']['image']).encode("ascii") |
|
|
|
|
|
#print("Preprocessor called!" + str(kwargs)) |
|
|
|
|
|
#return kwargs |
|
|
|
|
|
|
|
|
LOG.debug("Converting image to binary...") |
|
|
|
|
|
kwargs['data']['data']['attributes']['image'] = \ |
|
|
|
|
|
str(kwargs['data']['data']['attributes']['image']).encode("ascii") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def main(): |
|
|
def main(): |
|
|
print("Starting API server - new...") |
|
|
print("Starting API server - new...") |
|
@ -163,4 +164,3 @@ def main(): |
|
|
url_prefix='/v1', |
|
|
url_prefix='/v1', |
|
|
allow_client_generated_ids=True) |
|
|
allow_client_generated_ids=True) |
|
|
app.run(host=CONF.listen_address, port=CONF.bind_port, debug=True) |
|
|
app.run(host=CONF.listen_address, port=CONF.bind_port, debug=True) |
|
|
|
|
|
|