feat(deployments): add logs to python package#382
Merged
cwetherill-ps merged 1 commit intomasterfrom Jan 21, 2022
Merged
Conversation
lamroger
approved these changes
Jan 21, 2022
Contributor
lamroger
left a comment
There was a problem hiding this comment.
reminder to remove the comment
| return client.execute(query, variable_values=params)['deleteDeployment'] | ||
|
|
||
|
|
||
| # my disappointment is immeasurable |
Contributor
There was a problem hiding this comment.
hope your weekend goes better
Contributor
Author
This hijacks some old crufty log machinery to enable log streaming from
the new Deployments V3. This exposes two new methods, one generator and
one that just dumps a buttload of logs in your lap.
By way of example:
```
>>> from gradient import gradient_deployments
>>> import json
>>>
>>>
>>> logs = gradient_deployments.get_deployment_logs(
... deployment_id='6753a6cc-393a-478d-bc29-9e8828a0aa2f',
... limit=5,
... api_key='<REDACTED>')
>>> print(json.dumps(logs, indent=4))
[
[
2,
"",
"2021-12-13T21:41:39.711Z"
],
[
3,
" Welcome to Streamlit. Check out our demo in your browser.",
"2021-12-13T21:41:39.711Z"
],
[
4,
"",
"2021-12-13T21:41:39.711Z"
],
[
5,
" Network URL: http://10.42.40.230:8501",
"2021-12-13T21:41:39.711Z"
],
[
6,
" External URL: http://172.83.13.4:8501",
"2021-12-13T21:41:39.711Z"
]
]
>>>
>>> logs = gradient_deployments.yield_deployment_logs(
... deployment_id='6753a6cc-393a-478d-bc29-9e8828a0aa2f',
... limit=5,
... api_key='<REDACTED>')
>>> next(logs)
LogRow(line=2, message='', timestamp='2021-12-13T21:41:39.711Z')
```
8169819 to
468299f
Compare
|
🎉 This PR is included in version 1.10.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

This hijacks some old crufty log machinery to enable log streaming from
the new Deployments V3. This exposes two new methods, one generator and
one that just dumps a buttload of logs in your lap.
By way of example: