-
Notifications
You must be signed in to change notification settings - Fork 141
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
action tracing for anomaly detection #1038
Merged
Merged
Conversation
This file contains 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
add trace fix
- sort by completed time (not start time) - display errors - display duration
jjallaire
approved these changes
Dec 23, 2024
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 PR introduces a new trace logging mode that is intended to detect actions which do not complete (and thus could be the cause of a run hanging). We'll be making significant enhancements to this soon (e.g. incorporating into the task UI) but the basic version implemented here is useful as a dianostic tool.
There are several things which may cause a task to not complete:
generate()
call to a model does not return.subprocess()
without a timeout does not return.Trace logs aim to detect these by writing logs for every evaluation that record the beginning and end of each action (as well as cancellations and errors). Trace logs for the last 10 evaluations are preserved.
If an evaluation is running and is not terminating, you can execute the following command to list instances of the above actions (e.g. generate, docker, tool calls, etc.) that are still running:
You first see currently running actions (useful mostly for a "live" evaluation). If you have already cancelled an evaluation you'll see a list of cancelled actions (with the most recently completed cancelled action on top) which will often also tell you which unterminated action was keeping an evaluation from completing.
There will also be a list of actions that ended in an error. Note that actions which are cancelled (e.g. due to timeouts) or have errors (e.g. due to model API errors) aren't necessarily a problem as some timeouts and error conditions naturally occur in evaluations. They are there for additional context but are not the central purpose of
inspect trace anomolies
(which is to detect actions that unexpectedly fail to terminate).You can also look at anomalies for a specific trace log (as opposed to the most recent one) as follows:
If you want to explore the trace files directly, you can list their paths with:
inspect trace list # --json for JSON output
Trace logs are in JSON lines, you can read them as a JSON array with:
inspect trace read trace.log