-
Notifications
You must be signed in to change notification settings - Fork 173
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
dsort: remove dsort-context, rewrite initialization
* cleanup and simplify * rm unit tests * part fifteen, prev. commit: 393c709 Signed-off-by: Alex Aizman <[email protected]>
- Loading branch information
1 parent
393c709
commit feebeae
Showing
26 changed files
with
240 additions
and
1,195 deletions.
There are no files selected for viewing
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
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
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
// Package dsort provides distributed massively parallel resharding for very large datasets. | ||
/* | ||
* Copyright (c) 2018-2023, NVIDIA CORPORATION. All rights reserved. | ||
*/ | ||
package dsort | ||
|
||
import ( | ||
"io" | ||
"net/http" | ||
"net/url" | ||
"sync" | ||
|
||
"github.com/NVIDIA/aistore/cluster/meta" | ||
"github.com/NVIDIA/aistore/cmn" | ||
"github.com/NVIDIA/aistore/cmn/cos" | ||
) | ||
|
||
// | ||
// common code used by proxy _and_ target, both | ||
// | ||
|
||
var bcastClient *http.Client | ||
|
||
func bcast(method, path string, urlParams url.Values, body []byte, smap *meta.Smap, ignore ...*meta.Snode) []response { | ||
var ( | ||
idx int | ||
responses = make([]response, smap.CountActiveTs()) | ||
wg = &sync.WaitGroup{} | ||
) | ||
outer: | ||
for _, node := range smap.Tmap { | ||
if smap.InMaintOrDecomm(node) { | ||
continue | ||
} | ||
for _, ignoreNode := range ignore { | ||
if ignoreNode.Equals(node) { | ||
continue outer | ||
} | ||
} | ||
reqArgs := cmn.HreqArgs{ | ||
Method: method, | ||
Base: node.URL(cmn.NetIntraControl), | ||
Path: path, | ||
Query: urlParams, | ||
Body: body, | ||
} | ||
wg.Add(1) | ||
go func(si *meta.Snode, args *cmn.HreqArgs, i int) { | ||
responses[i] = call(args) | ||
responses[i].si = si | ||
wg.Done() | ||
}(node, &reqArgs, idx) | ||
idx++ | ||
} | ||
wg.Wait() | ||
|
||
return responses[:idx] | ||
} | ||
|
||
func call(reqArgs *cmn.HreqArgs) response { | ||
req, err := reqArgs.Req() | ||
if err != nil { | ||
return response{err: err, statusCode: http.StatusInternalServerError} | ||
} | ||
|
||
resp, err := bcastClient.Do(req) //nolint:bodyclose // Closed inside `cos.Close`. | ||
if err != nil { | ||
return response{err: err, statusCode: http.StatusInternalServerError} | ||
} | ||
out, err := io.ReadAll(resp.Body) | ||
cos.Close(resp.Body) | ||
return response{res: out, err: err, statusCode: resp.StatusCode} | ||
} |
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
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
Oops, something went wrong.