sagemaker-python-sdk: Poor error reporting of docker failures in local mode
Please fill out the form below.
System Information
- Framework (e.g. TensorFlow) / Algorithm (e.g. KMeans): Local mode with BYOC Tensorflow example
- Framework Version: n/a
- Python Version: 3
- CPU or GPU: CPU
- Python SDK Version:
AttributeError: module 'sagemaker' has no attribute '__version__' - Are you using a custom image: Yes, I’m trying to
Describe the problem
I’m working through the BYOC TF example https://github.com/awslabs/amazon-sagemaker-examples/blob/master/advanced_functionality/tensorflow_bring_your_own/tensorflow_bring_your_own.ipynb but modifying it and I see that the error message from running docker locally isn’t getting reported properly.
Specifically, if you just run just this code in a notebook:
from sagemaker.estimator import Estimator
hyperparameters = {'train-steps': 100}
instance_type = 'local'
estimator = Estimator(role=role,
train_instance_count=1,
train_instance_type=instance_type,
image_name='tensorflow-cifar10-example:latest',
hyperparameters=hyperparameters)
estimator.fit('file:///tmp/cifar-10-data')
it fails (because I don’t have a docker image called tensorflow-cifar10-example:latest). I get a big stack trace, but the key problem is that the actual error message has been swallowed. The exception says RuntimeError: Failed to run: ['docker-compose', '-f', '/private/var/folders/kw/8b59cw0s1c74qm8vc3xnzx50bj1cn5/T/tmpjl2m87y5/docker-compose.yaml', 'up', '--build', '--abort-on-container-exit'], Process exited with code: 1 which doesn’t tell me what’s wrong. But when I run the docker-compose command myself from the commandline I get:
$ docker-compose -f /private/var/folders/kw/8b59cw0s1c74qm8vc3xnzx50bj1cn5/T/tmpjl2m87y5/docker-compose.yaml up --build --abort-on-container-exit
Pulling algo-1-HNZFC (tensorflow-cifar10-example:latest)...
ERROR: The image for the service you're trying to recreate has been removed. If you continue, volume data could be lost. Consider backing up your data before continuing.
Continue with the new image? [yN]y
Pulling algo-1-HNZFC (tensorflow-cifar10-example:latest)...
ERROR: pull access denied for tensorflow-cifar10-example, repository does not exist or may require 'docker login'
It looks like when docker-compose is invoked in local-mode, stdout gets printed, but stderr is swallowed. Because in the notebook I see what looks like the stdout part of docker-compose, but not stderr:
INFO:sagemaker:Creating training-job with name: tensorflow-cifar10-example-2018-09-26-01-13-11-189
Continue with the new image? [yN]Pulling algo-1-NX951 (tensorflow-cifar10-example:latest)...
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
The key thing that’s missing in the notebook output is the two error messages
ERROR: The image for the service you're trying to recreate has been removed. If you continue, volume data could be lost. Consider backing up your data before continuing.
ERROR: pull access denied for tensorflow-cifar10-example, repository does not exist or may require 'docker login'
Minimal repro / logs
See above.
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 21
- Comments: 15 (4 by maintainers)
is this issue resolved? i am still facing this. I am using a custom scikit learn image.
Training with local mode happening properly. But during deployment getting this error message
**Exception in thread Thread-12: Traceback (most recent call last): File “/home/ec2-user/anaconda3/envs/python3/lib/python3.6/site-packages/sagemaker/local/image.py”, line 627, in run _stream_output(self.process) File “/home/ec2-user/anaconda3/envs/python3/lib/python3.6/site-packages/sagemaker/local/image.py”, line 687, in _stream_output raise RuntimeError(“Process exited with code: %s” % exit_code) RuntimeError: Process exited with code: 1
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File “/home/ec2-user/anaconda3/envs/python3/lib/python3.6/threading.py”, line 916, in _bootstrap_inner self.run() File “/home/ec2-user/anaconda3/envs/python3/lib/python3.6/site-packages/sagemaker/local/image.py”, line 632, in run raise RuntimeError(msg) RuntimeError: Failed to run: [‘docker-compose’, ‘-f’, ‘/tmp/tmp26kopljo/docker-compose.yaml’, ‘up’, ‘–build’, ‘–abort-on-container-exit’], Process exited with code: 1**
Please help e to resolve this error.
There can be multiple reasons for your local mode container failing with the error you are seeing above.
To list out currently running containers
If you see another container that was started by local mode, most likely you will need to finish that training job or remove that local endpoint.
To stop a running container
To remove a running container
The best way to debug this is to list out your previously ran local mode container and check the logs.
To list out previously ran containers
To check the log of a container
It would be also nice to have some progress reporting on when an image is being pulled(download progress). When I tried local mode for the first time I kept killing it because it looked like it was doing nothing(no output log message etc) after waiting for 3mins… at one point I just gave up and let it run which then finished downloading after an hour. I don’t know if there is a docker command to check ongoing downloads but surely if sagemaker is doing the ‘docker pull’ command the least it can do is pipe that output so we wont have to wait on belief alone that it is going to work.
@ChoiByungWook this extremely confusing - and happens quite a bit with my own code - as well as the SageMaker examples. would be really good to fix this.
my root cause is the following: