-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Error running 1000s of tasks: "etcdserver: request is too large" #1186 (
#1264) * Error running 1000s of tasks: "etcdserver: request is too large" #1186 This PR is addressing the feature request #1186. Issue: Nodestatus element keeps growing for big workflow. Workflow will fail once the workflow total size reachs 1 MB (maz size limit in ETCD) . Solution: Compressing the Nodestatus once size reachs the 1 MB which increasing 60% to 80% more steps to execute in compress mode. Latest: Argo cli and Argo UI will able to decode and print nodestatus from compressednoode. Limitation: Kubectl willl not decode the compressedNode element * added Operator.go * revert the testing yaml * Fixed the lint issue * fixed * fixed lint * Fixed Testcase * incorporated the review comments * Reverted the change * incorporated review comments * fixing gometalinter checks * incorporated review comments * Update pod-limits.yaml * updated few comments * updated error message format * reverted unwanted files
- Loading branch information
1 parent
b2743f3
commit 4bfbb20
Showing
11 changed files
with
264 additions
and
58 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
package file | ||
|
||
import ( | ||
"archive/tar" | ||
"bytes" | ||
"compress/gzip" | ||
"encoding/base64" | ||
"io" | ||
"io/ioutil" | ||
"os" | ||
"strings" | ||
|
||
log "github.com/sirupsen/logrus" | ||
) | ||
|
||
// IsFileOrDirExistInGZip return true if file or directory exists in GZip file | ||
func IsFileOrDirExistInGZip(sourcePath string, gzipFilePath string) bool { | ||
|
||
fi, err := os.Open(gzipFilePath) | ||
|
||
if os.IsNotExist(err) { | ||
return false | ||
} | ||
defer close(fi) | ||
|
||
fz, err := gzip.NewReader(fi) | ||
if err != nil { | ||
return false | ||
} | ||
tr := tar.NewReader(fz) | ||
for { | ||
hdr, err := tr.Next() | ||
if err == io.EOF { | ||
break | ||
} | ||
if err != nil { | ||
|
||
return false | ||
} | ||
if hdr.FileInfo().IsDir() && strings.Contains(strings.Trim(hdr.Name, "/"), strings.Trim(sourcePath, "/")) { | ||
return true | ||
} | ||
if strings.Contains(sourcePath, hdr.Name) && hdr.Size > 0 { | ||
return true | ||
} | ||
} | ||
return false | ||
} | ||
|
||
//Close the file | ||
func close(f io.Closer) { | ||
err := f.Close() | ||
if err != nil { | ||
log.Warnf("Failed to close the file/writer/reader. %v", err) | ||
} | ||
} | ||
|
||
// CompressEncodeString will return the compressed string with base64 encoded | ||
func CompressEncodeString(content string) string { | ||
return base64.StdEncoding.EncodeToString(CompressContent([]byte(content))) | ||
} | ||
|
||
// DecodeDecompressString will return decode and decompress the | ||
func DecodeDecompressString(content string) (string, error) { | ||
|
||
buf, err := base64.StdEncoding.DecodeString(content) | ||
if err != nil { | ||
return "", err | ||
} | ||
dBuf, err := DecompressContent(buf) | ||
if err != nil { | ||
return "", err | ||
} | ||
return string(dBuf), nil | ||
} | ||
|
||
// CompressContent will compress the byte array using zip writer | ||
func CompressContent(content []byte) []byte { | ||
var buf bytes.Buffer | ||
zipWriter := gzip.NewWriter(&buf) | ||
|
||
_, err := zipWriter.Write(content) | ||
if err != nil { | ||
log.Warnf("Error in compressing: %v", err) | ||
} | ||
close(zipWriter) | ||
return buf.Bytes() | ||
} | ||
|
||
// DecompressContent will return the uncompressed content | ||
func DecompressContent(content []byte) ([]byte, error) { | ||
|
||
buf := bytes.NewReader(content) | ||
gZipReader, _ := gzip.NewReader(buf) | ||
defer close(gZipReader) | ||
return ioutil.ReadAll(gZipReader) | ||
} |
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,21 @@ | ||
package file | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
// TestResubmitWorkflowWithOnExit ensures we do not carry over the onExit node even if successful | ||
func TestCompressContentString(t *testing.T) { | ||
content := "{\"pod-limits-rrdm8-591645159\":{\"id\":\"pod-limits-rrdm8-591645159\",\"name\":\"pod-limits-rrdm8[0]." + | ||
"run-pod(0:0)\",\"displayName\":\"run-pod(0:0)\",\"type\":\"Pod\",\"templateName\":\"run-pod\",\"phase\":" + | ||
"\"Succeeded\",\"boundaryID\":\"pod-limits-rrdm8\",\"startedAt\":\"2019-03-07T19:14:50Z\",\"finishedAt\":" + | ||
"\"2019-03-07T19:14:55Z\"}}" | ||
|
||
compString := CompressEncodeString(content) | ||
|
||
resultString, _ := DecodeDecompressString(compString) | ||
|
||
assert.Equal(t, content, resultString) | ||
} |
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
Oops, something went wrong.