Skip to content

Commit

Permalink
Better logging for output-only problems.
Browse files Browse the repository at this point in the history
  • Loading branch information
lhchavez committed May 7, 2019
1 parent fbdb74a commit 6c4e301
Showing 1 changed file with 19 additions and 5 deletions.
24 changes: 19 additions & 5 deletions runner/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -783,8 +783,9 @@ func Grade(
if file, ok := outputOnlyFiles[outName]; ok {
if err := ioutil.WriteFile(outPath, []byte(file.contents), 0644); err != nil {
ctx.Log.Error(
"failed to run",
"failed to write output file contents",
"case", caseData.Name,
"path", outPath,
"err", err,
)
}
Expand All @@ -796,14 +797,23 @@ func Grade(
}
if err := ioutil.WriteFile(metaPath, []byte("status:0"), 0644); err != nil {
ctx.Log.Error(
"failed to run "+caseData.Name,
"failed to write meta file",
"case", caseData.Name,
"path", metaPath,
"err", err,
)
}
} else {
ctx.Log.Error(
"missing an output file",
"case", caseData.Name,
"path", outPath,
)
if err := ioutil.WriteFile(outPath, []byte{}, 0644); err != nil {
ctx.Log.Error(
"failed to run "+caseData.Name,
"failed to write output file",
"case", caseData.Name,
"path", outPath,
"err", err,
)
}
Expand All @@ -812,15 +822,19 @@ func Grade(
}
if err := ioutil.WriteFile(metaPath, []byte("status:1"), 0644); err != nil {
ctx.Log.Error(
"failed to run "+caseData.Name,
"failed to write meta file",
"case", caseData.Name,
"path", metaPath,
"err", err,
)
}
}
errPath := path.Join(runRoot, errName)
if err := ioutil.WriteFile(errPath, []byte{}, 0644); err != nil {
ctx.Log.Error(
"failed to run "+caseData.Name,
"failed to write err file",
"case", caseData.Name,
"path", metaPath,
"err", err,
)
}
Expand Down

0 comments on commit 6c4e301

Please sign in to comment.