from celery import shared_task import subprocess @shared_task def restart_bot_container(container_name="bot"): try: result = subprocess.run( ["docker", "restart", container_name], stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True, check=True ) return f"Success: {result.stdout.strip()}" except subprocess.CalledProcessError as e: return f"Error restarting container: {e.stderr.strip()}" @shared_task def ping(): return "pong"