Skip to content

Commit

Permalink
Update lxc_autoscale.py
Browse files Browse the repository at this point in the history
  • Loading branch information
fabriziosalmi authored Aug 31, 2024
1 parent 51826b4 commit 922ca91
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions lxc_autoscale/lxc_autoscale.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from config import config

import paramiko
# Importing necessary modules and functions
from config import get_config_value, LOG_FILE, DEFAULTS, BACKUP_DIR, PROXMOX_HOSTNAME, IGNORE_LXC # Importing configuration constants and utility functions
from logging_setup import setup_logging # Importing the logging setup function
Expand All @@ -18,40 +18,40 @@ def parse_arguments():
argparse.Namespace: The parsed arguments with options for poll interval, energy mode, and rollback.
"""
parser = argparse.ArgumentParser(description="LXC Resource Management Daemon")

# Polling interval argument
parser.add_argument(
"--poll_interval",
type=int,
default=DEFAULTS.get('poll_interval', 300),
help="Polling interval in seconds" # How often the main loop should run
)

# Energy mode argument for off-peak hours
parser.add_argument(
"--energy_mode",
action="store_true",
default=DEFAULTS.get('energy_mode', False),
help="Enable energy efficiency mode during off-peak hours" # Reduces resource allocation during low-usage periods
)

# Rollback argument to revert container configurations
parser.add_argument(
"--rollback",
action="store_true",
help="Rollback to previous container configurations" # Option to revert containers to their backed-up settings
)

return parser.parse_args()

# Entry point of the script
if __name__ == "__main__":
# Parse command-line arguments
args = parse_arguments()

# Setup logging based on the configuration
setup_logging()

# Acquire a lock to ensure that only one instance of the script runs at a time
with acquire_lock() as lock_file:
try:
Expand Down

0 comments on commit 922ca91

Please sign in to comment.