Skip to content

[Docker] Add retry for docker pull due to daemon not ready #3218

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 18 commits into from
Feb 24, 2024

Conversation

Michaelvll
Copy link
Collaborator

@Michaelvll Michaelvll commented Feb 23, 2024

pytest tests/test_smoke.py::test_job_queue_with_docker --azure fails because ray cluster fail to start on the remote machine. Logs: https://gist.github.com/Michaelvll/4528e47faa9a008e1b204ea8b6873947

The main reason is that the docker pull fails due to the docker daemon not ready when the cluster is just up, and our retry in cloud_vm_ray_backend tries ray up again with --no-restart passed, which causes the ray cluster fail to start due to some bug in ray.

while (retry_cnt < _MAX_RAY_UP_RETRY and
need_ray_up(ray_up_return_value)):
retry_cnt += 1
if retry_cnt > 1:
sleep = backoff.current_backoff()
logger.info(
'Retrying launching in {:.1f} seconds.'.format(sleep))
time.sleep(sleep)
# TODO(zhwu): when we retry ray up, it is possible that the ray
# cluster fail to start because --no-restart flag is used.
ray_up_return_value = ray_up()

In this PR, we retry the docker pull when the cluster is just up, so it does not error out and trigger that retry.

Future TODO:

  • We should make the retry of ray up more robust and make sure the ray cluster is started on the cluster.
  • A more useful way is to move all the cloud implementation to new provisioner API

Tested (run the relevant ones):

  • Code formatting: bash format.sh
  • Any manual or new tests for this PR (please specify below)
  • All smoke tests: pytest tests/test_smoke.py
  • Relevant individual smoke tests: pytest tests/test_smoke.py::test_fill_in_the_name
    • pytest tests/test_smoke.py::test_job_queue_with_docker --azure for three times and checked that there is no retry
    • pytest tests/test_smoke.py::test_job_queue_with_docker --aws
    • pytest tests/test_smoke.py::test_job_queue_with_docker --gcp
    • sky launch -c test-docker --cloud azure --cpus 2 ./test.yaml with private docker image on aws
    • sky launch -c test-docker --cloud gcp --cpus 2 ./test.yaml with private docker image on aws
  • Backward compatibility tests: bash tests/backward_comaptibility_tests.sh

@Michaelvll Michaelvll requested a review from cblmemo February 23, 2024 08:04
Copy link
Collaborator

@cblmemo cblmemo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! it looks mostly great to me. Left a comment on exception type

'1> /dev/null 2>&1 || '
f'{self.docker_cmd} pull {specific_image}')
break
except click.ClickException as e:
Copy link
Collaborator

@cblmemo cblmemo Feb 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is it click.ClickException? Should we catch broad exception here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is the exception raised by the underlying command runner when the command fails. It might be a better practice to only catch the exception that is raised by the underlying function.

@Michaelvll Michaelvll mentioned this pull request Feb 23, 2024
14 tasks
Comment on lines 18 to 23
{%- if docker_login_config is not none %}
docker_login_config:
username: {{docker_login_config.username}}
password: {{docker_login_config.password}}
server: {{docker_login_config.server}}
{%- endif %}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just want to make sure, we don't have gcp docker support w/ new provisioner until this PR..?

Copy link
Collaborator Author

@Michaelvll Michaelvll Feb 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yea... the private docker support does not work for GCP and Azure before this. We should probably add a smoke test for private docker image. Could you help file an issue and look into this?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Michaelvll Michaelvll merged commit c20fdab into master Feb 24, 2024
@Michaelvll Michaelvll deleted the retry-docker-pull branch February 24, 2024 03:18
shethhriday29 pushed a commit to shethhriday29/skypilot that referenced this pull request Feb 26, 2024
…org#3218)

* Add retry for docker pull due to daemon not ready

* longer wait time

* longer wait time

* retry earlier

* add retry for retries as well

* longer wait time

* change wait time

* format

* Add comment

* Fix

* Fix indent for azure docker config

* Fix docker login config

* Fix comments

* More robust docker login config

* Add retry for docker check

* minor fix

* Add additional test for stop and start with docker

* Fix cancelled
romilbhardwaj added a commit that referenced this pull request Feb 29, 2024
* initial commit

* newline

* comments

* run linter

* reminder for down

* tentatively done with example

* formatting

* yapf

* [Storage] Storage mounting tool permissions fix (#3215)

* fix permissions

* fix permissions

* [LLM] Example for Serving Gemma (#3207)

* Add serve for gemma and fix mixtral dependency

* Add hf token

* fix model len

* Add comment

* Serve your private gemma

* fix serve yaml

* readme

* Remove chat completion due to the wrong template

* add readme

* Update llm/gemma/README.md

Co-authored-by: Zongheng Yang <[email protected]>

* address comments

* Update README.md

Co-authored-by: Zongheng Yang <[email protected]>

* Update llm/gemma/README.md

Co-authored-by: Zongheng Yang <[email protected]>

* Update llm/gemma/README.md

Co-authored-by: Zongheng Yang <[email protected]>

* Update llm/gemma/README.md

Co-authored-by: Zongheng Yang <[email protected]>

* Change to it

* Add chat API

* use HF_TOKEN env

* typo

---------

Co-authored-by: Zongheng Yang <[email protected]>

* [LLM] Add logo for Gemma (#3220)

* Minor fixes for release 0.5.0 (#3212)

* when removing cudo credential, sky check fails

* remove tips

* minor hint fix

* fix cluster version for k8s

* fix typo

* [Docker] Add retry for docker pull due to daemon not ready (#3218)

* Add retry for docker pull due to daemon not ready

* longer wait time

* longer wait time

* retry earlier

* add retry for retries as well

* longer wait time

* change wait time

* format

* Add comment

* Fix

* Fix indent for azure docker config

* Fix docker login config

* Fix comments

* More robust docker login config

* Add retry for docker check

* minor fix

* Add additional test for stop and start with docker

* Fix cancelled

* added comments

* quick fix

* finished pip issues

* fix

* fix storage error message, add example link to docs

---------

Co-authored-by: Sheth <[email protected]>
Co-authored-by: Romil Bhardwaj <[email protected]>
Co-authored-by: Zhanghao Wu <[email protected]>
Co-authored-by: Zongheng Yang <[email protected]>
Co-authored-by: Romil Bhardwaj <[email protected]>
romilbhardwaj added a commit that referenced this pull request Mar 21, 2024
* initial commit

* newline

* comments

* run linter

* reminder for down

* tentatively done with example

* formatting

* yapf

* [Storage] Storage mounting tool permissions fix (#3215)

* fix permissions

* fix permissions

* [LLM] Example for Serving Gemma (#3207)

* Add serve for gemma and fix mixtral dependency

* Add hf token

* fix model len

* Add comment

* Serve your private gemma

* fix serve yaml

* readme

* Remove chat completion due to the wrong template

* add readme

* Update llm/gemma/README.md

Co-authored-by: Zongheng Yang <[email protected]>

* address comments

* Update README.md

Co-authored-by: Zongheng Yang <[email protected]>

* Update llm/gemma/README.md

Co-authored-by: Zongheng Yang <[email protected]>

* Update llm/gemma/README.md

Co-authored-by: Zongheng Yang <[email protected]>

* Update llm/gemma/README.md

Co-authored-by: Zongheng Yang <[email protected]>

* Change to it

* Add chat API

* use HF_TOKEN env

* typo

---------

Co-authored-by: Zongheng Yang <[email protected]>

* [LLM] Add logo for Gemma (#3220)

* Minor fixes for release 0.5.0 (#3212)

* when removing cudo credential, sky check fails

* remove tips

* minor hint fix

* fix cluster version for k8s

* fix typo

* [Docker] Add retry for docker pull due to daemon not ready (#3218)

* Add retry for docker pull due to daemon not ready

* longer wait time

* longer wait time

* retry earlier

* add retry for retries as well

* longer wait time

* change wait time

* format

* Add comment

* Fix

* Fix indent for azure docker config

* Fix docker login config

* Fix comments

* More robust docker login config

* Add retry for docker check

* minor fix

* Add additional test for stop and start with docker

* Fix cancelled

* added comments

* quick fix

* finished pip issues

* fix

* fix storage error message, add example link to docs

* logging for SSH when doing kubernetes provision

* romil edits

* took out todo commnt

* removed extra file

* renamed file

* restored right version of file

* simplify things

* newline

* more formatting

* formatting

* minor fixes

* set x and logging

* fixes

* docstr

---------

Co-authored-by: Sheth <[email protected]>
Co-authored-by: Romil Bhardwaj <[email protected]>
Co-authored-by: Zhanghao Wu <[email protected]>
Co-authored-by: Zongheng Yang <[email protected]>
Co-authored-by: Romil Bhardwaj <[email protected]>
romilbhardwaj added a commit that referenced this pull request Apr 15, 2024
* initial commit

* newline

* comments

* run linter

* reminder for down

* tentatively done with example

* formatting

* yapf

* [Storage] Storage mounting tool permissions fix (#3215)

* fix permissions

* fix permissions

* [LLM] Example for Serving Gemma (#3207)

* Add serve for gemma and fix mixtral dependency

* Add hf token

* fix model len

* Add comment

* Serve your private gemma

* fix serve yaml

* readme

* Remove chat completion due to the wrong template

* add readme

* Update llm/gemma/README.md

Co-authored-by: Zongheng Yang <[email protected]>

* address comments

* Update README.md

Co-authored-by: Zongheng Yang <[email protected]>

* Update llm/gemma/README.md

Co-authored-by: Zongheng Yang <[email protected]>

* Update llm/gemma/README.md

Co-authored-by: Zongheng Yang <[email protected]>

* Update llm/gemma/README.md

Co-authored-by: Zongheng Yang <[email protected]>

* Change to it

* Add chat API

* use HF_TOKEN env

* typo

---------

Co-authored-by: Zongheng Yang <[email protected]>

* [LLM] Add logo for Gemma (#3220)

* Minor fixes for release 0.5.0 (#3212)

* when removing cudo credential, sky check fails

* remove tips

* minor hint fix

* fix cluster version for k8s

* fix typo

* [Docker] Add retry for docker pull due to daemon not ready (#3218)

* Add retry for docker pull due to daemon not ready

* longer wait time

* longer wait time

* retry earlier

* add retry for retries as well

* longer wait time

* change wait time

* format

* Add comment

* Fix

* Fix indent for azure docker config

* Fix docker login config

* Fix comments

* More robust docker login config

* Add retry for docker check

* minor fix

* Add additional test for stop and start with docker

* Fix cancelled

* added comments

* quick fix

* finished pip issues

* fix

* fix storage error message, add example link to docs

* changed error message if default nc installed on mac

* refactored check_port_forward_mode_dependencies function

* update comment

---------

Co-authored-by: Sheth <[email protected]>
Co-authored-by: Romil Bhardwaj <[email protected]>
Co-authored-by: Zhanghao Wu <[email protected]>
Co-authored-by: Zongheng Yang <[email protected]>
Co-authored-by: Romil Bhardwaj <[email protected]>
SeungjinYang added a commit that referenced this pull request Apr 2, 2025
* initial commit

* newline

* comments

* run linter

* reminder for down

* tentatively done with example

* formatting

* yapf

* [Storage] Storage mounting tool permissions fix (#3215)

* fix permissions

* fix permissions

* [LLM] Example for Serving Gemma (#3207)

* Add serve for gemma and fix mixtral dependency

* Add hf token

* fix model len

* Add comment

* Serve your private gemma

* fix serve yaml

* readme

* Remove chat completion due to the wrong template

* add readme

* Update llm/gemma/README.md

Co-authored-by: Zongheng Yang <[email protected]>

* address comments

* Update README.md

Co-authored-by: Zongheng Yang <[email protected]>

* Update llm/gemma/README.md

Co-authored-by: Zongheng Yang <[email protected]>

* Update llm/gemma/README.md

Co-authored-by: Zongheng Yang <[email protected]>

* Update llm/gemma/README.md

Co-authored-by: Zongheng Yang <[email protected]>

* Change to it

* Add chat API

* use HF_TOKEN env

* typo

---------

Co-authored-by: Zongheng Yang <[email protected]>

* [LLM] Add logo for Gemma (#3220)

* Minor fixes for release 0.5.0 (#3212)

* when removing cudo credential, sky check fails

* remove tips

* minor hint fix

* fix cluster version for k8s

* fix typo

* [Docker] Add retry for docker pull due to daemon not ready (#3218)

* Add retry for docker pull due to daemon not ready

* longer wait time

* longer wait time

* retry earlier

* add retry for retries as well

* longer wait time

* change wait time

* format

* Add comment

* Fix

* Fix indent for azure docker config

* Fix docker login config

* Fix comments

* More robust docker login config

* Add retry for docker check

* minor fix

* Add additional test for stop and start with docker

* Fix cancelled

* added comments

* quick fix

* finished pip issues

* fix

* fix storage error message, add example link to docs

* prototype for gcs

* removed non git files

* rclone support for aws

* minor formatting fix

* fixed merge conflict

* fixed merge conflict

* fixed merge conflict

* reset perf example

* reset perf example

* added tests for rclone functionality

* update rclone vfs options

* testing

* test

* test

* update rclone config and rclone command options

* nit refactor

* rclone refactor

* nit

* update MOUNT_CACHE mode to MOUNT_CACHED mode

* update smoke test

* additional comments for mount cached command explaining options for rclone vfs mode

* rclone class doc-string fix

* nit format

* update step 7 of maybe_translate_local_file_mounts_and_sync_up

* Run rclone in the background so it does not hang with rclone log

* update log path

* R2 support

* Support Azure Blob Storage

* format

* minor fixes

* add max cache size, correctly mount cached in managed jobs

* change log to info level

* wip script to check for if vfs cache is flushed

* flushed out design for flush wait logic

* use hashed mount path for cache/logs to avoid collision

* review feedback, test just running rclone as daemon

* remainder of feedback

* Update sky/data/mounting_utils.py

Co-authored-by: Christopher Cooper <[email protected]>

* change storage test bucket name

* remove cached code outside of if

* only test rclone cmd when cached mount is there

* add cached mount to storage md

* one more test refactor

* nofail

* better match

* use deterministic hashing

* more refactor

---------

Co-authored-by: Sheth <[email protected]>
Co-authored-by: Hriday Sheth <[email protected]>
Co-authored-by: Romil Bhardwaj <[email protected]>
Co-authored-by: Zhanghao Wu <[email protected]>
Co-authored-by: Zongheng Yang <[email protected]>
Co-authored-by: Romil Bhardwaj <[email protected]>
Co-authored-by: Seung Jin <[email protected]>
Co-authored-by: Christopher Cooper <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants