관리-도구
편집 파일: cl_packages_arg_parse.cpython-311.pyc
� �EBgT � � � d dl mZm Z d dlmZmZmZmZmZ d dlm Z d dl mZ dZdZ dZdZd � � � Zd � � � Zd� � � ZdZd � Zd� Zee eed� d�� � ede� � ede� � ede� � eded�� � ede� � eed� Ze ede� � ede� � ede� � ede� � ede� � ede� � ede� � ed e ee� � d� � � d�� � ed e ee� � d� � � d�� � d� z Zdd�ZdS )� )� DocoptExit�docopt)�Schema�And�Or�Use�SchemaError)�is_panel_feature_supported)�Featurezcloudlinux-packages)zw[get] [--json] [--provider <str> | --for-reseller <str>] [--package <str>] [--limits=<keys>] [--human-readable-numbers])z@set [--json] (--provider <str> --package <str>) [--inodes <N,M>]zDset [--json] (--for-reseller <str> --package <str>) [--inodes <N,M>])z�set [--json] (--provider <str> --package <str>) [--speed <str> --pmem <str> --vmem <str> --nproc <str> --maxEntryProcs <str> --io <str> --iops <str> --inodes <N,M> --mysql-cpu <int> --mysql-io <int>]z�set [--json] (--for-reseller <str> --package <str>) [--speed <str> --pmem <str> --vmem <str> --nproc <str> --maxEntryProcs <str> --io <str> --iops <str> --inodes <N,M>]zF Usage: {get_usage} {set_usage} {prog_name} (-h | --help) a� --speed <str> Limit CPU usage for LVE. --pmem <str> Limit physical memory usage for applications inside LVE. --vmem <str> Limit virtual memory for applications inside LVE. --nproc <str> Limit number of processes for LVE. --maxEntryProcs <str> Limit number of entry processes for LVE. --io <str> Define io limits for LVE (KB/s). --iops <str> Limit io per second for LVE. --mysql-cpu <int> Set MySQL governor CPU limit (pct). --mysql-io <int> Set MySQL governor IO limit (read + write MB/s) a% Options: --json Return data in JSON format. --provider <str> Show data only for specific reseller. --for-reseller <str> Show data only for specific reseller. --package <str> Show data only for specific package. Use only with --provider WARNING: package name must be unicode-escaped string --limits <keys> Available keys: speed, nproc, pmem, vmem, maxEntryProcs, io, iops, inodes --human-readable-numbers Return PMEM and VMEM limits in KBytes, MBytes or GBytes {limit_options} --inodes <N,M> Set inode limits. N - soft, M - hard. -h, --help Show this help message and exit zEUtility to get/set any Cloudlinux package limits {usage} {options} c �� � dg}t t j � � r|g d�z }t t | � d� � � � t |� � z � � dk S )z Validate limits keys �inodes) �speed�nproc�pmem�vmem� maxEntryProcs�io�iopsz mysql-cpuzmysql-io�,r )r r �LVE�len�set�split)�keys�avialable_keys_lists �&py/clpackages/cl_packages_arg_parse.py�_limits_keys_validater P sm � � $�*��!�'�+�.�.� �� � � � �� �s�4�:�:�c�?�?�#�#�c�*=�&>�&>�>�?�?�1�D�D� c �d � d� d� | D � � � � � � � S )z Get usage for commands z c 3 � K � | ] }d |� �V � � dS )z{prog_name} N� )�.0�cmds r � <genexpr>z/_get_commands_usage_template.<locals>.<genexpr>a s+ � � � �D�D�C�/�#�/�/�D�D�D�D�D�Dr )�join�strip)�commandss r �_get_commands_usage_templater( ] s1 � � �=�=�D�D�8�D�D�D�D�D�J�J�L�L�Lr c � � | S )Nr! ��xs r �<lambda>r, g s � �!� r z4use --json option, other modes currently unsupported)�errorNzInvalid keys) �getr z--json� --provider�--for-resellerz --packagez--limitsz--inodesz--helpz--human-readable-numbersc � � | dk S �Nr r! r* s r r, r, y s � �A��F� r z.--mysql-cpu must be non-negative integer valuec � � | dk S r2 r! r* s r r, r, { s � �1��6� r z---mysql-io must be non-negative integer value) z--speedz--pmemz--vmemz--nprocz--maxEntryProcsz--ioz--iopsz--mysql-cpuz --mysql-ioFc �P � t � t � t t � � t t t j � � rt nt � � t �� � t � t t j � � rt nd�� � �� � � t �� � } t || � � }n # t $ r d}|s|d|z z }d|fcY S w xY w|d s |d sd|d <