Skip to content

Commit

Permalink
feature(job): detect connection problems on job submission
Browse files Browse the repository at this point in the history
  • Loading branch information
grandcat committed Mar 15, 2017
1 parent 29ccc92 commit 9e69c2b
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions orchestration/worker/job.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,16 +268,21 @@ func (j *job) queryTargetsSync(ctx context.Context, cmd *pbJob.SMCCmd) ([]*pbJob
// Profile execution time if activated.
defer statistics.G(1).End(cmd.GetPayload(), statistics.StartTrack())

var accumulatedErrFlags pbJob.CmdResult_Status
var errPeers []*directory.PeerInfo

// First, disseminate the job to all peers.
// Then, collect all results, but expect the results to be there until timeout occurs.
for _, pch := range j.chats {
pch.Instruct(cmd)
err := pch.Instruct(ctx, cmd)
if err != nil {
accumulatedErrFlags |= pbJob.CmdResult_STREAM_ERR
errPeers = append(errPeers, pch.Peer())
}
}
// Receive
// Each peer delivers its response independently from each other. If one peer blocks,
// there is still the result of all other peers after the timeout occurs.
var accumulatedErrFlags pbJob.CmdResult_Status
var errPeers []*directory.PeerInfo
resps := make([]*pbJob.CmdResult, 0, len(j.chats))
for _, pch := range j.chats {
resp, commErr := pullRespUntilDone(ctx, pch.GetFeedback())
Expand Down

0 comments on commit 9e69c2b

Please sign in to comment.