Skip to content
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

[Serve] Print out the yaml on update in the controller log #3233

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

dtran24
Copy link
Contributor

@dtran24 dtran24 commented Feb 26, 2024

Fixes #3056

Tested (run the relevant ones):

  • Code formatting: bash format.sh
  • Any manual or new tests for this PR (please specify below)
    • Getting output on sky serve update commands. Output for multiline strings can be a little off though. For example, with yaml
service:
  readiness_probe: /
  replicas: 3

resources:
  cloud: aws
  ports: 8080
  cpus: 2

setup: |
  echo "hello world"
  echo "foo bar"

workdir: .

run: python -m http.server 8080

can see the output look like

I 02-26 05:16:43 subprocess_utils.py:204] name: sky-service-39a9
I 02-26 05:16:43 subprocess_utils.py:204] 
I 02-26 05:16:43 subprocess_utils.py:204] resources:
I 02-26 05:16:43 subprocess_utils.py:204]   cloud: AWS
I 02-26 05:16:43 subprocess_utils.py:204]   cpus: '2'
I 02-26 05:16:43 subprocess_utils.py:204]   disk_size: 256
I 02-26 05:16:43 subprocess_utils.py:204]   ports:
I 02-26 05:16:43 subprocess_utils.py:204]   - '8080'
I 02-26 05:16:43 subprocess_utils.py:204] 
I 02-26 05:16:43 subprocess_utils.py:204] service:
I 02-26 05:16:43 subprocess_utils.py:204]   readiness_probe:
I 02-26 05:16:43 subprocess_utils.py:204]     path: /
I 02-26 05:16:43 subprocess_utils.py:204]     initial_delay_seconds: 1200
I 02-26 05:16:43 subprocess_utils.py:204]   replica_policy:
I 02-26 05:16:43 subprocess_utils.py:204]     min_replicas: 3
I 02-26 05:16:43 subprocess_utils.py:204] 
I 02-26 05:16:43 subprocess_utils.py:204] num_nodes: 1
I 02-26 05:16:43 subprocess_utils.py:204] 
I 02-26 05:16:43 subprocess_utils.py:204] setup: 'echo "hello world"
I 02-26 05:16:43 subprocess_utils.py:204] 
I 02-26 05:16:43 subprocess_utils.py:204]   echo "foo bar"
I 02-26 05:16:43 subprocess_utils.py:204] 
I 02-26 05:16:43 subprocess_utils.py:204]   '
I 02-26 05:16:43 subprocess_utils.py:204] 
I 02-26 05:16:43 subprocess_utils.py:204] run: python -m http.server 8080
I 02-26 05:16:43 subprocess_utils.py:204] 
I 02-26 05:16:43 subprocess_utils.py:204] file_mounts:
I 02-26 05:16:43 subprocess_utils.py:204]   ~/sky_workdir:
I 02-26 05:16:43 subprocess_utils.py:204]     source: s3:https://skypilot-workdir-davidtran-fabe0f23
I 02-26 05:16:43 subprocess_utils.py:204]     store: S3
I 02-26 05:16:43 subprocess_utils.py:204]     persistent: false
I 02-26 05:16:43 subprocess_utils.py:204]     mode: COPY
I 02-26 05:16:43 subprocess_utils.py:204]     _force_delete: true

Clearly better than previous state (i.e. no logging), but currently not sure why some unnecessary single quotes and new lines are showing up

  • All smoke tests: pytest tests/test_smoke.py
  • Relevant individual smoke tests: pytest tests/test_smoke.py::test_fill_in_the_name
  • Backward compatibility tests: bash tests/backward_comaptibility_tests.sh

@dtran24 dtran24 changed the title log yaml used for update [Serve] Print out the yaml on update in the controller log Feb 26, 2024
@dtran24
Copy link
Contributor Author

dtran24 commented Feb 26, 2024

Requesting review @Michaelvll @cblmemo

sky/serve/controller.py Outdated Show resolved Hide resolved
sky/serve/controller.py Show resolved Hide resolved
@dtran24 dtran24 requested a review from cblmemo February 27, 2024 04:41
@cblmemo
Copy link
Collaborator

cblmemo commented Feb 28, 2024

Could you try this code snippet:

import yaml
def literal_presenter(dumper, data):
    if '\n' in data:
        return dumper.represent_scalar('tag:yaml.org,2002:str', data, style='|')
    return dumper.represent_scalar('tag:yaml.org,2002:str', data)
yaml.add_representer(str, literal_presenter, Dumper=yaml.SafeDumper)
print(yaml.safe_dump(task.to_yaml_config(), sort_keys=False))

@dtran24
Copy link
Contributor Author

dtran24 commented Mar 1, 2024

@cblmemo I still get the same output that I mentioned in the PR description when I run it on the controller

@cblmemo
Copy link
Collaborator

cblmemo commented Mar 2, 2024

@cblmemo I still get the same output that I mentioned in the PR description when I run it on the controller

could you push the latest code to this branch?

@github-actions github-actions bot added the Stale label Jul 1, 2024
@cblmemo cblmemo removed the Stale label Jul 1, 2024
@skypilot-org skypilot-org deleted a comment from github-actions bot Jul 4, 2024
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.

[Serve] Print out the service yaml in the controller log for better error tracking
2 participants