Add generated_by field to the database model

Change-Id: I1cd3c0eafdbcef9bdd7ef632e9210f071fb0ee9f
This commit is contained in:
Christian Berendt 2015-04-03 10:32:57 +02:00
parent 7a1965cbf4
commit 9e11013025
4 changed files with 9 additions and 1 deletions

View File

@ -111,6 +111,7 @@ def do_show_fractal():
output.add_row(["yb", data['yb']])
output.add_row(["size", "%d bytes" % data['size']])
output.add_row(["checksum", data['checksum']])
output.add_row(["generated_by", data['generated_by']])
print(output)
else:
LOG.error("fractal '%s' not found" % CONF.command.uuid)

View File

@ -82,6 +82,7 @@ class Fractal(db.Model):
ya = db.Column(db.Float, nullable=False)
yb = db.Column(db.Float, nullable=False)
image = db.Column(db.LargeBinary, nullable=True)
generated_by = db.Column(db.String(256), nullable=True)
def __repr__(self):
return '<Fractal %s>' % self.uuid

View File

@ -47,6 +47,10 @@ yb = {{ fractal.yb }}</pre>
<td>Checksum</td>
<td><pre>{{ fractal.checksum }}</pre></td>
</tr>
<tr>
<td>Generated by</td>
<td><pre>{{ fractal.generated_by }}</pre></td>
</tr>
</tbody>
</table>
</div>

View File

@ -21,6 +21,7 @@ import json
import os
from PIL import Image
import random
import socket
import tempfile
import time
@ -139,7 +140,8 @@ class Worker(ConsumerMixin):
'duration': elapsed_time,
'image': image,
'checksum': checksum,
'size': size
'size': size,
'generated_by': socket.gethostname()
}
# NOTE(berendt): only necessary when using requests < 2.4.2