Task execution method and device, electronic equipment, storage medium and program product

By creating a reused process in memory and obtaining the target code entry point, the problem of inconsistent process initialization and monitoring in existing technologies is solved, achieving efficient utilization of system resources and reduction of operation and maintenance costs.

CN114371843BActive Publication Date: 2025-11-21BEIJING TAOYOU TIANXIA TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111531762.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-14
Publication Date
2025-11-21
Estimated Expiration
2041-12-14

AI Technical Summary

Technical Problem

In existing technologies, the system's crontab file is inconvenient to maintain and cannot initialize multiple processes simultaneously, resulting in inconsistent task monitoring and alarms, and increasing operation and maintenance costs.

Method used

A reusable process is created in memory, the target code entry point is obtained through a set of key-value pairs, the program to be executed is loaded, and the running status and exception information are recorded to achieve unified monitoring and alarms.

Benefits of technology

By reusing processes, the system resource utilization rate is reduced, and the smoothness of system operation and maintenance efficiency are improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114371843B_ABST
    Figure CN114371843B_ABST
Patent Text Reader

Abstract

The application provides a task execution method and device, electronic equipment, a storage medium and a computer program product, and relates to the technical field of computers. The method comprises the following steps: creating and initializing at least one multiplexing process in the memory; obtaining a target program name of at least one to-be-executed program, and determining a target code entry corresponding to the target program name; in a preset code repository, obtaining a to-be-executed program corresponding to the target code entry; and loading the to-be-executed program into the at least one multiplexing process to run the to-be-executed program. The application realizes the reuse of processes, reduces the use rate of system resources, and thus makes the system run more smoothly.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and more specifically, to a task execution method, apparatus, electronic device, storage medium, and program product. Background Technology

[0002] In existing technologies, it is necessary to find and maintain the code entry point of the program that needs to be executed on a schedule in the system's crontab file. It is inconvenient to maintain the code entry point and query the relevant historical maintenance records. Each time each program or task is executed, the system needs to initialize a new process. However, due to the limitations of the system itself, it is not possible to initialize multiple processes for a large number of programs or tasks at the same time. In addition, each task or program runs independently, and there is no way to monitor and alarm in a unified manner. This makes it impossible to resolve problems in a timely manner, resulting in high operation and maintenance costs. Summary of the Invention

[0003] This application provides a method, apparatus, electronic device, computer-readable storage medium, and computer program product for task execution. The technical solution is as follows:

[0004] According to one aspect of the embodiments of this application, a method for task execution is provided, the method comprising: creating and initializing at least one multiplexed process in memory;

[0005] Obtain the target program name of at least one program to be executed, and determine the target code entry point corresponding to the target program name;

[0006] Obtain the executable program corresponding to the target code entry point from the preset code repository;

[0007] The program to be executed is loaded into the at least one reused process to run the program.

[0008] In one possible implementation, determining the target code entry point corresponding to the target program name includes:

[0009] Retrieve the target key-value pair with the target program name as the key from the pre-created key-value pair set, and obtain the value in the target key-value pair;

[0010] The value in the target key-value pair is used as the entry point of the target code;

[0011] In this key-value pair set, each key-value pair corresponds to a program, with the key being the program name of the corresponding program and the value being the code entry point of the corresponding program.

[0012] In one possible implementation, the step of running the program to be executed further includes:

[0013] Record the runtime status information of the program to be executed;

[0014] The running status information includes at least one of the following: the start time of program execution, the end time of program execution, or the result of program execution.

[0015] In one possible implementation, recording the runtime state information of the program to be executed further includes:

[0016] Record whether any abnormal information that meets preset conditions occurs during the execution of the program to be executed;

[0017] If any abnormal information that meets the preset conditions appears in the status information, the preset alarm procedure will be executed.

[0018] In another possible implementation, obtaining the target program name of at least one program to be executed includes, prior to:

[0019] Create a program information list, which includes at least one of the following: program name, program execution cycle, program code entry point, and historical modification records of the code entry point;

[0020] If the current time point is the start time point of the running cycle, then the program name corresponding to the running cycle is used as the target program name of the program to be executed.

[0021] In yet another possible implementation, the step of creating and initializing at least one reused process in memory further includes:

[0022] Monitor whether the version information of the programs in the code repository has changed;

[0023] If a change in the program's version information is detected, the modified program's code entry point and the time information when the version information changed are obtained from the code repository.

[0024] Initialize the at least one reused process that has been created in the memory.

[0025] According to another aspect of the embodiments of this application, a task execution apparatus is provided, the apparatus comprising:

[0026] Create a module to create and initialize at least one reused process in memory;

[0027] The first acquisition module acquires the target program name of at least one program to be executed and determines the target code entry point corresponding to the target program name;

[0028] The second acquisition module is used to acquire the executable program corresponding to the target code entry point from a preset code repository;

[0029] A loading module is used to load the program to be executed into the at least one multiplexed process to run the program to be executed.

[0030] According to another aspect of the present application, an electronic device is provided, comprising: a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the steps of the task execution method described herein.

[0031] According to another aspect of the embodiments of this application, a computer-readable storage medium is provided, on which a computer program is stored, wherein the computer program, when executed by a processor, implements the steps of the task execution method described above.

[0032] According to one aspect of the embodiments of this application, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps of the task execution method.

[0033] The beneficial effects of the technical solution provided in this application are: the reuse of processes reduces the utilization rate of system resources, thereby making the system run more smoothly. Attached Figure Description

[0034] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments of this application will be briefly introduced below.

[0035] Figure 1 A flowchart illustrating a task execution method provided in an embodiment of this application;

[0036] Figure 2 This is another flowchart illustrating a task execution method provided in an embodiment of this application;

[0037] Figure 3 This is a schematic diagram of the structure of a task execution device provided in an embodiment of this application;

[0038] Figure 4 This is a schematic diagram of the structure of an electronic device for task execution provided in an embodiment of this application. Detailed Implementation

[0039] The embodiments of this application are described below with reference to the accompanying drawings. It should be understood that the embodiments described below with reference to the accompanying drawings are exemplary descriptions for explaining the technical solutions of the embodiments of this application, and do not constitute a limitation on the technical solutions of the embodiments of this application.

[0040] Those skilled in the art will understand that, unless specifically stated otherwise, the singular forms “a,” “an,” “the,” and “the” used herein may also include the plural forms. It should be further understood that the terms “comprising” and “including” as used in embodiments of this application mean that the corresponding feature can be implemented as the presented feature, information, data, step, operation, element, and / or component, but do not exclude implementation as other features, information, data, step, operation, element, component, and / or combinations thereof supported by the art. It should be understood that when we say that an element is “connected” or “coupled” to another element, the one element can be directly connected or coupled to the other element, or it can mean that the one element and the other element establish a connection relationship through an intermediate element. Furthermore, “connected” or “coupled” as used herein can include wireless connection or wireless coupling. The term “and / or” as used herein indicates at least one of the items defined by the term; for example, “A and / or B” can be implemented as “A,” or as “B,” or as “A and B.”

[0041] To make the objectives, technical solutions, and advantages of this application clearer, the embodiments of this application will be described in further detail below with reference to the accompanying drawings.

[0042] First, let's introduce and explain several terms used in this application:

[0043] Process: A process is a running activity of a program on a certain set of data in a computer. It is the basic unit for system resource allocation and scheduling and is the foundation of the operating system structure.

[0044] The task execution method, apparatus, electronic device, storage medium, and computer program product provided in this application are intended to solve the existing technical problems.

[0045] The technical solutions of this application and their effects are described below through several exemplary embodiments. It should be noted that the following embodiments can be referenced, borrowed from, or combined with each other. Identical terms, similar features, and similar implementation steps in different embodiments will not be repeated.

[0046] This application provides a method for task execution, such as... Figure 1 As shown, the method includes:

[0047] S101. Create and initialize at least one reused process in memory.

[0048] In this embodiment, at least one reused process can be created and initialized in the terminal's memory. A reused process is characterized by its ability to be used multiple times without needing to be destroyed after program execution. This process may include multiple threads; the number of threads contained within a single process is not specifically limited in this application.

[0049] S102. Obtain the target program name of at least one program to be executed, and determine the target code entry point corresponding to the target program name.

[0050] In this embodiment, at least one target program name of the program to be executed can be obtained, and the corresponding target code entry point can be determined based on the name.

[0051] S103. Obtain the executable program corresponding to the target code entry point from the preset code repository.

[0052] In this embodiment of the application, the code of the program to be executed corresponding to the code entry point can be obtained from a preset code repository based on the determined code entry point.

[0053] S104. Load the program to be executed into the at least one multiplexed process to run the program to be executed.

[0054] In this embodiment of the application, the obtained program code to be executed is loaded into at least one pre-created reused process to run at least one program to be executed.

[0055] Specifically, the step S102 of determining the target code entry point corresponding to the target program name may include:

[0056] Retrieve the target key-value pair with the target program name as the key from the pre-created key-value pair set, and obtain the value in the target key-value pair; wherein, each key-value pair in the key-value pair set corresponds to a program, the key of each key-value pair is the program name of the corresponding program, and the value is the code entry point of the corresponding program; use the value in the target key-value pair as the target code entry point.

[0057] In this embodiment, a key-value pair set can be pre-created. This set contains multiple key-value pairs, each with the program name or task name as the key and the code entry point as the value. This key-value pair set can be stored in a corresponding key-value pair caching system, such as Redis. Based on the target program name of the target program to be executed, the key-value pair with the target program name as the key is retrieved from the pre-established key-value pair set. The value in the key-value pair is determined, and the code entry point corresponding to the value of the key-value pair is used as the target code entry point.

[0058] Furthermore, after running the program to be executed in step S104, the process further includes:

[0059] Record the runtime status information of the program to be executed; the runtime status information includes at least one of the program's start time, end time, or program execution result.

[0060] In this embodiment of the application, when at least one program to be executed is running, its running status information can be recorded to facilitate user monitoring of its running status. This status information may include the start time, end time, and result of the program's execution, where the result may be program failure, program success, successful execution of the task corresponding to the program, or failure of the task corresponding to the program.

[0061] Furthermore, the recording of the runtime status information of the program to be executed also includes:

[0062] Record whether any abnormal information that meets preset conditions occurs during the execution of the program to be executed.

[0063] In this embodiment, it is also possible to record whether any exception information meeting preset conditions occurs during the execution of the program, that is, exceptions can be captured during program execution. This exception indicates that the program has encountered a bug during runtime, which may prevent it from continuing to run, or prevent it from running as the user expects.

[0064] If any abnormal information that meets the preset conditions appears in the status information, the preset alarm procedure will be executed.

[0065] In this embodiment, if abnormal information meeting preset conditions appears in the recorded status information, i.e., an abnormality occurring during program execution is captured, it indicates that the program has encountered a problem during runtime and requires manual handling. In this case, a pre-set alarm program is executed to warn the user that the program has encountered a problem, helping the user to discover and handle the problem immediately, thereby reducing corresponding maintenance costs. The specific alarm program is not specifically limited in this comparison; any program that warns the user that the program has encountered a problem during runtime is acceptable.

[0066] Specifically, in step S102, obtaining the target program name of at least one program to be executed includes the following steps:

[0067] Create a program information list, which includes at least one of the following: program name, program execution cycle, program code entry point, and historical modification records of the code entry point.

[0068] In a specific embodiment of the application, a web page can be set up, on which a program information list can be created to facilitate user configuration and management of the programs. This program information list may include the program name or the corresponding task name for each program, the program's running cycle (e.g., the program runs every 25 days, or every Friday at 3:31 PM), the program's code entry point, and the historical modification record of the code entry point. The historical modification record of the code entry point may include the historical versions of the code entry point, the number of historical modifications, or the time information when the code entry point was modified, indicating when the code entry point was modified.

[0069] If the current time point is the start time point of the running cycle, then the program name corresponding to the running cycle is used as the target program name of the program to be executed.

[0070] In this embodiment, if the current time is the start time of the execution cycle of at least one program to be executed, for example, if the program's execution cycle is every Friday at 3:31 PM, and the current time is every Friday at 3:31 PM, then the program name of at least one program to be executed is obtained. Specifically, in this embodiment, the program names of multiple programs can be obtained, and multiple programs to be executed can be run.

[0071] Specifically, after creating and initializing at least one multiplexed process in memory as described in step S101, the process further includes:

[0072] Monitor whether the version information of the program in the code repository has changed.

[0073] In this embodiment of the application, it is possible to monitor in real time whether the program code in the code repository has been upgraded, that is, whether the version information of each program itself has changed.

[0074] If a change in the program's version information is detected, the modified program's code entry point and the time information when the version information changed are retrieved from the code repository.

[0075] In this embodiment of the application, if it is detected that the code version information in the code repository has changed, that is, the code of each program has been upgraded or modified, the corresponding code entry point will also have changed. At this time, the code entry point corresponding to the changed program can be obtained, and the time information when the corresponding program was modified can be recorded. Based on the changed code entry point and time information, the program information list that has been created can be updated, and the code entry point corresponding to the previous version of the program and its corresponding time information can be retained in the historical modification record summary.

[0076] Initialize the at least one reused process that has been created in the memory.

[0077] In this embodiment of the application, if it is detected that at least one executable program in the code repository has been upgraded or modified, at least one reused process already created in memory is initialized for use by the upgraded or modified program.

[0078] Based on the above embodiments, such as Figure 2 As shown, a task is an abstract noun used to refer to an activity in which a program completes a task. This application can manage tasks, schedule a task (i.e., a program) when it needs to be executed, obtain the corresponding task name or program name, retrieve the corresponding code entry point from a preset key-value pair based on the obtained task name or program name, retrieve the relevant program code from a preset code repository based on the corresponding code entry point, load the program code into a pre-built process, run the program code, and perform unified monitoring and alarms on them during their execution.

[0079] This application provides a task execution device, such as... Figure 3 As shown, the task execution device 30 may include: a creation module 301, a first acquisition module 302, a second acquisition module 303, and a loading module 304, wherein,

[0080] Create module 301, which is used to create and initialize at least one multiplexed process in memory;

[0081] The first acquisition module 302 acquires the target program name of at least one program to be executed, and determines the target code entry point corresponding to the target program name;

[0082] The second acquisition module 303 is used to acquire the executable program corresponding to the target code entry point from a preset code repository;

[0083] The loading module 304 is used to load the program to be executed into the at least one multiplexed process to run the program to be executed.

[0084] The task execution device of this application embodiment can execute the method provided in this application embodiment, and its implementation principle is similar. The actions performed by each module in the device of each embodiment of this application correspond to the steps in the method of each embodiment of this application. For detailed functional descriptions of each module of the device, please refer to the descriptions in the corresponding methods shown above, which will not be repeated here. Compared with related prior art, it can achieve: process reuse, reduce the utilization rate of system resources, and thus make the system run more smoothly.

[0085] This application provides an electronic device including a memory, a processor, and a computer program stored in the memory. The processor executes the computer program to implement the steps of a task execution method. Compared with related technologies, this device can achieve the following: reuse of processes, reduce the utilization rate of system resources, and thus make the system run more smoothly.

[0086] In one alternative embodiment, an electronic device is provided, such as Figure 4 As shown, Figure 4 The illustrated electronic device 4000 includes a processor 4001 and a memory 4003. The processor 4001 and the memory 4003 are connected, for example, via a bus 4002. Optionally, the electronic device 4000 may further include a transceiver 4004, which can be used for data interaction between the electronic device and other electronic devices, such as sending and / or receiving data. It should be noted that in practical applications, the transceiver 4004 is not limited to one type, and the structure of the electronic device 4000 does not constitute a limitation on the embodiments of this application.

[0087] Processor 4001 may be a CPU (Central Processing Unit), a general-purpose processor, a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array), or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof. It can implement or execute the various exemplary logic blocks, modules, and circuits described in conjunction with the disclosure of this application. Processor 4001 may also be a combination that implements computational functions, such as including one or more microprocessor combinations, a combination of a DSP and a microprocessor, etc.

[0088] Bus 4002 may include a pathway for transmitting information between the aforementioned components. Bus 4002 may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus, etc. Bus 4002 can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 4 The bus is represented by a single thick line, but this does not mean that there is only one bus or one type of bus.

[0089] The memory 4003 may be ROM (Read Only Memory) or other types of static storage devices capable of storing static information and instructions, RAM (Random Access Memory) or other types of dynamic storage devices capable of storing information and instructions, or EEPROM (Electrically Erasable Programmable Read Only Memory), CD-ROM (Compact Disc Read Only Memory) or other optical disc storage, optical disc storage (including compressed optical discs, laser discs, optical discs, digital universal optical discs, Blu-ray discs, etc.), magnetic disk storage media, other magnetic storage devices, or any other medium capable of carrying or storing computer programs and capable of being read by a computer, without limitation herein.

[0090] The memory 4003 stores computer programs that execute embodiments of this application, and its execution is controlled by the processor 4001. The processor 4001 executes the computer programs stored in the memory 4003 to implement the steps shown in the foregoing method embodiments.

[0091] This application provides a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, it can implement the steps and corresponding content of the aforementioned method embodiments.

[0092] This application also provides a computer program product, including a computer program that, when executed by a processor, can implement the steps and corresponding content of the aforementioned method embodiments.

[0093] The terms "first," "second," "third," "fourth," "1," "2," etc. (if present) in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in a sequence other than that shown in the figures or text.

[0094] It should be understood that although arrows indicate various operation steps in the flowcharts of this application's embodiments, the order in which these steps are implemented is not limited to the order indicated by the arrows. Unless explicitly stated herein, in some implementation scenarios of this application's embodiments, the implementation steps in each flowchart can be executed in other orders as required. Furthermore, some or all steps in each flowchart, based on the actual implementation scenario, may include multiple sub-steps or multiple stages. Some or all of these sub-steps or stages can be executed at the same time, and each sub-step or stage can also be executed at different times. In scenarios where execution times differ, the execution order of these sub-steps or stages can be flexibly configured according to requirements, and this application's embodiments do not limit this.

[0095] The above description is only an optional implementation method for some implementation scenarios of this application. It should be noted that for those skilled in the art, other similar implementation methods based on the technical concept of this application without departing from the technical concept of this application also fall within the protection scope of the embodiments of this application.

Claims

1. A task execution method, characterized in that, include: At least one reused process is created and initialized in memory. The reused process indicates that the process can be used repeatedly. The reused process is not destroyed after the program runs. Under the condition that the version information of the program in the code repository has changed, the at least one reused process already created in memory is re-initialized so that the program with the new version information can use it. Obtain the target program name of at least one program to be executed, and determine the target code entry point corresponding to the target program name; Obtain the executable program corresponding to the target code entry point from the preset code repository; The program to be executed is loaded into the at least one reused process to run the program.

2. The task execution method according to claim 1, characterized in that, The step of determining the target code entry point corresponding to the target program name includes: Retrieve the target key-value pair with the target program name as the key from the pre-created key-value pair set, and obtain the value in the target key-value pair; The value in the target key-value pair is used as the entry point of the target code; In this key-value pair set, each key-value pair corresponds to a program, with the key being the program name of the corresponding program and the value being the code entry point of the corresponding program.

3. The task execution method according to claim 1, characterized in that, The process of running the program to be executed is followed by: Record the runtime status information of the program to be executed; The status information includes at least one of the following: the start time of program execution, the end time of program execution, or the result of program execution.

4. The task execution method according to claim 3, characterized in that, The method of recording the runtime status information of the program to be executed also includes: Record whether any abnormal information that meets preset conditions occurs during the execution of the program to be executed; If any abnormal information that meets the preset conditions appears in the status information, the preset alarm procedure will be executed.

5. The task execution method according to claim 1, characterized in that, The step of obtaining the target program name of at least one program to be executed includes: Create a program information list, which includes at least one of the following: program name, program execution cycle, program code entry point, and historical modification records of the code entry point; If the current time point is the start time point of the running cycle, then the program name corresponding to the running cycle is used as the target program name of the program to be executed.

6. The task execution method according to claim 1, characterized in that, The process of creating and initializing at least one reused process in memory further includes: Monitor whether the version information of the programs in the code repository has changed; If a change in the program's version information is detected, the modified program's code entry point and the time information when the version information changed are obtained from the code repository. Initialize the at least one reused process that has been created in the memory.

7. A task execution device, characterized in that, include: A creation module is used to create and initialize at least one reused process in memory. The reused process indicates that the process can be reused multiple times. The reused process is not destroyed after the program runs. Under the condition that the version information of the program in the code repository has changed, the at least one reused process already created in memory is re-initialized so that the program with the new version information can use it. The first acquisition module acquires the target program name of at least one program to be executed and determines the target code entry point corresponding to the target program name; The second acquisition module is used to acquire the executable program corresponding to the target code entry point from a preset code repository; A loading module is used to load the program to be executed into the at least one multiplexed process to run the program to be executed.

8. An electronic device comprising a memory, a processor, and a computer program stored in the memory, characterized in that, The processor executes the computer program to implement the steps of the task execution method according to any one of claims 1-6.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the task execution method according to any one of claims 1-6.

10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the task execution method according to any one of claims 1-6.

Citation Information

Patent Citations

  • Running process multiplexing method and device

    CN111913707A

  • Data loading method, device and apparatus, and computer readable storage medium

    CN112559081A