Skip to content

Commit

Permalink
[log-classifier] Handle None value when getting a log line (#4722)
Browse files Browse the repository at this point in the history
Log classifier fails on this job
https://github.com/pytorch/pytorch/actions/runs/6618894647/job/17986337626.
The issue can be reproduced by running, which ends up with an `Internal
Server Error` error:

```
curl "https://vwg52br27lx5oymv4ouejwf4re0akoeg.lambda-url.us-east-1.on.aws/?job_id=17986337626"
```

It turns out that `log.lines.get(&i)` can be None while gathering the
failure context. This change handles the None value correctly.
  • Loading branch information
huydhn authored Nov 11, 2023
1 parent f7ed2ba commit 90cea6d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion aws/lambda/log-classifier/fixtures/request.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"version": "2.0",
"routeKey": "$default",
"rawPath": "/",
"rawQueryString": "job_id=17764650210&repo=pytorch%2Fpytorch",
"rawQueryString": "job_id=17986337626&repo=pytorch%2Fpytorch",
"headers": {
"accept": "*/*",
"content-length": "0",
Expand Down
7 changes: 4 additions & 3 deletions aws/lambda/log-classifier/src/rule_match.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,10 @@ impl SerializedMatch {
break;
}

let l = log.lines.get(&i).unwrap();
if l.starts_with("+") {
context.push(l.clone());
if let Some(l) = log.lines.get(&i) {
if l.starts_with("+") {
context.push(l.clone());
}
}
}

Expand Down

0 comments on commit 90cea6d

Please sign in to comment.