sandbox/utils.py
def specifications() -> dict:
    """Return the dictionary corresponding to the /specifications/ API endpoints."""
    _, freq_min, freq_max = psutil.cpu_freq()
    ram, swap = container_ram_swap()
    
    return {
        "host":      {
            "cpu":             {
                "core":     psutil.cpu_count(logical=False),
                "logical":  psutil.cpu_count(),
                "freq_min": freq_min,
                "freq_max": freq_max,
            },
            "memory":          {
                "ram":     psutil.virtual_memory()[0],
                "swap":    psutil.swap_memory()[0],
                "storage": {
                    p[0]: psutil.disk_usage(p[1])[0] for p in psutil.disk_partitions()
                }
            },
            "docker_version":  docker_version(),
            "sandbox_version": settings.SANDBOX_VERSION,
        },
        "container": {
            "count":              settings.DOCKER_COUNT,
            "cpu":                {
                "count":  container_cpu_count(),
                "period": settings.DOCKER_PARAMETERS.get("cpu_period", -1),
                "shares": settings.DOCKER_PARAMETERS.get("cpu_shares", -1),
                "quota":  settings.DOCKER_PARAMETERS.get("cpu_quota", -1)
            },
            "memory":             {
                "ram":     ram,
                "swap":    swap,
                "storage": container_storage_opt()
            },
            "io":                 {
                "read_iops":  settings.DOCKER_PARAMETERS.get("device_read_iops", {}),
                "read_bps":   settings.DOCKER_PARAMETERS.get("device_read_bps", {}),
                "write_iops": settings.DOCKER_PARAMETERS.get("device_write_iops", {}),
                "write_bps":  settings.DOCKER_PARAMETERS.get("device_write_bps", {})
            },
            "process":            settings.DOCKER_PARAMETERS.get("pids_limit", -1),
            "working_dir_device": container_workind_dir_device()
        }
    }
Return the dictionary corresponding to the /specifications/ API endpoints.
Return the dictionary corresponding to the /specifications/ API endpoints.
Return the dictionary corresponding to the / specifications / API endpoints .
def specifications() -> dict:
    _, freq_min, freq_max = psutil.cpu_freq()
    ram, swap = container_ram_swap()
    return {
        "host":      {
            "cpu":             {
                "core":     psutil.cpu_count(logical=False),
                "logical":  psutil.cpu_count(),
                "freq_min": freq_min,
                "freq_max": freq_max,
            },
            "memory":          {
                "ram":     psutil.virtual_memory()[0],
                "swap":    psutil.swap_memory()[0],
                "storage": {
                    p[0]: psutil.disk_usage(p[1])[0] for p in psutil.disk_partitions()
                }
            },
            "docker_version":  docker_version(),
            "sandbox_version": settings.SANDBOX_VERSION,
        },
        "container": {
            "count":              settings.DOCKER_COUNT,
            "cpu":                {
                "count":  container_cpu_count(),
                "period": settings.DOCKER_PARAMETERS.get("cpu_period", -1),
                "shares": settings.DOCKER_PARAMETERS.get("cpu_shares", -1),
                "quota":  settings.DOCKER_PARAMETERS.get("cpu_quota", -1)
            },
            "memory":             {
                "ram":     ram,
                "swap":    swap,
                "storage": container_storage_opt()
            },
            "io":                 {
                "read_iops":  settings.DOCKER_PARAMETERS.get("device_read_iops", {}),
                "read_bps":   settings.DOCKER_PARAMETERS.get("device_read_bps", {}),
                "write_iops": settings.DOCKER_PARAMETERS.get("device_write_iops", {}),
                "write_bps":  settings.DOCKER_PARAMETERS.get("device_write_bps", {})
            },
            "process":            settings.DOCKER_PARAMETERS.get("pids_limit", -1),
            "working_dir_device": container_workind_dir_device()
        }
    }
def specifications ( ) -> dict : _ , freq_min , freq_max = psutil . cpu_freq ( ) ram , swap = container_ram_swap ( ) return { "host" : { "cpu" : { "core" : psutil . cpu_count ( logical = False ) , "logical" : psutil . cpu_count ( ) , "freq_min" : freq_min , "freq_max" : freq_max , } , "memory" : { "ram" : psutil . virtual_memory ( ) [ 0 ] , "swap" : psutil . swap_memory ( ) [ 0 ] , "storage" : { p [ 0 ] : psutil . disk_usage ( p [ 1 ] ) [ 0 ] for p in psutil . disk_partitions ( ) } } , "docker_version" : docker_version ( ) , "sandbox_version" : settings . SANDBOX_VERSION , } , "container" : { "count" : settings . DOCKER_COUNT , "cpu" : { "count" : container_cpu_count ( ) , "period" : settings . DOCKER_PARAMETERS . get ( "cpu_period" , - 1 ) , "shares" : settings . DOCKER_PARAMETERS . get ( "cpu_shares" , - 1 ) , "quota" : settings . DOCKER_PARAMETERS . get ( "cpu_quota" , - 1 ) } , "memory" : { "ram" : ram , "swap" : swap , "storage" : container_storage_opt ( ) } , "io" : { "read_iops" : settings . DOCKER_PARAMETERS . get ( "device_read_iops" , { } ) , "read_bps" : settings . DOCKER_PARAMETERS . get ( "device_read_bps" , { } ) , "write_iops" : settings . DOCKER_PARAMETERS . get ( "device_write_iops" , { } ) , "write_bps" : settings . DOCKER_PARAMETERS . get ( "device_write_bps" , { } ) } , "process" : settings . DOCKER_PARAMETERS . get ( "pids_limit" , - 1 ) , "working_dir_device" : container_workind_dir_device ( ) } }
Return the dictionary corresponding to the /specifications/ API endpoints.
Return the dictionary corresponding to the / specifications / API endpoints .
"""Return the dictionary corresponding to the /specifications/ API endpoints."""