Skip to content

Commit

Permalink
deal with issue 1476
Browse files Browse the repository at this point in the history
  • Loading branch information
wangxu committed Mar 2, 2022
1 parent f9fe419 commit 8015fda
Showing 1 changed file with 2 additions and 15 deletions.
17 changes: 2 additions & 15 deletions pkg/ddc/alluxio/operations/cached.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,26 +61,13 @@ func (a AlluxioFileUtils) CachedState() (cached int64, err error) {
// clean cache with a preset timeout of 60s
func (a AlluxioFileUtils) CleanCache(path string) (err error) {
var (
releaseVersion = []string{"cat", "/etc/issue"}
command = []string{"60", "alluxio", "fs", "free", "-f", path}
stdout string
stderr string
)

stdout, stderr, err = a.exec(releaseVersion, false)
if err != nil {
err = fmt.Errorf("execute command %v with expectedErr: %v stdout %s and stderr %s", releaseVersion, err, stdout, stderr)
return
}

if strings.Contains(stdout, "Ubuntu") {
command = append([]string{"timeout"}, command...)
} else if strings.Contains(stdout, "Alpine") {
command = append([]string{"timeout", "-t"}, command...)
} else {
err = fmt.Errorf("unknow release version for linux")
return
}
//TODO : find solution to use "timeout" or "timeout -t" in different linux release
command = append([]string{"timeout"}, command...)

stdout, stderr, err = a.exec(command, false)
if err != nil {
Expand Down

0 comments on commit 8015fda

Please sign in to comment.