signalfx / maestro-ng

Orchestration of Docker-based, multi-host environments
https://signalfx.com
Apache License 2.0
685 stars 83 forks source link

Concurrent pull of two instances on the same repo throws error #147

Closed jverhoeven closed 9 years ago

jverhoeven commented 9 years ago

Consider this maestro.yaml:

services:
  mongo:
    image: mongo
    instances:
      mongo1:
        ship: server1
      mongo2:
        ship: server1

Doing a 'maestro pull' will throw an error (at least on my Ubuntu VM with docker-py==1.3.1, docker version 1.8 and latest master from maestro-ng, pulling official image from current version of docker hub):

Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/maestro/__main__.py", line 173, in execute
    getattr(c, options.command)(**vars(options))
  File "/usr/local/lib/python2.7/dist-packages/maestro/maestro.py", line 273, in pull
    concurrency, auditor=self.auditor).run()
  File "/usr/local/lib/python2.7/dist-packages/maestro/plays/__init__.py", line 148, in run
    self._end()
  File "/usr/local/lib/python2.7/dist-packages/maestro/plays/__init__.py", line 140, in _end
    exceptions.raise_with_tb(self._error)
  File "/usr/local/lib/python2.7/dist-packages/maestro/plays/__init__.py", line 97, in act
    task.run(auditor=self._auditor)
  File "/usr/local/lib/python2.7/dist-packages/maestro/plays/tasks.py", line 91, in run
    exceptions.raise_with_tb()
  File "/usr/local/lib/python2.7/dist-packages/maestro/plays/tasks.py", line 85, in run
    self._run()
  File "/usr/local/lib/python2.7/dist-packages/maestro/plays/tasks.py", line 413, in _run
    percentage = self._update_pull_progress(dlstatus)
  File "/usr/local/lib/python2.7/dist-packages/maestro/plays/tasks.py", line 425, in _update_pull_progress
    last = json.loads(last.decode('utf-8'))
  File "/usr/lib/python2.7/json/__init__.py", line 338, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python2.7/json/decoder.py", line 366, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python2.7/json/decoder.py", line 384, in raw_decode
    raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded

Seems fix is quite simple. Will submit a PR later.