-
Notifications
You must be signed in to change notification settings - Fork 20
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
fix: Handle accept result and download result errors #416
Conversation
34eb0a9
to
f46c781
Compare
// we have already downloaded. Check the download path and download | ||
// if results do not exist. | ||
downloadPath := solver.GetDownloadsFilePath(dealContainer.ID) | ||
if _, err := os.Stat(downloadPath); errors.Is(err, fs.ErrNotExist) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Common advice online recommends using os.IsNotExist
, but the docs for this function recommend that new code should use errors.Is(err, fs.ErrNotExist)
: https://pkg.go.dev/os#IsNotExist
If the path exists, we have already attempted to download the results.
f46c781
to
7124b34
Compare
The unbuffered error channel blocks on the receiver which does not get set up in time. The buffered channel will hold the message until the receiver is available.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚢
@@ -161,7 +164,7 @@ func (controller *JobCreatorController) subscribeToWeb3() error { | |||
} | |||
|
|||
func (controller *JobCreatorController) Start(ctx context.Context, cm *system.CleanupManager) chan error { | |||
errorChan := make(chan error) | |||
errorChan := make(chan error, 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great catch on this! 🙏
* fix: Add accept result error handling * fix: Add download result error handling * fix: Check download path before downloading If the path exists, we have already attempted to download the results. * fix: Unblock error channel The unbuffered error channel blocks on the receiver which does not get set up in time. The buffered channel will hold the message until the receiver is available.
Summary
This pull request makes the following changes:
acceptResult
errorsdownloadResult
errorsWe would like to handle these errors to avoid silently failing when running jobs from the CLI. Error reporting also supports observing this information in traces.
The unbuffered error channel blocks on the receiver which does not get set up before the send. The buffered channel will hold the message until the receiver is available to receive the message.
Task/Issue reference
Closes: #414
Test plan
Run a few jobs. Check that everything still works.
Running more than one job exercises the download check. If we attempt to download again, we would observe a
file exists
error.To test the error cases, return a temporary error from the
downloadResult
andacceptResult
functions.Details (optional)
The new downloads check determines if we have already downloaded the results for a job. If the download path already exists, we skip the download. This check is necessary because our control loop checks for any completed deals and re-downloads the results. The solver may report completed deals for jobs whose results we already have.