Skip to content

Commit de2db66

Browse files
committed
etl/webserver: support ETL pipeline handling in Go-based framework
Signed-off-by: Tony Chen <a122774007@gmail.com>
1 parent 2ca4149 commit de2db66

File tree

4 files changed

+228
-95
lines changed

4 files changed

+228
-95
lines changed

api/apc/headers.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,8 @@ const (
118118
HdrPromoteNamesNum = aisPrefix + "Promote-Names-Num"
119119

120120
// ETL
121-
HdrETLPodInfo = aisPrefix + "ETL-Pod-Info" // serialized etl.Info
121+
HdrETLPodInfo = aisPrefix + "ETL-Pod-Info" // serialized etl.Info
122+
HdrDirectPutLength = aisPrefix + "Direct-Put-Length"
122123

123124
// shared streams
124125
HdrActiveEC = aisPrefix + "Ec"

ext/etl/webserver/cmn.go

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,18 @@ import (
1010
"io"
1111
"net/http"
1212
"strconv"
13+
"strings"
1314

15+
"github.com/NVIDIA/aistore/api/apc"
1416
"github.com/NVIDIA/aistore/cmn/cos"
1517
)
1618

1719
const GetContentType = "binary/octet-stream"
1820

1921
func setResponseHeaders(header http.Header, size int64) {
20-
header.Set(cos.HdrContentLength, strconv.FormatInt(size, 10))
22+
if size > 0 {
23+
header.Set(cos.HdrContentLength, strconv.FormatInt(size, 10))
24+
}
2125
header.Set(cos.HdrContentType, GetContentType)
2226
}
2327

@@ -40,3 +44,24 @@ func wrapHTTPError(resp *http.Response, err error) (*http.Response, error) {
4044

4145
return resp, nil
4246
}
47+
48+
func parsePipelineURL(pipelineURLHdr string) (string, string) {
49+
pipelineURLHdr = strings.TrimSpace(pipelineURLHdr)
50+
if pipelineURLHdr == "" {
51+
return "", ""
52+
}
53+
pipelineURLs := strings.Split(pipelineURLHdr, apc.ETLPipelineSeparator)
54+
for _, pipelineURL := range pipelineURLs {
55+
pipelineURL = strings.TrimSpace(pipelineURL)
56+
if pipelineURL == "" {
57+
return "", ""
58+
}
59+
}
60+
commaIndex := strings.Index(pipelineURLHdr, apc.ETLPipelineSeparator)
61+
if commaIndex == -1 {
62+
// No comma found, only one URL (already validated)
63+
return pipelineURLHdr, ""
64+
}
65+
// Extract first URL and remaining pipeline
66+
return pipelineURLHdr[:commaIndex], pipelineURLHdr[commaIndex+1:]
67+
}

0 commit comments

Comments
 (0)