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

log traceback properly #1734

Merged
merged 2 commits into from
Jun 12, 2024
Merged

log traceback properly #1734

merged 2 commits into from
Jun 12, 2024

Conversation

technillogue
Copy link
Contributor

when an error happens, we log the traceback. this goes through the normal logging mechanism, which drops the log if there's more than one prediction. we can use _log(traceback.format_exc()) instead. also fix some minor formatting things.

@technillogue technillogue changed the base branch from main to async June 11, 2024 18:30
Signed-off-by: technillogue <[email protected]>
@technillogue technillogue force-pushed the syl/log-traceback-properly branch from 326de44 to 8a44056 Compare June 11, 2024 18:30
@mattt
Copy link
Contributor

mattt commented Jun 11, 2024

@technillogue Can you share an example of what this looks like before and after the change?

@technillogue
Copy link
Contributor Author

previously, two predictions at the same time, piped through jq '{error: .error, logs: .logs}

{
  "error": "",
  "logs": ""
}
{
  "error": "",
  "logs": "Traceback (most recent call last):\n stderrFile \"/home/sylv/r8/_cog/python/cog/server/worker.py\", line 240, in _handle_predict_error\n stderryield\n stderrFile \"/home/sylv/r8/_cog/python/cog/server/worker.py\", line 275, in _predict_async\n stderrasync for r in result:\n stderrFile \"/home/sylv/r8/_cog/python/test_predict.py\", line 69, in predict\n stderrraise Exception\n stderrException\n stderr"
}

now:

{
  "error": "",
  "logs": "Traceback (most recent call last):\n  File \"/home/sylv/r8/_cog/python/cog/server/worker.py\", line 240, in _handle_predict_error\n    yield\n  File \"/home/sylv/r8/_cog/python/cog/server/worker.py\", line 276, in _predict_async\n    async for r in result:\n  File \"/home/sylv/r8/_cog/python/test_predict.py\", line 69, in predict\n    raise Exception\nException\n"
}
{
  "error": "",
  "logs": "Traceback (most recent call last):\n  File \"/home/sylv/r8/_cog/python/cog/server/worker.py\", line 240, in _handle_predict_error\n    yield\n  File \"/home/sylv/r8/_cog/python/cog/server/worker.py\", line 276, in _predict_async\n    async for r in result:\n  File \"/home/sylv/r8/_cog/python/test_predict.py\", line 69, in predict\n    raise Exception\nException\n"
}

perhaps we should always use repr, though?

Signed-off-by: technillogue <[email protected]>
@technillogue technillogue requested review from a team and jakedahn June 11, 2024 19:29
@technillogue technillogue merged commit 42c6617 into async Jun 12, 2024
10 checks passed
@technillogue technillogue deleted the syl/log-traceback-properly branch June 12, 2024 16:47
technillogue added a commit that referenced this pull request Jun 19, 2024
* log traceback correctly 
* use repr(exception) instead of str(exception) if str(exception) is blank

---------

Signed-off-by: technillogue <[email protected]>
technillogue added a commit that referenced this pull request Jun 19, 2024
* log traceback correctly
* use repr(exception) instead of str(exception) if str(exception) is blank

---------

Signed-off-by: technillogue <[email protected]>
technillogue added a commit that referenced this pull request Jun 19, 2024
* log traceback correctly
* use repr(exception) instead of str(exception) if str(exception) is blank

---------

Signed-off-by: technillogue <[email protected]>
technillogue added a commit that referenced this pull request Jun 19, 2024
* log traceback correctly
* use repr(exception) instead of str(exception) if str(exception) is blank

---------

Signed-off-by: technillogue <[email protected]>
technillogue added a commit that referenced this pull request Jun 19, 2024
* log traceback correctly
* use repr(exception) instead of str(exception) if str(exception) is blank

---------

Signed-off-by: technillogue <[email protected]>
technillogue added a commit that referenced this pull request Jun 20, 2024
* log traceback correctly
* use repr(exception) instead of str(exception) if str(exception) is blank

---------

Signed-off-by: technillogue <[email protected]>
technillogue added a commit that referenced this pull request Jul 3, 2024
* log traceback correctly
* use repr(exception) instead of str(exception) if str(exception) is blank

---------

Signed-off-by: technillogue <[email protected]>
technillogue added a commit that referenced this pull request Jul 18, 2024
* log traceback correctly
* use repr(exception) instead of str(exception) if str(exception) is blank

---------

Signed-off-by: technillogue <[email protected]>
mattt pushed a commit that referenced this pull request Jul 18, 2024
* log traceback correctly
* use repr(exception) instead of str(exception) if str(exception) is blank

---------

Signed-off-by: technillogue <[email protected]>
mattt pushed a commit that referenced this pull request Jul 19, 2024
* log traceback correctly
* use repr(exception) instead of str(exception) if str(exception) is blank

---------

Signed-off-by: technillogue <[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