Fix some issues with progress "socket" workaround for batches

This commit is contained in:
Lance Edgar 2019-04-19 17:28:45 -05:00
parent 2c1985bef3
commit f8d26b4f8f

View file

@ -868,6 +868,8 @@ class BatchMasterView(MasterView):
# strip suffix, interpret data as JSON
data = data[:-len(suffix)]
if six.PY3:
data = data.decode('utf_8')
data = json.loads(data)
if data.get('everything_complete'):
@ -934,6 +936,7 @@ class BatchMasterView(MasterView):
],
subcommand='{}-batch'.format(action),
subcommand_args=[
'--batch-type',
self.handler.batch_key,
batch_uuid,
])
@ -956,9 +959,12 @@ class BatchMasterView(MasterView):
suffix = "\n\n.".encode('utf_8')
cxn = socket.create_connection(('127.0.0.1', port))
cxn.send(json.dumps({
data = json.dumps({
'everything_complete': True,
}))
})
if six.PY3:
data = data.encode('utf_8')
cxn.send(data)
cxn.send(suffix)
cxn.close()