fix(worker): disabled memory limit

rsync memory is nolonger limited
This commit is contained in:
bigeagle 2016-12-09 23:07:05 +08:00
parent 81a15e7dd1
commit 21c832c8fb
2 changed files with 14 additions and 15 deletions

View File

@ -52,15 +52,15 @@ func (c *cgroupHook) preExec() error {
if err := sh.Command("cgcreate", "-g", c.Cgroup()).Run(); err != nil {
return err
}
if cgSubsystem != "memory" {
return nil
}
if c.provider.Type() == provRsync || c.provider.Type() == provTwoStageRsync {
gname := fmt.Sprintf("%s/%s", c.baseGroup, c.provider.Name())
return sh.Command(
"cgset", "-r", "memory.limit_in_bytes=512M", gname,
).Run()
}
// if cgSubsystem != "memory" {
// return nil
// }
// if c.provider.Type() == provRsync || c.provider.Type() == provTwoStageRsync {
// gname := fmt.Sprintf("%s/%s", c.baseGroup, c.provider.Name())
// return sh.Command(
// "cgset", "-r", "memory.limit_in_bytes=512M", gname,
// ).Run()
// }
return nil
}

View File

@ -4,7 +4,6 @@ import (
"io/ioutil"
"os"
"path/filepath"
"strconv"
"strings"
"testing"
"time"
@ -134,11 +133,11 @@ sleep 30
provider.AddHook(cg)
cg.preExec()
if cgSubsystem == "memory" {
memoLimit, err := ioutil.ReadFile(filepath.Join(cg.basePath, "memory", cg.baseGroup, provider.Name(), "memory.limit_in_bytes"))
So(err, ShouldBeNil)
So(strings.Trim(string(memoLimit), "\n"), ShouldEqual, strconv.Itoa(512*1024*1024))
}
//if cgSubsystem == "memory" {
// memoLimit, err := ioutil.ReadFile(filepath.Join(cg.basePath, "memory", cg.baseGroup, provider.Name(), "memory.limit_in_bytes"))
// So(err, ShouldBeNil)
// So(strings.Trim(string(memoLimit), "\n"), ShouldEqual, strconv.Itoa(512*1024*1024))
//}
cg.postExec()
})
}