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