<commit_before>#!/usr/bin/python

import subprocess
import os
import json

class VolumeManager:
    def __init__(self, base_cmdline, mount_root):
        self.base_cmdline = base_cmdline
        self.mount_root = mount_root

    def start_server(self, pidfile, cmdline):
        start_cmdline = ["start-stop-daemon", "-S", "-b", "-m", "-p", pidfile,
                        "--exec"] + self.base_cmdline + ["--"] + cmdline
        subprocess.check_call(start_cmdline)

    def stop_server(self, pidfile):
        stop_cmdline = ["start-stop-daemon", "-K", "-p", pidfile, "-x"] + self.base_cmdline
        return subprocess.call(stop_cmdline)

    def check_server(self, pidfile):
        check_cmdline = ["start-stop-daemon", "-T", "-p", pidfile]
        return subprocess.call(check_cmdline)

    def start_server_container(self, name, cfg_root, file_root, container, cmdline):
        start_cmdline = ["docker", "run", "--privileged",
                        "--name", name, "-d",
                        "-v", "/etc/ssl/certs:/etc/ssl/certs",
                        "-v", os.path.expanduser("~") + "/.aws:/root/.aws",
                        "-v", "/dev:/host/dev",
                        "-v", "/proc:/host/proc",
                        "-v", cfg_root + ":" + cfg_root,
                        "-v", file_root + ":" + file_root,
                        container,
                        ] + cmdline
        return subprocess.check_call(start_cmdline)

    def stop_server_container(self, name):
        stop_cmdline = ["docker", "rm", "-fv", name]
        return subprocess.check_call(stop_cmdline)

    def check_server_container(self, name):
        check_cmdline = ["docker", "inspect", "-f", "{{.State.Running}}", name]
        output = subprocess.check_output(check_cmdline)
        return output.startswith("true")
 
    def server_info(self):
        return subprocess.check_output(self.base_cmdline + ["info"])

    def create_volume(self, size = "", name = "", backup = "", driver = "",
                    volume_id = "", volume_type = "", iops = "", forvm = False):
        cmd = ["create"]<commit_msg>Use human-readable flag names for start-stop-daemon<commit_after>#!/usr/bin/python

import subprocess
import os
import json

class VolumeManager:
    def __init__(self, base_cmdline, mount_root):
        self.base_cmdline = base_cmdline
        self.mount_root = mount_root

    def start_server(self, pidfile, cmdline):
        start_cmdline = ["start-stop-daemon", "--start", "--background",
                        "--make-pidfile", "--pidfile", pidfile,
                        "--exec"] + self.base_cmdline + ["--"] + cmdline
        subprocess.check_call(start_cmdline)

    def stop_server(self, pidfile):
        stop_cmdline = ["start-stop-daemon", "--stop", "--pidfile", pidfile, "--exec"] + self.base_cmdline
        return subprocess.call(stop_cmdline)

    def check_server(self, pidfile):
        check_cmdline = ["start-stop-daemon", "--status", "--pidfile", pidfile]
        return subprocess.call(check_cmdline)

    def start_server_container(self, name, cfg_root, file_root, container, cmdline):
        start_cmdline = ["docker", "run", "--privileged",
                        "--name", name, "-d",
                        "-v", "/etc/ssl/certs:/etc/ssl/certs",
                        "-v", os.path.expanduser("~") + "/.aws:/root/.aws",
                        "-v", "/dev:/host/dev",
                        "-v", "/proc:/host/proc",
                        "-v", cfg_root + ":" + cfg_root,
                        "-v", file_root + ":" + file_root,
                        container,
                        ] + cmdline
        return subprocess.check_call(start_cmdline)

    def stop_server_container(self, name):
        stop_cmdline = ["docker", "rm", "-fv", name]
        return subprocess.check_call(stop_cmdline)

    def check_server_container(self, name):
        check_cmdline = ["docker", "inspect", "-f", "{{.State.Running}}", name]
        output = subprocess.check_output(check_cmdline)
        return output.startswith("true")
 
    def server_info(self):
        return subprocess.check_output(self.base_cmdline + ["info"])

    def create_volume(self, size = "", name = "", backup = "", driver = "",
                    volume_id = "", volume_type = "", iops = "", forvm = False):
        cmd = ["create"]
{'fraction_non_alphanumeric': 0.15689418231791114, 'fraction_numerical': 0.0, 'mean_word_length': 2.117059243397573, 'pattern_counts': {'":': 4, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '93854', 'n_tokens_mistral': 1337, 'n_tokens_neox': 1276, 'n_words': 260}