WO2024021494A1 - 软件服务的处理方法、电子设备及存储介质 - Google Patents

软件服务的处理方法、电子设备及存储介质 Download PDF

Info

Publication number
WO2024021494A1
WO2024021494A1 PCT/CN2022/141864 CN2022141864W WO2024021494A1 WO 2024021494 A1 WO2024021494 A1 WO 2024021494A1 CN 2022141864 W CN2022141864 W CN 2022141864W WO 2024021494 A1 WO2024021494 A1 WO 2024021494A1
Authority
WO
WIPO (PCT)
Prior art keywords
status
state
target rpm
rpm package
list
Prior art date
Application number
PCT/CN2022/141864
Other languages
English (en)
French (fr)
Inventor
杨桃
王江勇
付广哲
姜少涛
李瑩
游益锋
Original Assignee
天翼云科技有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 天翼云科技有限公司 filed Critical 天翼云科技有限公司
Publication of WO2024021494A1 publication Critical patent/WO2024021494A1/zh

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/448Execution paradigms, e.g. implementations of programming paradigms
    • G06F9/4482Procedural
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/61Installation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/61Installation
    • G06F8/62Uninstallation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/4401Bootstrapping
    • G06F9/4418Suspend and resume; Hibernate and awake

Definitions

  • the invention relates to the technical field of Linux system software package management, and specifically relates to a software service processing method, electronic equipment and storage media.
  • Cloud computing is a service related to information technology, software, and the Internet.
  • the rapid development of cloud computing also requires strong infrastructure support, of which extremely important is the operating system that manages the cloud computing resource pool server hardware and service capabilities.
  • cloud computing operating systems are generally Linux operating systems such as RedHat and CentOS. This series of Linux operating systems all use the Red Hat software package manager (Red-Hat Package Manager (RPM for short), and provides Dnf/Yum front-end package manager for software service management.
  • RPM Red Hat software package manager
  • embodiments of the present invention provide a software service processing method, electronic device, and storage medium to solve the problem of service interruption caused by the processing of software services.
  • an embodiment of the present invention provides a software service processing method, including:
  • the target RPM package is processed based on the status of the service corresponding to the target RPM package, and the processing result of the target RPM package is determined.
  • the software service processing method provided by the embodiment of the present invention makes full use of the process running status data of the service corresponding to the RPM package, analyzes and determines the status of the service corresponding to the target RPM package, and provides the corresponding service status of the target RPM package when upgrading and uninstalling the RPM package. Accurate status determination, so that running services will not be accidentally interrupted when upgrading and uninstalling using RPM packages, ensuring data integrity and improving user experience.
  • reading the contents of the system file of the process to obtain the process status of the process includes:
  • the software service processing method provided by the embodiment of the present invention directly extracts the value of the process status field by analyzing the process status field of the process system file, thereby ensuring the accuracy of the determined process status.
  • querying the value of the process status field in the system file to determine the process status of the process includes:
  • the process status includes a sleep state, a running state, a zombie state, an uninterruptible sleep state or a stopped state;
  • the processes are classified based on the process status to obtain a process list, where the process list includes at least one process corresponding to the process status.
  • the software service processing method provided by the embodiment of the present invention reduces the complexity of subsequent process processing by classifying all processes according to the process status.
  • analyzing the process status and determining the status of the service corresponding to the target RPM package includes:
  • the software service processing method provided by the embodiment of the present invention calculates the dormancy duration of the process in the dormant state through the obtained service process status data, and then determines whether the process is actually in the dormant state within a period of time, so as to avoid placing the process in the dormant state temporarily.
  • the process is determined to be a process in a dormant state, which ensures the accuracy of the determined process status and improves the reliability of the determined status of the service corresponding to the target RPM package.
  • obtaining the sleep duration of the process in which the process state is in the sleep state includes:
  • the target process is a process whose process state is in the sleep state
  • the sleep duration is calculated using the start-up time point, the time point into the sleep state and the accumulated running time.
  • the processes corresponding to the process status are represented by a process list.
  • the process list includes a running process list, a dormant process list and a dead process list.
  • the running process list includes the processes whose process status is the running state.
  • the dormant process list includes processes whose process status is dormant state and uninterruptible dormant state
  • the dead process list includes processes whose process status is zombie state and stopped state
  • the process status based on the updated process Determine the status of the service corresponding to the target RPM package including:
  • the software service processing method provided by the embodiment of the present invention can, on the one hand, reduce the complexity of process analysis and improve the analysis efficiency by sequentially analyzing the running process list and the dormant process list, and on the other hand, ensure that the determined target RPM package The accuracy of the status of the corresponding service.
  • determining the status of the service corresponding to the target RPM package based on the process status of the updated process includes:
  • the process of obtaining the service corresponding to the target RPM package based on the executable program name includes:
  • the software service processing method provided by the embodiment of the present invention first obtains the main process, then uses the main process to obtain all sub-processes, and obtains all processes through the content of the system information file, ensuring that the obtained target RPM package corresponds to the service. Comprehensiveness and accuracy of the process.
  • an embodiment of the present invention provides a software service processing device, including:
  • the first acquisition module is used to acquire the target RPM package to determine the executable program name corresponding to the target RPM package;
  • the second acquisition module is used to acquire the process of the service corresponding to the target RPM package based on the name of the executable program
  • a reading module used to read the contents of the system file of the process to obtain the process status of the process
  • An analysis module used to analyze the process status and determine the status of the service corresponding to the target RPM package
  • a processing module configured to process the target RPM based on the status of the service corresponding to the target RPM package and determine the processing result of the target RPM package.
  • an embodiment of the present invention provides an electronic device, including: a memory and a processor, the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor By executing the computer instructions, the software service processing method described in the first aspect or any implementation manner of the first aspect is executed.
  • embodiments of the present invention provide a computer-readable storage medium that stores computer instructions, and the computer instructions are used to cause the computer to execute the first aspect or any of the first aspects.
  • Figure 1 is a flow chart of a software service processing method according to an embodiment of the present invention
  • Figure 2 is a flow chart of a software service processing method according to an embodiment of the present invention.
  • Figure 3 is a flow chart of a software service processing method according to an embodiment of the present invention.
  • Figure 4 is a structural block diagram of a software service processing device according to an embodiment of the present invention.
  • FIG. 5 is a schematic diagram of the hardware structure of an electronic device provided by an embodiment of the present invention.
  • the software services of the Linux operating system are processed in the form of RPM packages, such as installation, upgrade, uninstallation, etc.
  • the processing of software services can also be considered as the processing of RPM packages.
  • the running status of the software services contained in the RPM package is usually not concerned. Since software services on cloud computing platforms are generally 7 ⁇ 24 services, if the software service cannot accurately determine the running status of the service corresponding to the RPM package through effective technical means when it needs to be upgraded or uninstalled, it will It is likely to cause sudden interruption of running services, prone to system data inconsistency, risk of paralysis, and reduced user experience.
  • embodiments of the present invention provide a software service processing method.
  • the running status of the service corresponding to the target RPM package is first analyzed, and then the target RPM package is processed based on the analysis results. For example, before upgrading the target RPM package, first determine the running status of the service corresponding to the target RPM package. If there is an active service, it means that the target RPM package cannot be upgraded at this time, otherwise the active service will be Sudden interruption.
  • an embodiment of a software service processing method is provided. It should be noted that the steps shown in the flow chart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and, Although a logical sequence is shown in the flowcharts, in some cases the steps shown or described may be performed in a sequence different from that herein.
  • FIG. 1 is a flow chart of a software service processing method according to an embodiment of the present invention, as shown in Figure 1 As shown, the process includes the following steps:
  • the determination of the target RPM package is based on the processing scenario of the actual software service. For example, for software service A, it corresponds to RPM package A.
  • the operation of RPM package A corresponds to multiple services. Then, when processing software service A, that is, when processing RPM package A, it is necessary to analyze the running status of multiple services corresponding to the RPM package.
  • the --scripts command obtains the script that needs to be run after the RPM package is installed, analyzes the way the script starts the service process (such as the systemd service method), and then analyzes the parameter information for starting the service process, thereby obtaining the executable program name corresponding to the service process.
  • each field of the parameter information can be analyzed to determine the field corresponding to the executable program name, namely Name, and the executable program name corresponding to the target RPM package can be obtained.
  • the target RPM package corresponds to multiple processes during runtime.
  • the executable program name is used to query each RPM package to determine the description information of the RPM package corresponding to the executable program name. By analyzing the description information, the process of the service corresponding to the target RPM package can be obtained. It should be noted here that the process served by the target RPM package includes the main process, sub-processes, and sub-processes of sub-processes.
  • the electronic device uses the name of the executable program to query the process information corresponding to the name of the executable program through Linux system commands.
  • the electronic device After obtaining the process corresponding to the target RPM package, the electronic device can obtain the process status of the process by analyzing the description information of each process.
  • the process state includes but is not limited to sleep state S, running state R, zombie state Z, uninterruptible sleep state D or stop state T.
  • the electronic device reads the content of the system file of the process through Linux system commands, analyzes the fields corresponding to the process status in the content, and obtains the values of the fields, thereby obtaining the process status of the process.
  • the electronic device analyzes the process status obtained in the above S13, for example, counts the number of processes in the dormant state, the number of processes in the running state R, the number of processes in the zombie state Z, etc., and then analyzes the statistical results to determine Get the status of the service corresponding to the target RPM package.
  • the electronic device first classifies the processes according to the process status, and groups the processes belonging to the same category or the same type of process status into one category, and then analyzes the processes of the same category or the same type of process status during subsequent analysis.
  • the same category represents the same process state; the same type represents similar process states, for example, sleep state and uninterruptible sleep state.
  • S15 Process the target RPM package based on the status of the service corresponding to the target RPM package, and determine the processing result of the target RPM package.
  • the electronic device can determine the processing method of the target RPM package. For example, if the target RPM package currently needs to be upgraded, and the service corresponding to the target RPM package is determined to be active after the above processing steps, then the target RPM package cannot be upgraded currently, and the processing method of the target RPM package can be determined to be pause processing.
  • the software service processing method provided by this embodiment makes full use of the process running status data of the service corresponding to the target RPM package corresponding to the RPM package, analyzes and determines the status of the service corresponding to the target RPM package, and provides the corresponding target RPM when upgrading and uninstalling the RPM package. Accurately determine the status of the corresponding service in the package, so that running services will not be accidentally interrupted when upgrading and uninstalling using RPM packages, ensuring data integrity and improving user experience.
  • FIG. 1 is a flow chart of a software service processing method according to an embodiment of the present invention, as shown in Figure 2 As shown, the process includes the following steps:
  • the electronic device classifies the processes according to the process status, and uses a process list to represent the classification results.
  • the process list includes a running process list, a dormant process list, and a dead process list.
  • the running process list includes processes whose process status is running state
  • the dormant process list includes processes whose process status is dormant state and uninterruptible sleep state
  • the dead process list includes processes whose process status is zombie state and stopped state.
  • the above S24 includes:
  • S241 Obtain the sleep duration and time threshold of the process whose process state is in the sleep state.
  • the electronic device obtains the dormant process list in the above S23, filters the dormant processes in the dormant process list, and determines whether they are actually in the dormant state or temporarily dormant. Among them, the screening of processes in the dormant state is determined by comparing the sleep duration of the process in the dormant state with the time threshold.
  • the electronic device For obtaining the sleep duration, the electronic device obtains it through Linux commands.
  • the above-mentioned acquisition of the sleep duration of a process whose process status is in the sleep state includes:
  • the target process is a process whose process state is in the sleep state.
  • the process is deleted from the sleep-proc-list. Otherwise, the process is retained in the hibernating process list.
  • S243 Determine the status of the service corresponding to the target RPM package based on the process status of the updated process.
  • the above S243 includes:
  • the above S243 also includes: when both the running process list and the dormant process list are empty, and the dead process list is not empty, determining that the service corresponding to the target RPM package is in an abnormal state. If the running process list running-proc-list and the sleeping process list sleep-proc-list are both empty, and the dead process list dead-proc-list is not empty, the service corresponding to the target RPM package is in an abnormal state.
  • S25 Process the target RPM package based on the status of the software service to be processed, and determine the processing result of the target RPM package.
  • the software service processing method provided by this embodiment calculates the sleep duration of the process in the sleep state through the obtained service process status data, and then determines whether the process is actually in the sleep state within a period of time, thereby avoiding the process that is temporarily in the sleep state. Determining the process to be in a dormant state ensures the accuracy of the determined process status and improves the reliability of the determined status of the service corresponding to the target RPM package.
  • FIG. 3 is a flow chart of a software service processing method according to an embodiment of the present invention, as shown in Figure 3 As shown, the process includes the following steps:
  • the above S32 includes:
  • S321 Query the process information corresponding to the executable program name and determine the main process of the service corresponding to the target RPM package.
  • S322 Read the corresponding system information file content based on the main process to obtain all sub-processes of the main process and determine the process corresponding to the service of the target RPM package.
  • the above S33 includes:
  • S332 Query the value of the process status field in the system file to determine the process status of the process.
  • the process state includes sleep state S, running state R, zombie state Z, uninterruptible sleep state D, stop state T, etc.
  • the above S332 includes:
  • the process status includes sleep state, running state, zombie state, uninterruptible sleep state or stopped state.
  • Process lists are summarized and classified into running-proc-list, sleep-proc-list, and dead-proc-list.
  • the process with process status R belongs to running-proc-list
  • the process with process status S and D belongs to sleep-proc-list
  • the process with process status Z and T belongs to dead-proc-list.
  • S35 Process the target RPM package based on the status of the service corresponding to the target RPM package, and determine the processing result of the target RPM package.
  • the software service processing method provided by this embodiment first obtains the main process, then uses the main process to obtain all sub-processes, and obtains all processes through the contents of the system information file, ensuring that the obtained target RPM package corresponds to the service process. comprehensiveness and accuracy.
  • the value of the process status field is directly extracted, ensuring the accuracy of the determined process status.
  • the operating system installed on the cloud computing resource pool server is openEuler 20.03 LTS SP1
  • the installed system software Mysql version is 8.0.22, which needs to be upgraded to 8.0 .twenty four.
  • the method includes:
  • step (3) According to the main process ID 1514206 of the Mysql corresponding service obtained in step (2), by reading the contents of the system information file /proc/1514206/task/1514206/children corresponding to the process, all child process IDs - 1514207 can be obtained , 1514208, 1514209, 1514210, 1514211, 1514212 and 514214.
  • the sleep_period_time in the sleep-proc-list process is [1009215.472228, 1009215.572228, 1009215.472231, 1009215.472230, 1009215.472423, 1 009215.482236, 1009215.482245, 1009215.482338, 1009215.482528].
  • the method provided by the embodiment of the present invention is used to identify the service status corresponding to the RPM package, which can avoid accidental interruption of the running service, thereby ensuring the integrity of the system software data and Consistency, improve system stability and user experience.
  • This embodiment also provides a software service processing device, which is used to implement the above embodiments and preferred implementations. What has already been described will not be described again.
  • the term "module” may be a combination of software and/or hardware that implements a predetermined function.
  • the apparatus described in the following embodiments is preferably implemented in software, implementation in hardware, or a combination of software and hardware, is also possible and contemplated.
  • This embodiment provides a software service processing device, as shown in Figure 4, including:
  • the first acquisition module 41 is used to acquire the target RPM package to determine the executable program name corresponding to the target RPM package;
  • the second acquisition module 42 is used to acquire the process of the service corresponding to the target RPM package based on the name of the executable program;
  • Reading module 43 is used to read the contents of the system file of the process to obtain the process status of the process
  • the analysis module 44 is used to analyze the process status and determine the status of the service corresponding to the target RPM package;
  • the processing module 45 is configured to process the target RPM package based on the status of the service corresponding to the target RPM package and determine the processing result of the target RPM package.
  • reading module 43 includes:
  • the first acquisition unit is used to obtain a process status reading command to obtain the system file of the process
  • the first query unit is used to query the value of the process status field in the system file to determine the process status of the process.
  • the query unit includes:
  • the process status includes a sleep state, a running state, a zombie state, an uninterruptible sleep state or a stopped state;
  • a classification subunit configured to classify the process based on the process status to obtain a process list, where the process list includes at least one process corresponding to the process status.
  • analysis module 44 includes:
  • the second acquisition unit is used to acquire the sleep duration and time threshold of the process whose process state is the sleep state;
  • a deletion unit configured to delete the process in the dormant state to update the process when the dormancy duration is greater than or equal to the time threshold
  • a determining unit configured to determine the status of the service corresponding to the target RPM package based on the process status of the updated process.
  • the second acquisition unit includes:
  • the analysis subunit is used to analyze the fields of the scheduling information file and determine the start-up running time point, the time point when it enters the sleep state, and the cumulative running time of the target process.
  • the target process is a process whose process state is the sleep state;
  • the calculation subunit is used to calculate the sleep duration using the start-up time point, the time point into the sleep state and the accumulated running time.
  • the processes corresponding to the process status are represented by a process list.
  • the process list includes a running process list, a dormant process list and a dead process list.
  • the running process list includes the processes whose process status is the running state.
  • the dormant process list includes processes whose process status is dormant state and uninterruptible dormant state
  • the dead process list includes processes whose process status is zombie state and stopped state
  • the determining unit includes:
  • the first judgment subunit is used to judge whether the running process list is empty
  • the second judgment subunit is used to judge whether the dormant process list is empty when the running process list is empty;
  • a first determination subunit configured to determine that the service corresponding to the target RPM package is in an inactive state when the dormant process list is empty;
  • the second determination subunit is configured to determine that the service corresponding to the target RPM package is in an active state when the dormant process list is not empty.
  • the determining unit includes:
  • the third determination subunit is configured to determine that the service corresponding to the target RPM package is in an abnormal state when the running process list and the dormant process list are both empty, and the dead process list is not empty.
  • the second acquisition module 42 includes:
  • the second query unit is used to query the process information corresponding to the name of the executable program and determine the main process of the service corresponding to the target RPM package;
  • a reading unit is configured to read the corresponding system information file content based on the main process to obtain all sub-processes of the main process and determine the process of the service corresponding to the target RPM package.
  • the processing device of the software service in this embodiment is presented in the form of a functional unit, where the unit refers to an ASIC circuit, a processor and memory that executes one or more software or fixed programs, and/or others that can provide the above functions. device.
  • An embodiment of the present invention also provides an electronic device having the above-mentioned software service processing device shown in FIG. 4 .
  • Figure 5 is a schematic structural diagram of an electronic device provided by an optional embodiment of the present invention.
  • the electronic device may include: at least one processor 51, such as a CPU (Central Processing Unit, Central Processing Unit). processor), at least one communication interface 53, memory 54, and at least one communication bus 52.
  • the communication bus 52 is used to realize connection communication between these components.
  • the communication interface 53 may include a display screen (Display) and a keyboard (Keyboard), and the optional communication interface 53 may also include a standard wired interface and a wireless interface.
  • the memory 54 may be a high-speed RAM memory (Random Access Memory, volatile random access memory), or non-volatile memory memory), such as at least one disk storage.
  • the memory 54 may optionally be at least one storage device located remotely from the aforementioned processor 51 .
  • the processor 51 can be combined with the device described in FIG. 4 , the memory 54 stores an application program, and the processor 51 calls the program code stored in the memory 54 to execute any of the above method steps.
  • the communication bus 52 may be a peripheral component interconnection standard (peripheral component interconnect (PCI for short) bus or extended industry standard architecture (EISA for short) bus, etc.
  • PCI peripheral component interconnect
  • EISA extended industry standard architecture
  • the communication bus 52 can be divided into an address bus, a data bus, a control bus, etc. For ease of presentation, only one thick line is used in Figure 5, but it does not mean that there is only one bus or one type of bus.
  • the memory 54 may include volatile memory (English: volatile memory), such as random access memory (English: random-access memory, abbreviation: RAM); the memory may also include non-volatile memory (English: non-volatile memory) memory), such as flash memory (English: flash memory), hard disk (English: hard disk drive (abbreviation: HDD) or solid-state drive (English: solid-state drive, abbreviation: SSD); the memory 54 may also include a combination of the above types of memories.
  • volatile memory English: volatile memory
  • RAM random access memory
  • non-volatile memory English: non-volatile memory
  • flash memory English: flash memory
  • hard disk English: hard disk drive (abbreviation: HDD)
  • SSD solid-state drive
  • the processor 51 may be a central processing unit (English: central processing unit (abbreviation: CPU), network processor (English: network processor (abbreviation: NP)) or a combination of CPU and NP.
  • CPU central processing unit
  • NP network processor
  • the processor 51 may further include a hardware chip.
  • the above hardware chips can be application-specific integrated circuits (English: application-specific integrated circuit (abbreviation: ASIC), programmable logic device (English: programmable logic device (abbreviation: PLD)) or a combination thereof.
  • the above-mentioned PLD can be a complex programmable logic device (English: complex programmable logic device, abbreviation: CPLD), a field-programmable logic gate array (English: field-programmable gate array, abbreviation: FPGA), general array logic (English: generic array logic, abbreviation: GAL) or any combination thereof.
  • memory 54 is also used to store program instructions.
  • the processor 51 can call program instructions to implement the software service processing method shown in any embodiment of this application.
  • Embodiments of the present invention also provide a non-transitory computer storage medium.
  • the computer storage medium stores computer-executable instructions.
  • the computer-executable instructions can execute the processing method of the software service in any of the above method embodiments.
  • the storage medium may be a magnetic disk, an optical disk, or a read-only memory (Read-Only memory).
  • Memory ROM), random access memory (Random Access Memory (RAM), flash memory (Flash Memory), hard disk (Hard Disk Drive, abbreviation: HDD) or solid-state drive (Solid-State Drive, SSD), etc.; the storage medium may also include a combination of the above types of memories.

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • Debugging And Monitoring (AREA)
  • Stored Programmes (AREA)

Abstract

本发明涉及Linux系统软件包管理技术领域,具体涉及软件服务的处理方法、电子设备及存储介质,该方法包括获取目标RPM包,以确定所述目标RPM包对应的可执行程序名称;基于所述可执行程序名称获取所述目标RPM包对应服务的进程;读取所述进程的系统文件的内容,以获得所述进程的进程状态;对所述进程状态进行分析,确定所述目标RPM包对应服务的状态;基于所述目标RPM包对应服务的状态对目标RPM包进行处理,确定目标RPM包的处理结果。充分利用RPM包对应的目标RPM包对应服务的进程运行状态数据,分析判定目标RPM包对应服务的状态,从而利用RPM包处理升级、卸载时不会意外中断正在运行的服务。

Description

软件服务的处理方法、电子设备及存储介质 技术领域
本发明涉及Linux系统软件包管理技术领域,具体涉及软件服务的处理方法、电子设备及存储介质。
背景技术
近些年,随着云计算产业的发展,云计算改变了人们获取信息的方式,以及企业的信息系统建设方式。云计算也被认为是第三次IT浪潮,云计算是与信息技术、软件、互联网相关的一种服务。云计算的高速发展也需要强有力的基础设施支撑,其中极为重要的为管理云计算资源池服务器硬件和服务能力的操作系统。现阶段的云计算操作系统一般为RedHat、CentOS等Linux操作系统,这一系列的Linux操作系统都使用红帽软件包管理器(Red-Hat Package Manager,简称为RPM),并提供Dnf/Yum前端包管理器进行软件服务的管理。
技术问题
目前Linux操作系统的软件服务以RPM包形式进行安装、升级或卸载。由于云计算平台的软件服务一般都是7×24服务,若直接利用RPM包进行软件服务的安装、升级或卸载,则可能会导致系处于运行状态的服务突然中断。
技术解决方案
有鉴于此,本发明实施例提供了一种软件服务的处理方法、电子设备及存储介质,以解决软件服务的处理所导致的服务中断的问题。
根据第一方面,本发明实施例提供了一种软件服务的处理方法,包括:
获取目标RPM包,以确定所述目标RPM包对应的可执行程序名称;
基于所述可执行程序名称获取所述目标RPM包对应服务的进程;
读取所述进程的系统文件的内容,以获得所述进程的进程状态;
对所述进程状态进行分析,确定所述目标RPM包对应服务的状态;
基于所述目标RPM包对应服务的状态对所述目标RPM包进行处理,确定所述目标RPM包的处理结果。
本发明实施例提供的软件服务的处理方法,充分利用RPM包对应服务的进程运行状态数据,分析判定目标RPM包对应服务的状态,提供给RPM包升级、卸载时对应的目标RPM包对应服务的状态的精确判定,从而利用RPM包处理升级、卸载时不会意外中断正在运行的服务,保证数据的完整性和提高用户体验。
在一些实施方式中,所述读取所述进程的系统文件的内容,以获得所述进程的进程状态,包括:
获取进程状态读取命令,以获得所述进程的系统文件;
查询所述系统文件中进程状态字段的值,以确定所述进程的进程状态。
本发明实施例提供的软件服务的处理方法,通过对进程系统文件的进程状态字段进行分析,直接提取出进程状态字段的值,保证了所确定出的进程状态的准确性。
在一些实施方式中,所述查询所述系统文件中进程状态字段的值,以确定所述进程的进程状态,包括:
查询所述系统文件中进程状态字段的值,获得各个所述进程的进程状态,所述进程状态包括休眠状态、运行状态、僵死状态、不可中断休眠状态或停止状态;
基于所述进程状态对所述进程进行分类,以获得进程列表,所述进程列表包括至少一个进程状态对应的进程。
本发明实施例提供的软件服务的处理方法,通过依据进程状态对所有进程进行了归纳分类,降低后续进程处理的复杂度。
在一些实施方式中,所述对所述进程状态进行分析,确定所述目标RPM包对应服务的状态,包括:
获取所述进程状态为休眠状态的进程的休眠时长以及时间阈值;
当所述休眠时长大于或等于所述时间阈值时,将所述休眠状态的进程删除,以更新进程;
基于更新后进程的进程状态确定所述目标RPM包对应服务的状态。
本发明实施例提供的软件服务的处理方法,通过获取的服务进程状态数据,计算进程处于休眠状态的休眠时长,进而判定进程在一段时间内是否真正处于休眠状态,从而避免将暂时处于休眠状态的进程确定为处于休眠状态的进程,保证了所确定出的进程状态的准确性,提高了确定出的目标RPM包对应服务的状态的可靠性。
在一些实施方式中,所述获取所述进程状态为休眠状态的进程的休眠时长,包括:
获取所述进程状态为休眠状态的进程的调度信息文件;
对所述调度信息文件的字段进行分析,确定目标进程的启动运行时间点、进入休眠状态的时间点以及累计运行时长,所述目标进程为进程状态为休眠状态的进程;
利用所述启动运行时间点、所述进入休眠状态的时间点以及所述累计运行时长,计算所述休眠时长。
在一些实施方式中,所述进程状态对应的进程采用进程列表表示,所述进程列表包括运行进程列表、休眠进程列表以及死亡进程列表,所述运行进程列表包括所述进程状态为运行状态的进程,所述休眠进程列表包括所述进程状态为休眠状态和不可中断休眠状态的进程,所述死亡进程列表包括所述进程状态为僵死状态和停止状态的进程,所述基于更新后进程的进程状态确定所述目标RPM包对应服务的状态,包括:
判断所述运行进程列表是否为空;
当所述运行进程列表为空时,判断所述休眠进程列表是否为空;
当所述休眠进程列表为空时,确定所述目标RPM包对应服务处于非活动状态;
当所述休眠进程列表为非空时,确定所述目标RPM包对应服务处于活动状态。
本发明实施例提供的软件服务的处理方法,通过依次对运行进程列表以及休眠进程列表进行分析,一方面能够减少进程分析的复杂度提高分析效率,另一方面能够保证所确定出的目标RPM包对应服务的状态的准确性。
在一些实施方式中,所述基于更新后进程的进程状态确定所述目标RPM包对应服务的状态,包括:
当所述运行进程列表以及所述休眠进程列表均为空,且所述死亡进程列表不为空时,确定所述目标RPM包对应服务处于异常状态。
在一些实施方式中,所述基于所述可执行程序名称获取所述目标RPM包对应服务的进程,包括:
查询所述可执行程序名称对应的进程信息,确定所述目标RPM包对应服务的主进程;
基于所述主进程读取对应的系统信息文件内容,以获得所述主进程的所有子进程,确定所述目标RPM包对应服务的进程。
本发明实施例提供的软件服务的处理方法,先获取主进程,再利用主进程获得所有的子进程,通过系统信息文件内容进行所有进程的获取,保证了所获取到的目标RPM包对应服务的进程的全面性及准确性。
根据第二方面,本发明实施例提供了一种软件服务的处理装置,包括:
第一获取模块,用于获取目标RPM包,以确定所述目标RPM包对应的可执行程序名称;
第二获取模块,用于基于所述可执行程序名称获取所述目标RPM包对应服务的进程;
读取模块,用于读取所述进程的系统文件的内容,以获得所述进程的进程状态;
分析模块,用于对所述进程状态进行分析,确定所述目标RPM包对应服务的状态;
处理模块,用于基于所述目标RPM包对应服务的状态对所述目标RPM进行处理,确定所述目标RPM包的处理结果。
根据第三方面,本发明实施例提供了一种电子设备,包括:存储器和处理器,所述存储器和所述处理器之间互相通信连接,所述存储器中存储有计算机指令,所述处理器通过执行所述计算机指令,从而执行第一方面或者第一方面的任意一种实施方式中所述的软件服务的处理方法。
根据第四方面,本发明实施例提供了一种计算机可读存储介质,所述计算机可读存储介质存储计算机指令,所述计算机指令用于使所述计算机执行第一方面或者第一方面的任意一种实施方式中所述的软件服务的处理方法。
有益效果
需要说明的是,本发明实施例提供的软件服务的处理装置、电子设备及计算机可读存储介质的相应有益效果,请参见上文软件服务的处理方法的对应有益效果的描述,在此不再赘述。
附图说明
为了更清楚地说明本发明具体实施方式或现有技术中的技术方案,下面将对具体实施方式或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图是本发明的一些实施方式,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1是根据本发明实施例的软件服务的处理方法的流程图;
图2是根据本发明实施例的软件服务的处理方法的流程图;
图3是根据本发明实施例的软件服务的处理方法的流程图;
图4是根据本发明实施例的软件服务的处理装置的结构框图;
图5是本发明实施例提供的电子设备的硬件结构示意图。
本发明的实施方式
为使本发明实施例的目的、技术方案和优点更加清楚,下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。
目前Linux操作系统的软件服务以RPM包形式进行处理,例如安装、升级、卸载等等,对软件服务进行处理也可以认为是对RPM包进行处理。在以RPM包对软件服务进行处理时通常不关心RPM包所包含的软件服务的运行状态。由于云计算平台的软件服务一般都是7×24服务,软件服务在需要进行升级或者卸载某RPM包时若不能够通过有效的技术手段精准判断此时该RPM包对应服务的运行状态,此时很可能会导致系处于运行状态的服务突然中断,容易出现系统数据不一致,瘫痪的风险,降低用户体验。
基于此,本发明实施例提供了一种软件服务的处理方法,在对目标RPM包进行处理之前,先对目标RPM包对应服务的运行状态进行分析,再基于分析结果对目标RPM包进行处理。例如,在对目标RPM包升级之前,先确定目标RPM包对应服务的运行状态,若存在处于活动状态的服务时,则表示此时无法对目标RPM包进行升级,否则会导致处于活动状态的服务突然中断。
根据本发明实施例,提供了一种软件服务的处理方法实施例,需要说明的是,在附图的流程图示出的步骤可以在诸如一组计算机可执行指令的计算机系统中执行,并且,虽然在流程图中示出了逻辑顺序,但是在某些情况下,可以以不同于此处的顺序执行所示出或描述的步骤。
在本实施例中提供了一种软件服务的处理方法,可用于电子设备,如电脑、移动中断、服务器等,图1是根据本发明实施例的软件服务的处理方法的流程图,如图1所示,该流程包括如下步骤:
S11,获取目标RPM包,以确定目标RPM包对应的可执行程序名称。
对于目标RPM包的确定是根据实际软件服务的处理场景的对应的,例如对于软件服务A而言,其与RPM包A对应。而RPM包A的运行则对应多个服务,那么,在对软件服务A进行处理,即RPM包A进行处理时,就需要对RPM包对应的多个服务的运行状态进行分析。
由于RPM包的命名规则为Name-Version-Release.Vendor.Arch.rpm,那么,通过rpm --scripts命令得到RPM包安装完成后需要运行的脚本,分析脚本启动服务进程的方式(如systemd服务方式),进而分析启动服务进程的参数信息,从而得到服务进程对应的可执行程序名称。其中,分析启动服务进程的参数信息,可以对该参数信息的各个字段进行分析,确定可执行程序名称对应的字段,即Name,即可获得目标RPM包对应的可执行程序名称。
S12,基于可执行程序名称获取目标RPM包对应服务的进程。
如上文所述,目标RPM包在运行时与多个进程对应,利用可执行程序名称在各个RPM包中进行查询,确定出可执行程序名称对应的RPM包的描述信息。通过对该描述信息进行分析,即可得到目标RPM包对应服务的进程。此处需要说明的是,目标RPM包对应服务的进程包括主进程、子进程以及子进程的子进程。
例如,电子设备利用可执行程序名称,通过Linux系统命令查询该可执行程序名称对应的进行信息。
关于该步骤具体将在下文中进行详细描述。
S13,读取进程的系统文件的内容,以获得进程的进程状态。
电子设备在获得目标RPM包对应的进程之后,通过对各个进程的描述信息进行分析,即可获得进程的进程状态。其中,进程状态包括但不限于休眠状态S、运行状态R、僵死状态Z、不可中断休眠状态D或停止状态T。
电子设备通过Linux系统命令读取进程的系统文件的内容,对该内容中进程状态对应的字段进行分析,获取字段的取值,从而获得进程的进程状态。
关于该步骤具体将在下文中进行详细描述。
S14,对进程状态进行分析,确定目标RPM包对应服务的状态。
电子设备对上述S13中获得的进程状态进行分析,例如,统计处于休眠状态的进程数量,处于运行状态R的进程数量,处于僵死状态Z的进程数量等等,再对统计结果进行分析,从而确定出目标RPM包对应服务的状态。
或者,电子设备先依据进程状态对进程进行归类,将属于同一类别或同一类型的进程状态的进程归为一类,后续在进行分析时,针对同一类别或同一类型的进程状态的进程进行分析。其中,同一类别即表示相同的进程状态;同一类型即表示相似的进程状态,例如,休眠状态与不可中断休眠状态。
关于该步骤具体将在下文中进行详细描述。
S15,基于目标RPM包对应服务的状态对目标RPM包进行处理,确定目标RPM包的处理结果。
电子设备在确定出目标RPM包对应服务的状态之后,就可确定目标RPM包的处理方式。例如,当前需要对目标RPM包进行升级,而经过上述的处理步骤确定目标RPM包对应的服务处于活动状态,则当前无法对目标RPM包进行升级,可以确定目标RPM包的处理方式为暂停处理。
当然,上述仅仅是一种示例,具体对目标RPM包的处理方式是根据实际需求设置的,在此对其并不做任何限定。
本实施例提供的软件服务的处理方法,充分利用RPM包对应的目标RPM包对应服务的进程运行状态数据,分析判定目标RPM包对应服务的状态,提供给RPM包升级、卸载时对应的目标RPM包对应服务的状态的精确判定,从而利用RPM包处理升级、卸载时不会意外中断正在运行的服务,保证数据的完整性和提高用户体验。
在本实施例中提供了一种软件服务的处理方法,可用于电子设备,如电脑、移动中断、服务器等,图2是根据本发明实施例的软件服务的处理方法的流程图,如图2所示,该流程包括如下步骤:
S21,获取目标RPM包,以确定目标RPM包对应的可执行程序名称。
详细请参见图1所示实施例的S11,在此不再赘述。
S22,基于可执行程序名称获取目标RPM包对应服务的进程。
详细请参见图1所示实施例的S12,在此不再赘述。
S23,读取进程的系统文件的内容,以获得进程的进程状态。
电子设备在获取到各个进程的进程状态之后,依据进程状态对进程进行分类,并采用进程列表对分类结果进行表示。具体地,进程列表包括运行进程列表、休眠进程列表以及死亡进程列表。运行进程列表包括进程状态为运行状态的进程,休眠进程列表包括进程状态为休眠状态和不可中断休眠状态的进程,死亡进程列表包括进程状态为僵死状态和停止状态的进程。
S24,对进程状态进行分析,确定目标RPM包对应服务的状态。
具体地,上述S24包括:
S241,获取进程状态为休眠状态的进程的休眠时长以及时间阈值。
电子设备在上述S23中获得休眠进程列表,对休眠进程列表中处于休眠状态的进程进行筛选,确定其是真实处于休眠状态还是暂时休眠。其中,对于休眠状态的进程的筛选,是通过对进程状态为休眠状态的休眠时长与时间阈值进行比较确定的。
对于休眠时长的获得,电子设备通过Linux命令获得。在一些实施方式中,上述获取进程状态为休眠状态的进程的休眠时长包括:
(1)获取进程状态为休眠状态的进程的调度信息文件。
(2)对调度信息文件的字段进行分析,确定目标进程的启动运行时间点、进入休眠状态的时间点以及累计运行时长,所述目标进程为进程状态为休眠状态的进程。
(3)利用启动运行时间点、进入休眠状态的时间点以及累计运行时长,计算休眠时长。
通过读取休眠状态的进程的调度信息文件/proc/[进程ID]/sched的内容,获取该进程的启动运行时间点exec_start_time;
通过读取休眠状态的进程的调度信息文件/proc/[进程ID]/sched的内容,获取被调度出运行队列进入休眠状态的时间点sleep_start_time;
通过读取休眠状态的进程的调度信息文件/proc/[进程ID]/sched的内容,获取进程从启动到统计时刻累计运行时长exec_sum_time;
休眠状态的进程的休眠时长sleep_period_time的计算公式如下:
 
S242,当休眠时长大于或等于时间阈值时,将休眠状态的进程删除,以更新进程。
若某休眠状态的进程的休眠时长sleep_period_time大于等于时间阈值ree_threshold,在休眠进程列表sleep-proc-list中删除该进程。反之,在休眠进程列表中保留该进程。
S243,基于更新后进程的进程状态确定目标RPM包对应服务的状态。
在一些实施方式中,上述S243包括:
(1)判断运行进程列表是否为空。
(2)当运行进程列表为空时,判断休眠进程列表是否为空。
(3)当休眠进程列表为空时,确定目标RPM包对应服务处于非活动状态。
(4)当休眠进程列表为非空时,确定目标RPM包对应服务处于活动状态。
判断运行进程列表running-proc-list是否为空,若运行进程列表running-proc-list不为空,则目标RPM包对应服务处于活动状态;反之,判断休眠进程列表sleep-proc-list是否为空,若休眠进程列表sleep-proc-list为空,则目标RPM包对应服务处于非活动状态,反之,目标RPM包对应服务依然处于活动状态。
通过依次对运行进程列表以及休眠进程列表进行分析,一方面能够减少进程分析的复杂度提高分析效率,另一方面能够保证所确定出的目标RPM包对应服务的状态的准确性。
在一些实施方式中,上述S243还包括:当运行进程列表以及休眠进程列表均为空,且死亡进程列表不为空时,确定目标RPM包对应服务处于异常状态。若运行进程列表running-proc-list、休眠进程列表sleep-proc-list都为空,死亡进程列表dead-proc-list不为空,则目标RPM包对应服务处于异常状态。
S25,基于待处理软件服务的状态对目标RPM包进行处理,确定目标RPM包的处理结果。
详细请参见图1所示实施例的S15,在此不再赘述。
本实施例提供的软件服务的处理方法,通过获取的服务进程状态数据,计算进程处于休眠状态的休眠时长,进而判定进程在一段时间内是否真正处于休眠状态,从而避免将暂时处于休眠状态的进程确定为处于休眠状态的进程,保证了所确定出的进程状态的准确性,提高了确定出的目标RPM包对应服务的状态的可靠性。
在本实施例中提供了一种软件服务的处理方法,可用于电子设备,如电脑、移动中断、服务器等,图3是根据本发明实施例的软件服务的处理方法的流程图,如图3所示,该流程包括如下步骤:
S31,获取目标RPM包,以确定目标RPM包对应的可执行程序名称。
详细请参见图1所示实施例的S11,在此不再赘述。
S32,基于可执行程序名称获取目标RPM包对应服务的进程。
具体地,上述S32包括:
S321,查询可执行程序名称对应的进程信息,确定目标RPM包对应服务的主进程。
根据得到的目标RPM包对应服务的可执行程序名称,通过在Linux系统命令查询该可执行程序名称对应的进程信息,从而得到目标RPM包对应服务的主进程ID。
S322,基于主进程读取对应的系统信息文件内容,以获得主进程的所有子进程,确定目标RPM包对应服务的进程。
软件服务通常都是多进程方式运行,根据目标RPM包对应服务主进程ID,通过读取进程对应的系统信息文件/proc/[主进程ID]/tasks/[主进程ID]/children内容,对该系统文件内容中的字段进行分析,从而可以获取主进程的所有子进程ID。同样地,可以查询到子进程的子进程,依此递归,可以获取到目标RPM包对应服务所有进程。
S33,读取进程的系统文件的内容,以获得进程的进程状态。
具体地,上述S33包括:
S331,获取进程状态读取命令,以获得进程的系统文件。
S332,查询系统文件中进程状态字段的值,以确定进程的进程状态。
逐次遍历目标RPM包对应服务的所有进程,通过读取每个进程的系统文件/proc/[进程ID]/stat内容,对该系统文件中与进程状态对应的字段进行分析,获取每个进程的进程状态。其中,进程状态包括休眠状态S、运行状态R、僵死状态Z、不可中断休眠状态D以及停止状态T等。
在一些实施方式中,上述S332包括:
(1)查询系统文件中进程状态字段的值,获得各个所述进程的进程状态,所述进程状态包括休眠状态、运行状态、僵死状态、不可中断休眠状态或停止状态。
(2)基于进程状态对进程进行分类,以获得进程列表,所述进程列表包括至少一个进程状态对应的进程。
电子设备采用进程列表的方式对进程进行归类,例如,将上述进程列表归纳分类形成运行进程列表running-proc-list、休眠进程列表sleep-proc-list以及死亡进程列表dead-proc-list。其中,进程状态为R的进程归属running-proc-list,进程状态为S、D的进程归属sleep-proc-list,进程状态为Z、T的进程归属dead-proc-list。通过依据进程状态对所有进程进行了归纳分类,降低后续进程处理的复杂度。
S34,对进程状态进行分析,确定目标RPM包对应服务的状态。
详细请参见图2所示实施例的S24,在此不再赘述。
S35,基于目标RPM包对应服务的状态对目标RPM包进行处理,确定目标RPM包的处理结果。
详细请参见图2所示实施例的S25,在此不再赘述。
本实施例提供的软件服务的处理方法,先获取主进程,再利用主进程获得所有的子进程,通过系统信息文件内容进行所有进程的获取,保证了所获取到的目标RPM包对应服务的进程的全面性及准确性。通过对进程系统文件的进程状态字段进行分析,直接提取出进程状态字段的值,保证了所确定出的进程状态的准确性。
作为本发明实施例的一个具体应用实例,本实施例是在云计算资源池服务器上安装的操作系统为openEuler 20.03 LTS SP1,已安装的系统软件Mysql版本为8.0.22,需要将其升级为8.0.24。该方法包括:
(1)根据待升级系统软件Mysql的RPM包名称mysql-8.0.24-1.oe1.x86_64.rpm中的Name部分为mysql,通过解析shell命令rpm -qa --scripts mysql返回结果,确定安装完成后会执行chkconfig启动对应的可执行程序,chkconfig的可执行程序参数名即为Mysql对应的可执行程序名称为mysqld。
(2)根据步骤(1)得到的Mysql对应服务的可执行程序名称mysqld,通过解析Shell命令ps -aux | grep mysqld返回结果,进程ID字段的值为Mysql的主进程ID,即1514206。
(3)根据步骤(2)得到的Mysql对应服务的主进程ID 1514206,通过读取进程对应的系统信息文件/proc/1514206/task/1514206/children内容,从而可以得到所有的子进程ID-1514207、1514208、 1514209、1514210、1514211、1514212和514214。
(4)在本实施例中子进程没用子进程,递归到此结束,形成Mysql包对应服务的所有进程列表为[1514206、1514207、1514208、1514209、1514210、1514211、1514212、514214]。
(5)逐次遍历进程列表[1514206、1514207、1514208、1514209、1514210、1514211、1514212、514214],通过读取每个进程的系统文件/proc/[进程ID]/stat内容,获取每个进程的运行状态。
(6)在本实施例中,进程列表[1514206、1514207、1514208、1514209、1514210、1514211、1514212、514214]中每个进程的状态都为S,所以所有进程分类归属sleep-proc-list=[1514206、1514207、1514208、1514209、1514210、1514211、1514212、514214]。
(7)设置判定进程处于真实休眠状态而不是暂时休眠的时间阈值为free_threshold为1000ms。
(8)逐次遍历sleep-proc-lis中的进程,通过读取进程系统调度文件/proc/[进程ID]/sched内容,获取该进程的启动运行时间点exec_start_time,最近一次被调度出运行队列进入休眠状态的时间点sleep_start_time,以及进程从启动到统计时刻累计运行时长exec_sum_time。因此,根据休眠进程处于休眠状态的时长sleep_period_timede 计算公式,sleep-proc-list进程中的sleep_period_time依此为[1009215.472228、1009215.572228、1009215.472231、1009215.472230、1009215.472423、1009215.482236、1009215.482245、1009215.482338、1009215.482528]。
(9)逐次遍历sleep-proc-list中的进程,每个进程的sleep_period_time 都大于步骤(7)设置的free_threshold,所以删除sleep-proc-list的所有进程。
(10)最后running-proc-list、sleep-proc-lis、dead-proc-list三个进程列表都为空,判定Mysql RPM包对应服务为非活动状态。
(11)由于均处于非活动状态,则表示此时能够利用RPM包将系统软件Mysql从8.0.22版本,升级为8.0.24版本。
Linux系统的软件服务以RPM包进行安装、升级、卸载时,通过本发明实施例提供的方法识别RPM包对应服务状态,可以避免意外中断正在运行的服务,从而保证了系统软件数据的完整性和一致性,提高系统的稳定性和用户体验。
在本实施例中还提供了一种软件服务的处理装置,该装置用于实现上述实施例及优选实施方式,已经进行过说明的不再赘述。如以下所使用的,术语“模块”可以实现预定功能的软件和/或硬件的组合。尽管以下实施例所描述的装置较佳地以软件来实现,但是硬件,或者软件和硬件的组合的实现也是可能并被构想的。
本实施例提供一种软件服务的处理装置,如图4所示,包括:
第一获取模块41,用于获取目标RPM包,以确定所述目标RPM包对应的可执行程序名称;
第二获取模块42,用于基于所述可执行程序名称获取所述目标RPM包对应服务的进程;
读取模块43,用于读取所述进程的系统文件的内容,以获得所述进程的进程状态;
分析模块44,用于对所述进程状态进行分析,确定所述目标RPM包对应服务的状态;
处理模块45,用于基于所述目标RPM包对应服务的状态对所述目标RPM包进行处理,确定所述目标RPM包的处理结果。
在一些实施方式中,读取模块43包括:
第一获取单元,用于获取进程状态读取命令,以获得所述进程的系统文件;
第一查询单元,用于查询所述系统文件中进程状态字段的值,以确定所述进程的进程状态。
在一些实施方式中,查询单元包括:
查询子单元,用于查询所述系统文件中进程状态字段的值,获得各个所述进程的进程状态,所述进程状态包括休眠状态、运行状态、僵死状态、不可中断休眠状态或停止状态;
分类子单元,用于基于所述进程状态对所述进程进行分类,以获得进程列表,所述进程列表包括至少一个进程状态对应的进程。
在一些实施方式中,分析模块44包括:
第二获取单元,用于获取所述进程状态为休眠状态的进程的休眠时长以及时间阈值;
删除单元,用于当所述休眠时长大于或等于所述时间阈值时,将所述休眠状态的进程删除,以更新进程;
确定单元,用于基于更新后进程的进程状态确定所述目标RPM包对应服务的状态。
在一些实施方式中,第二获取单元包括:
获取子单元,用于获取所述进程状态为休眠状态的进程的调度信息文件;
分析子单元,用于对所述调度信息文件的字段进行分析,确定目标进程的启动运行时间点、进入休眠状态的时间点以及累计运行时长,所述目标进程为进程状态为休眠状态的进程;
计算子单元,用于利用所述启动运行时间点、所述进入休眠状态的时间点以及所述累计运行时长,计算所述休眠时长。
在一些实施方式中,所述进程状态对应的进程采用进程列表表示,所述进程列表包括运行进程列表、休眠进程列表以及死亡进程列表,所述运行进程列表包括所述进程状态为运行状态的进程,所述休眠进程列表包括所述进程状态为休眠状态和不可中断休眠状态的进程,所述死亡进程列表包括所述进程状态为僵死状态和停止状态的进程,确定单元包括:
第一判断子单元,用于判断所述运行进程列表是否为空;
第二判断子单元,用于当所述运行进程列表为空时,判断所述休眠进程列表是否为空;
第一确定子单元,用于当所述休眠进程列表为空时,确定所述目标RPM包对应服务处于非活动状态;
第二确定子单元,用于当所述休眠进程列表为非空时,确定所述目标RPM包对应服务处于活动状态。
在一些实施方式中,确定单元包括:
第三确定子单元,用于当所述运行进程列表以及所述休眠进程列表均为空,且所述死亡进程列表不为空时,确定所述目标RPM包对应服务处于异常状态。
在一些实施方式中,第二获取模块42包括:
第二查询单元,用于查询所述可执行程序名称对应的进程信息,确定所述目标RPM包对应服务的主进程;
读取单元,用于基于所述主进程读取对应的系统信息文件内容,以获得所述主进程的所有子进程,确定所述目标RPM包对应服务的进程。
本实施例中的软件服务的处理装置是以功能单元的形式来呈现,这里的单元是指ASIC电路,执行一个或多个软件或固定程序的处理器和存储器,和/或其他可以提供上述功能的器件。
上述各个模块的更进一步的功能描述与上述对应实施例相同,在此不再赘述。
本发明实施例还提供一种电子设备,具有上述图4所示的软件服务的处理装置。
请参阅图5,图5是本发明可选实施例提供的一种电子设备的结构示意图,如图5所示,该电子设备可以包括:至少一个处理器51,例如CPU(Central Processing Unit,中央处理器),至少一个通信接口53,存储器54,至少一个通信总线52。其中,通信总线52用于实现这些组件之间的连接通信。其中,通信接口53可以包括显示屏(Display)、键盘(Keyboard),可选通信接口53还可以包括标准的有线接口、无线接口。存储器54可以是高速RAM存储器(Random Access Memory,易挥发性随机存取存储器),也可以是非不稳定的存储器(non-volatile memory),例如至少一个磁盘存储器。存储器54可选的还可以是至少一个位于远离前述处理器51的存储装置。其中处理器51可以结合图4所描述的装置,存储器54中存储应用程序,且处理器51调用存储器54中存储的程序代码,以用于执行上述任一方法步骤。
其中,通信总线52可以是外设部件互连标准(peripheral component interconnect,简称PCI)总线或扩展工业标准结构(extended industry standard architecture,简称EISA)总线等。通信总线52可以分为地址总线、数据总线、控制总线等。为便于表示,图5中仅用一条粗线表示,但并不表示仅有一根总线或一种类型的总线。
其中,存储器54可以包括易失性存储器(英文:volatile memory),例如随机存取存储器(英文:random-access memory,缩写:RAM);存储器也可以包括非易失性存储器(英文:non-volatile memory),例如快闪存储器(英文:flash memory),硬盘(英文:hard disk drive,缩写:HDD)或固态硬盘(英文:solid-state drive,缩写:SSD);存储器54还可以包括上述种类的存储器的组合。
其中,处理器51可以是中央处理器(英文:central processing unit,缩写:CPU),网络处理器(英文:network processor,缩写:NP)或者CPU和NP的组合。
其中,处理器51还可以进一步包括硬件芯片。上述硬件芯片可以是专用集成电路(英文:application-specific integrated circuit,缩写:ASIC),可编程逻辑器件(英文:programmable logic device,缩写:PLD)或其组合。上述PLD可以是复杂可编程逻辑器件(英文:complex programmable logic device,缩写:CPLD),现场可编程逻辑门阵列(英文:field-programmable gate array,缩写:FPGA),通用阵列逻辑(英文:generic array logic, 缩写:GAL)或其任意组合。
可选地,存储器54还用于存储程序指令。处理器51可以调用程序指令,实现如本申请任一实施例中所示的软件服务的处理方法。
本发明实施例还提供了一种非暂态计算机存储介质,所述计算机存储介质存储有计算机可执行指令,该计算机可执行指令可执行上述任意方法实施例中的软件服务的处理方法。其中,所述存储介质可为磁碟、光盘、只读存储记忆体(Read-Only Memory,ROM)、随机存储记忆体(Random Access Memory,RAM)、快闪存储器(Flash Memory)、硬盘(Hard Disk Drive,缩写:HDD)或固态硬盘(Solid-State Drive,SSD)等;所述存储介质还可以包括上述种类的存储器的组合。
虽然结合附图描述了本发明的实施例,但是本领域技术人员可以在不脱离本发明的精神和范围的情况下做出各种修改和变型,这样的修改和变型均落入由所附权利要求所限定的范围之内。

Claims (10)

  1. 一种软件服务的处理方法,其特征在于,包括:
    获取目标RPM包,以确定所述目标RPM包对应的可执行程序名称;
    基于所述可执行程序名称获取所述目标RPM包对应服务的进程;
    读取所述进程的系统文件的内容,以获得所述进程的进程状态;
    对所述进程状态进行分析,确定所述目标RPM包对应服务的状态;
    基于所述目标RPM包对应服务的状态对所述目标RPM包进行处理,确定所述目标RPM包的处理结果。
  2. 根据权利要求1所述的方法,其特征在于,所述读取所述进程的系统文件的内容,以获得所述进程的进程状态,包括:
    获取进程状态读取命令,以获得所述进程的系统文件;
    查询所述系统文件中进程状态字段的值,以确定所述进程的进程状态。
  3. 根据权利要求2所述的方法,其特征在于,所述查询所述系统文件中进程状态字段的值,以确定所述进程的进程状态,包括:
    查询所述系统文件中进程状态字段的值,获得各个所述进程的进程状态,所述进程状态包括休眠状态、运行状态、僵死状态、不可中断休眠状态或停止状态;
    基于所述进程状态对所述进程进行分类,以获得进程列表,所述进程列表包括至少一个进程状态对应的进程。
  4. 根据权利要求1所述的方法,其特征在于,所述对所述进程状态进行分析,确定所述目标RPM包对应服务的状态,包括:
    获取所述进程状态为休眠状态的进程的休眠时长以及时间阈值;
    当所述休眠时长大于或等于所述时间阈值时,将所述休眠状态的进程删除,以更新进程;
    基于更新后进程的进程状态确定所述目标RPM包对应服务的状态。
  5. 根据权利要求4所述的方法,其特征在于,所述获取所述进程状态为休眠状态的进程的休眠时长,包括:
    获取所述进程状态为休眠状态的进程的调度信息文件;
    对所述调度信息文件的字段进行分析,确定目标进程的启动运行时间点、进入休眠状态的时间点以及累计运行时长,所述目标进程为进程状态为休眠状态的进程;
    利用所述启动运行时间点、所述进入休眠状态的时间点以及所述累计运行时长,计算所述休眠时长。
  6. 根据权利要求4所述的方法,其特征在于,所述进程状态对应的进程采用进程列表表示,所述进程列表包括运行进程列表、休眠进程列表以及死亡进程列表,所述运行进程列表包括所述进程状态为运行状态的进程,所述休眠进程列表包括所述进程状态为休眠状态和不可中断休眠状态的进程,所述死亡进程列表包括所述进程状态为僵死状态和停止状态的进程,所述基于更新后进程的进程状态确定所述目标RPM包对应服务的状态,包括:
    判断所述运行进程列表是否为空;
    当所述运行进程列表为空时,判断所述休眠进程列表是否为空;
    当所述休眠进程列表为空时,确定所述目标RPM包对应服务处于非活动状态;
    当所述休眠进程列表为非空时,确定所述目标RPM包对应服务处于活动状态。
  7. 根据权利要求6所述的方法,其特征在于,所述基于更新后进程的进程状态确定所述目标RPM包对应服务的状态,包括:
    当所述运行进程列表以及所述休眠进程列表均为空,且所述死亡进程列表不为空时,确定所述目标RPM包对应服务处于异常状态。
  8. 根据权利要求1所述的方法,其特征在于,所述基于所述可执行程序名称获取目标RPM包对应服务的进程,包括:
    查询所述可执行程序名称对应的进程信息,确定所述目标RPM包对应服务的主进程;
    基于所述主进程读取对应的系统信息文件内容,以获得所述主进程的所有子进程,确定所述目标RPM包对应服务的进程。
  9. 一种电子设备,其特征在于,包括:
    存储器和处理器,所述存储器和所述处理器之间互相通信连接,所述存储器中存储有计算机指令,所述处理器通过执行所述计算机指令,从而执行权利要求1-8中任一项所述的软件服务的处理方法。
  10. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质存储有计算机指令,所述计算机指令用于使计算机执行权利要求1-8中任一项所述的软件服务的处理方法。
PCT/CN2022/141864 2022-07-29 2022-12-26 软件服务的处理方法、电子设备及存储介质 WO2024021494A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202210906678.0 2022-07-29
CN202210906678.0A CN115469940A (zh) 2022-07-29 2022-07-29 软件服务的处理方法、电子设备及存储介质

Publications (1)

Publication Number Publication Date
WO2024021494A1 true WO2024021494A1 (zh) 2024-02-01

Family

ID=84366068

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/141864 WO2024021494A1 (zh) 2022-07-29 2022-12-26 软件服务的处理方法、电子设备及存储介质

Country Status (2)

Country Link
CN (1) CN115469940A (zh)
WO (1) WO2024021494A1 (zh)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115469940A (zh) * 2022-07-29 2022-12-13 天翼云科技有限公司 软件服务的处理方法、电子设备及存储介质

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104933332A (zh) * 2015-06-10 2015-09-23 北京北信源软件股份有限公司 一种防止软件被非法卸载的方法及装置
CN107193611A (zh) * 2017-05-31 2017-09-22 郑州云海信息技术有限公司 一种集群系统的软件升级方法和系统
CN107623581A (zh) * 2016-07-15 2018-01-23 阿里巴巴集团控股有限公司 服务列表生成方法、装置及系统,获取、上报方法及装置
US20190369979A1 (en) * 2018-05-30 2019-12-05 Red Hat, Inc. Distributing file system states
CN112099825A (zh) * 2020-09-11 2020-12-18 北京金山云网络技术有限公司 组件进行升级的方法、装置、设备及存储介质
CN112148477A (zh) * 2020-08-28 2020-12-29 杭州安恒信息技术股份有限公司 服务进程处理方法、电子装置及存储介质
CN115469940A (zh) * 2022-07-29 2022-12-13 天翼云科技有限公司 软件服务的处理方法、电子设备及存储介质

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104933332A (zh) * 2015-06-10 2015-09-23 北京北信源软件股份有限公司 一种防止软件被非法卸载的方法及装置
CN107623581A (zh) * 2016-07-15 2018-01-23 阿里巴巴集团控股有限公司 服务列表生成方法、装置及系统,获取、上报方法及装置
CN107193611A (zh) * 2017-05-31 2017-09-22 郑州云海信息技术有限公司 一种集群系统的软件升级方法和系统
US20190369979A1 (en) * 2018-05-30 2019-12-05 Red Hat, Inc. Distributing file system states
CN112148477A (zh) * 2020-08-28 2020-12-29 杭州安恒信息技术股份有限公司 服务进程处理方法、电子装置及存储介质
CN112099825A (zh) * 2020-09-11 2020-12-18 北京金山云网络技术有限公司 组件进行升级的方法、装置、设备及存储介质
CN115469940A (zh) * 2022-07-29 2022-12-13 天翼云科技有限公司 软件服务的处理方法、电子设备及存储介质

Also Published As

Publication number Publication date
CN115469940A (zh) 2022-12-13

Similar Documents

Publication Publication Date Title
CN108776934B (zh) 分布式数据计算方法、装置、计算机设备及可读存储介质
US8863109B2 (en) Updating secure pre-boot firmware in a computing system in real-time
RU2571726C2 (ru) Система и способ проверки целесообразности установки обновлений
US10990371B2 (en) Device driver non-volatile backing-store installation
US10229037B2 (en) System, method, and computer program product for error code injection
EP3514717B1 (en) Device driver non-volatile backing-store installation
CN113886162B (zh) 一种计算设备性能测试方法、计算设备及存储介质
CN109359092B (zh) 文件管理方法、桌面显示方法、装置、终端及介质
CN109634989B (zh) 一种hive任务执行引擎选择方法和系统
WO2024021494A1 (zh) 软件服务的处理方法、电子设备及存储介质
US20100333066A1 (en) Method and system for managing software issues
CN111625319A (zh) 虚拟机监控数据的采集方法、装置及宿主机
US7539992B2 (en) Scheduling method, program product for use in such method, and task scheduling apparatus
WO2024119930A1 (zh) 调度方法、装置、计算机设备和存储介质
US10642667B1 (en) Apparatus, system, and method for efficiently sharing data between processes
CN113190396A (zh) 一种收集cpu寄存器数据的方法、系统及介质
WO2023016485A1 (zh) 用于获取函数调用信息的方法、装置、电子设备和介质
CN113656378A (zh) 一种服务器管理方法、装置、介质
CN109101253B (zh) 云计算系统中主机的管理方法和装置
WO2022214200A1 (en) Method and network element for pre-upgrade use case validation
CN117873853B (zh) 数据记录方法、装置、电子设备及介质
CN115022094B (zh) 一种便于了解单位内部计算机使用情况的监控系统
CN110460601B (zh) 依赖包安全性检测方法、装置及存储介质
CN115421785B (zh) 应用程序的移植处理方法、装置和介质
WO2024066506A1 (zh) 数据监控分析方法、装置、服务器、运维系统及存储介质

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22952923

Country of ref document: EP

Kind code of ref document: A1