Hacked By AnonymousFox

Current Path : /usr/share/lve-stats/
Upload File :
Current File : //usr/share/lve-stats/lvestats-burstwatcher.py

# coding=utf-8
#
# Copyright © Cloud Linux GmbH & Cloud Linux Software, Inc 2010-2023 All Rights Reserved
#
# Licensed under CLOUD LINUX LICENSE AGREEMENT
# http://cloudlinux.com/docs/LICENSE.TXT
import os
import sys

from lvestats.burstwatcher.service import Service, logger
from lvestats.plugins.generic.burster.config import is_bursting_supported

BURSTABLE_LIMITS_FEATURE_FLAG_PATH = '/var/cloudlinux/flags/burstable-limits.flag'
EXIT_AND_NOT_RESTART_CODE = 74


def _check_system_supported():
    if not is_bursting_supported():
        logger.info('Bursting Limits feature is not supported in current environment')
        sys.exit(EXIT_AND_NOT_RESTART_CODE)


def _set_rt_priotity():
    sched_priority = os.sched_get_priority_min(os.SCHED_RR)
    param = os.sched_param(sched_priority)
    os.sched_setscheduler(0, os.SCHED_RR, param)
    logger.debug('Realt-time scheduling set with priority %d', sched_priority)


def main():
    _check_system_supported()
    _set_rt_priotity()
    srv = Service()
    srv.run()


if __name__ == '__main__':
    main()

Hacked By AnonymousFox1.0, Coded By AnonymousFox