How to use the cgroupspy.interfaces.FlagFile function in cgroupspy

To help you get started, we’ve selected a few cgroupspy examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cloudsigma / cgroupspy / cgroupspy / controllers.py View on Github external
cpuset.mem_exclusive
    cpuset.mem_hardwall
    cpuset.memory_migrate
    cpuset.memory_pressure
    cpuset.memory_pressure_enabled
    cpuset.memory_spread_page
    cpuset.memory_spread_slab
    cpuset.mems
    cpuset.sched_load_balance
    cpuset.sched_relax_domain_level
    """

    cpus = CommaDashSetFile("cpuset.cpus")
    mems = CommaDashSetFile("cpuset.mems")

    cpu_exclusive = FlagFile("cpuset.cpu_exclusive")
    mem_exclusive = FlagFile("cpuset.mem_exclusive")
    mem_hardwall = FlagFile("cpuset.mem_hardwall")
    memory_migrate = FlagFile("cpuset.memory_migrate")
    memory_pressure = FlagFile("cpuset.memory_pressure")
    memory_pressure_enabled = FlagFile("cpuset.memory_pressure_enabled")
    memory_spread_page = FlagFile("cpuset.memory_spread_page")
    memory_spread_slab = FlagFile("cpuset.memory_spread_slab")
    sched_load_balance = FlagFile("cpuset.sched_load_balance")

    sched_relax_domain_level = IntegerFile("cpuset.sched_relax_domain_level")


class MemoryController(Controller):

    """
    Memory cGroup controller. Provides access to
github cloudsigma / cgroupspy / cgroupspy / controllers.py View on Github external
limit_in_bytes = IntegerFile("memory.limit_in_bytes")
    soft_limit_in_bytes = IntegerFile("memory.soft_limit_in_bytes")
    usage_in_bytes = IntegerFile("memory.usage_in_bytes")
    max_usage_in_bytes = IntegerFile("memory.max_usage_in_bytes")

    memsw_limit_in_bytes = IntegerFile("memory.memsw.limit_in_bytes")
    memsw_usage_in_bytes = IntegerFile("memory.memsw.usage_in_bytes")
    memsw_max_usage_in_bytes = IntegerFile("memory.memsw.max_usage_in_bytes")
    swappiness = IntegerFile("memory.swappiness")

    stat = DictFile("memory.stat", readonly=True)

    use_hierarchy = FlagFile("memory.use_hierarchy")
    force_empty = FlagFile("memory.force_empty")
    oom_control = FlagFile("memory.oom_control")

    move_charge_at_immigrate = BitFieldFile("memory.move_charge_at_immigrate")

    # Requires special file interface
    # numa_stat =

    # Requires eventfd handling - https://www.kernel.org/doc/Documentation/cgroups/memory.txt
    # pressure_level =


class DevicesController(Controller):
    """
    devices.allow
    devices.deny
    devices.list
    """
github cloudsigma / cgroupspy / cgroupspy / controllers.py View on Github external
import os
from cgroupspy.contenttypes import DeviceAccess, DeviceThrottle

from .interfaces import FlagFile, BitFieldFile, CommaDashSetFile, IntegerFile, SplitValueFile
from .interfaces import MultiLineIntegerFile, DictFile, IntegerListFile, TypedFile


class Controller(object):

    """
    Base controller. Provides access to general files, existing in all cgroups and means to get/set properties
    """

    tasks = MultiLineIntegerFile("tasks")
    procs = MultiLineIntegerFile("cgroup.procs")
    notify_on_release = FlagFile("notify_on_release")
    clone_children = FlagFile("cgroup.clone_children")

    def __init__(self, node):
        self.node = node

    def filepath(self, filename):
        """The full path to a file"""

        return os.path.join(self.node.full_path, filename)

    def get_property(self, filename):
        """Opens the file and reads the value"""

        with open(self.filepath(filename)) as f:
            return f.read().strip()
github cloudsigma / cgroupspy / cgroupspy / controllers.py View on Github external
cpuset.memory_spread_slab
    cpuset.mems
    cpuset.sched_load_balance
    cpuset.sched_relax_domain_level
    """

    cpus = CommaDashSetFile("cpuset.cpus")
    mems = CommaDashSetFile("cpuset.mems")

    cpu_exclusive = FlagFile("cpuset.cpu_exclusive")
    mem_exclusive = FlagFile("cpuset.mem_exclusive")
    mem_hardwall = FlagFile("cpuset.mem_hardwall")
    memory_migrate = FlagFile("cpuset.memory_migrate")
    memory_pressure = FlagFile("cpuset.memory_pressure")
    memory_pressure_enabled = FlagFile("cpuset.memory_pressure_enabled")
    memory_spread_page = FlagFile("cpuset.memory_spread_page")
    memory_spread_slab = FlagFile("cpuset.memory_spread_slab")
    sched_load_balance = FlagFile("cpuset.sched_load_balance")

    sched_relax_domain_level = IntegerFile("cpuset.sched_relax_domain_level")


class MemoryController(Controller):

    """
    Memory cGroup controller. Provides access to

    memory.failcnt
    memory.force_empty
    memory.limit_in_bytes
    memory.max_usage_in_bytes
    memory.memsw.failcnt
github cloudsigma / cgroupspy / cgroupspy / controllers.py View on Github external
memsw_failcnt = IntegerFile("memory.memsw.failcnt")

    limit_in_bytes = IntegerFile("memory.limit_in_bytes")
    soft_limit_in_bytes = IntegerFile("memory.soft_limit_in_bytes")
    usage_in_bytes = IntegerFile("memory.usage_in_bytes")
    max_usage_in_bytes = IntegerFile("memory.max_usage_in_bytes")

    memsw_limit_in_bytes = IntegerFile("memory.memsw.limit_in_bytes")
    memsw_usage_in_bytes = IntegerFile("memory.memsw.usage_in_bytes")
    memsw_max_usage_in_bytes = IntegerFile("memory.memsw.max_usage_in_bytes")
    swappiness = IntegerFile("memory.swappiness")

    stat = DictFile("memory.stat", readonly=True)

    use_hierarchy = FlagFile("memory.use_hierarchy")
    force_empty = FlagFile("memory.force_empty")
    oom_control = FlagFile("memory.oom_control")

    move_charge_at_immigrate = BitFieldFile("memory.move_charge_at_immigrate")

    # Requires special file interface
    # numa_stat =

    # Requires eventfd handling - https://www.kernel.org/doc/Documentation/cgroups/memory.txt
    # pressure_level =


class DevicesController(Controller):
    """
    devices.allow
    devices.deny
    devices.list
github cloudsigma / cgroupspy / cgroupspy / controllers.py View on Github external
cpuset.memory_migrate
    cpuset.memory_pressure
    cpuset.memory_pressure_enabled
    cpuset.memory_spread_page
    cpuset.memory_spread_slab
    cpuset.mems
    cpuset.sched_load_balance
    cpuset.sched_relax_domain_level
    """

    cpus = CommaDashSetFile("cpuset.cpus")
    mems = CommaDashSetFile("cpuset.mems")

    cpu_exclusive = FlagFile("cpuset.cpu_exclusive")
    mem_exclusive = FlagFile("cpuset.mem_exclusive")
    mem_hardwall = FlagFile("cpuset.mem_hardwall")
    memory_migrate = FlagFile("cpuset.memory_migrate")
    memory_pressure = FlagFile("cpuset.memory_pressure")
    memory_pressure_enabled = FlagFile("cpuset.memory_pressure_enabled")
    memory_spread_page = FlagFile("cpuset.memory_spread_page")
    memory_spread_slab = FlagFile("cpuset.memory_spread_slab")
    sched_load_balance = FlagFile("cpuset.sched_load_balance")

    sched_relax_domain_level = IntegerFile("cpuset.sched_relax_domain_level")


class MemoryController(Controller):

    """
    Memory cGroup controller. Provides access to

    memory.failcnt
github cloudsigma / cgroupspy / cgroupspy / controllers.py View on Github external
cpuset.memory_pressure
    cpuset.memory_pressure_enabled
    cpuset.memory_spread_page
    cpuset.memory_spread_slab
    cpuset.mems
    cpuset.sched_load_balance
    cpuset.sched_relax_domain_level
    """

    cpus = CommaDashSetFile("cpuset.cpus")
    mems = CommaDashSetFile("cpuset.mems")

    cpu_exclusive = FlagFile("cpuset.cpu_exclusive")
    mem_exclusive = FlagFile("cpuset.mem_exclusive")
    mem_hardwall = FlagFile("cpuset.mem_hardwall")
    memory_migrate = FlagFile("cpuset.memory_migrate")
    memory_pressure = FlagFile("cpuset.memory_pressure")
    memory_pressure_enabled = FlagFile("cpuset.memory_pressure_enabled")
    memory_spread_page = FlagFile("cpuset.memory_spread_page")
    memory_spread_slab = FlagFile("cpuset.memory_spread_slab")
    sched_load_balance = FlagFile("cpuset.sched_load_balance")

    sched_relax_domain_level = IntegerFile("cpuset.sched_relax_domain_level")


class MemoryController(Controller):

    """
    Memory cGroup controller. Provides access to

    memory.failcnt
    memory.force_empty
github cloudsigma / cgroupspy / cgroupspy / controllers.py View on Github external
cpuset.sched_load_balance
    cpuset.sched_relax_domain_level
    """

    cpus = CommaDashSetFile("cpuset.cpus")
    mems = CommaDashSetFile("cpuset.mems")

    cpu_exclusive = FlagFile("cpuset.cpu_exclusive")
    mem_exclusive = FlagFile("cpuset.mem_exclusive")
    mem_hardwall = FlagFile("cpuset.mem_hardwall")
    memory_migrate = FlagFile("cpuset.memory_migrate")
    memory_pressure = FlagFile("cpuset.memory_pressure")
    memory_pressure_enabled = FlagFile("cpuset.memory_pressure_enabled")
    memory_spread_page = FlagFile("cpuset.memory_spread_page")
    memory_spread_slab = FlagFile("cpuset.memory_spread_slab")
    sched_load_balance = FlagFile("cpuset.sched_load_balance")

    sched_relax_domain_level = IntegerFile("cpuset.sched_relax_domain_level")


class MemoryController(Controller):

    """
    Memory cGroup controller. Provides access to

    memory.failcnt
    memory.force_empty
    memory.limit_in_bytes
    memory.max_usage_in_bytes
    memory.memsw.failcnt
    memory.memsw.limit_in_bytes
    memory.memsw.max_usage_in_bytes
github cloudsigma / cgroupspy / cgroupspy / controllers.py View on Github external
cpuset.memory_spread_page
    cpuset.memory_spread_slab
    cpuset.mems
    cpuset.sched_load_balance
    cpuset.sched_relax_domain_level
    """

    cpus = CommaDashSetFile("cpuset.cpus")
    mems = CommaDashSetFile("cpuset.mems")

    cpu_exclusive = FlagFile("cpuset.cpu_exclusive")
    mem_exclusive = FlagFile("cpuset.mem_exclusive")
    mem_hardwall = FlagFile("cpuset.mem_hardwall")
    memory_migrate = FlagFile("cpuset.memory_migrate")
    memory_pressure = FlagFile("cpuset.memory_pressure")
    memory_pressure_enabled = FlagFile("cpuset.memory_pressure_enabled")
    memory_spread_page = FlagFile("cpuset.memory_spread_page")
    memory_spread_slab = FlagFile("cpuset.memory_spread_slab")
    sched_load_balance = FlagFile("cpuset.sched_load_balance")

    sched_relax_domain_level = IntegerFile("cpuset.sched_relax_domain_level")


class MemoryController(Controller):

    """
    Memory cGroup controller. Provides access to

    memory.failcnt
    memory.force_empty
    memory.limit_in_bytes
    memory.max_usage_in_bytes
github cloudsigma / cgroupspy / cgroupspy / controllers.py View on Github external
failcnt = IntegerFile("memory.failcnt")
    memsw_failcnt = IntegerFile("memory.memsw.failcnt")

    limit_in_bytes = IntegerFile("memory.limit_in_bytes")
    soft_limit_in_bytes = IntegerFile("memory.soft_limit_in_bytes")
    usage_in_bytes = IntegerFile("memory.usage_in_bytes")
    max_usage_in_bytes = IntegerFile("memory.max_usage_in_bytes")

    memsw_limit_in_bytes = IntegerFile("memory.memsw.limit_in_bytes")
    memsw_usage_in_bytes = IntegerFile("memory.memsw.usage_in_bytes")
    memsw_max_usage_in_bytes = IntegerFile("memory.memsw.max_usage_in_bytes")
    swappiness = IntegerFile("memory.swappiness")

    stat = DictFile("memory.stat", readonly=True)

    use_hierarchy = FlagFile("memory.use_hierarchy")
    force_empty = FlagFile("memory.force_empty")
    oom_control = FlagFile("memory.oom_control")

    move_charge_at_immigrate = BitFieldFile("memory.move_charge_at_immigrate")

    # Requires special file interface
    # numa_stat =

    # Requires eventfd handling - https://www.kernel.org/doc/Documentation/cgroups/memory.txt
    # pressure_level =


class DevicesController(Controller):
    """
    devices.allow
    devices.deny