2016-02-02 22:36:11 +00:00
|
|
|
// +build !linux
|
|
|
|
|
2016-02-05 00:03:17 +00:00
|
|
|
package executor
|
2016-02-02 22:36:11 +00:00
|
|
|
|
2016-04-28 23:06:01 +00:00
|
|
|
import (
|
2016-05-25 21:58:32 +00:00
|
|
|
"os"
|
|
|
|
|
2016-04-28 23:06:01 +00:00
|
|
|
cstructs "github.com/hashicorp/nomad/client/driver/structs"
|
2016-05-25 21:58:32 +00:00
|
|
|
|
|
|
|
"github.com/mitchellh/go-ps"
|
2016-04-28 23:06:01 +00:00
|
|
|
cgroupConfig "github.com/opencontainers/runc/libcontainer/configs"
|
|
|
|
)
|
2016-03-16 02:22:40 +00:00
|
|
|
|
2016-02-04 00:03:43 +00:00
|
|
|
func (e *UniversalExecutor) configureChroot() error {
|
|
|
|
return nil
|
2016-02-02 22:36:11 +00:00
|
|
|
}
|
|
|
|
|
2016-04-19 00:20:11 +00:00
|
|
|
func DestroyCgroup(groups *cgroupConfig.Cgroup, paths map[string]string, executorPid int) error {
|
2016-02-04 00:03:43 +00:00
|
|
|
return nil
|
2016-02-02 22:36:11 +00:00
|
|
|
}
|
|
|
|
|
2016-02-04 00:03:43 +00:00
|
|
|
func (e *UniversalExecutor) removeChrootMounts() error {
|
|
|
|
return nil
|
2016-02-03 02:54:04 +00:00
|
|
|
}
|
|
|
|
|
2016-02-04 00:03:43 +00:00
|
|
|
func (e *UniversalExecutor) runAs(userid string) error {
|
|
|
|
return nil
|
2016-02-02 22:36:11 +00:00
|
|
|
}
|
|
|
|
|
2016-02-05 08:11:09 +00:00
|
|
|
func (e *UniversalExecutor) applyLimits(pid int) error {
|
2016-02-04 00:03:43 +00:00
|
|
|
return nil
|
2016-02-02 22:36:11 +00:00
|
|
|
}
|
|
|
|
|
2016-02-04 00:03:43 +00:00
|
|
|
func (e *UniversalExecutor) configureIsolation() error {
|
2016-02-03 02:54:04 +00:00
|
|
|
return nil
|
2016-02-02 22:36:11 +00:00
|
|
|
}
|
2016-04-28 23:06:01 +00:00
|
|
|
|
|
|
|
func (e *UniversalExecutor) Stats() (*cstructs.TaskResourceUsage, error) {
|
2016-05-26 00:46:24 +00:00
|
|
|
pidStats, err := e.pidStats()
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
2016-05-26 07:53:41 +00:00
|
|
|
return e.aggregatedResourceUsage(pidStats), nil
|
2016-05-11 19:56:47 +00:00
|
|
|
}
|
|
|
|
|
2016-05-25 05:54:32 +00:00
|
|
|
func (e *UniversalExecutor) getAllPids() ([]*nomadPid, error) {
|
2016-05-25 21:58:32 +00:00
|
|
|
allProcesses, err := ps.Processes()
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return e.scanPids(os.Getpid(), allProcesses)
|
2016-04-28 23:06:01 +00:00
|
|
|
}
|