Task processing method and device, equipment and storage medium

By determining the task execution method and optimizing the processing of asynchronous task queues, the system resource occupation problem caused by unconditional asynchronous tasks is solved, and efficient management of system resources and improvement of user experience is achieved.

CN119201373APending Publication Date: 2024-12-27CHINA CONSTRUCTION BANK +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411161186.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-22
Publication Date
2024-12-27

AI Technical Summary

Technical Problem

In the prior art, unconditional asynchronous tasks lead to excessive tasks, occupying a large number of system resources, resulting in system performance degradation or resource exhaustion.

Method used

Confirm the policy by obtaining the type of tasks to be executed and the pre-configured execution method, and determine the execution method of the task. If the number of tasks is less than the preset number, perform asynchronous execution. Otherwise, the task is stored in the asynchronous task queue, and according to the task priority and system resources The conditions are executed in turn.

Benefits of technology

Effectively manage system resources, avoid performance degradation and resource exhaustion caused by excessive tasks, and improve system stability and user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119201373A_ABST
    Figure CN119201373A_ABST
Patent Text Reader

Abstract

The invention provides a task processing method and device, equipment and a storage medium, and relates to the technical field of computers. The method comprises the steps of obtaining a to-be-executed task, wherein the type of the to-be-executed task is a data import task or a data export task; according to the to-be-executed task and a pre-configured execution mode confirmation strategy, the execution mode of the to-be-executed task is determined, the execution mode comprises synchronous execution or asynchronous execution, and the execution mode confirmation strategy is related to at least one of the task identifier, the task type, the system resource and the data volume; when it is determined that the execution mode is asynchronous execution, asynchronous execution is conducted on the to-be-executed task, and an execution result is output. The problems that in the prior art, tasks are too many, a large number of system resources are occupied, system performance is reduced or resources are exhausted can be solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a task processing method, device, equipment and storage medium. Background Art

[0002] Most current computer systems perform import and export operations synchronously, which means that when a user initiates an import or export request on the front-end interface, the system immediately starts the operation, and the user must wait for the operation to complete before continuing with other operations. This synchronous operation causes users to wait too long on the front-end interface, affecting the user experience. For example, if a user needs to import an Excel file containing a large amount of data, the system may take several minutes or even longer to complete the import operation. During this period, the user interface will remain in a waiting state, and the user cannot perform other operations. If the system fails to complete the import or export operation within the scheduled time, it may cause the operation to fail or the system to be abnormal.

[0003] In order to improve the user experience and reduce the risk of timeouts, the existing task processing method mainly changes the import and export operations to asynchronous mode. Asynchronous operations allow the system to execute import or export tasks in the background, and the user interface can immediately return a response without the user having to wait for the operation to complete. For example, when a user initiates an import request, the system can immediately return a task identifier (Identity Document, ID) to the user, and the user can query the import progress and results through the task ID. However, executing a large number of asynchronous tasks at the same time may occupy a large amount of system resources, resulting in system performance degradation or resource exhaustion. Summary of the invention

[0004] The present application provides a task processing method, apparatus, device and storage medium to solve the problem in the prior art that unconditional asynchronous tasks lead to too many tasks, occupy a large amount of system resources, and cause system performance degradation or resource exhaustion.

[0005] In the first aspect, the present application provides a task processing method, including: obtaining a task to be executed, the type of the task to be executed is a data import task or a data export task; confirming a strategy based on the task to be executed and a pre-configured execution method, determining the execution method of the task to be executed, the execution method including synchronous execution or asynchronous execution, and the execution method confirmation strategy is related to at least one of the task identifier, task type, system resources, and data volume; when it is determined that the execution method is asynchronous execution, asynchronously executing the task to be executed, and outputting the execution result.

[0006] In one possible design, when it is determined that the execution mode is asynchronous execution, the tasks to be executed are executed asynchronously and the execution results are output, including: when it is determined that the execution mode is asynchronous execution, the number of tasks currently being executed asynchronously is determined; if the number of tasks is less than the preset number of tasks, the tasks to be executed are executed asynchronously and the execution results are output.

[0007] In a possible design, the task processing method also includes: if the number of tasks is greater than or equal to the preset number of tasks, the tasks to be executed are stored in an asynchronous task queue, and the asynchronous task queue is used to store the identifiers of tasks waiting for asynchronous execution; according to preset execution conditions, the tasks corresponding to each identifier in the asynchronous task queue are executed in sequence, and the preset execution conditions are related to the task priority, the time of reaching the asynchronous task queue, and at least one of the task type.

[0008] In one possible design, a strategy is confirmed based on the task to be executed and a pre-configured execution method to determine the execution method of the task to be executed, including: performing data verification on the task to be executed, the data verification includes at least one of a non-empty check, a non-zero check, a range check, a format check, and a uniqueness check; if the task to be executed passes the data verification, a strategy is confirmed based on the task to be executed and a pre-configured execution method to determine the execution method of the task to be executed.

[0009] In one possible design, after determining that the execution mode is asynchronous execution, the method also includes: recording relevant information of the task to be executed in an asynchronous task table, the relevant information including the identification and status of the task to be executed, and the status is not executed; accordingly, after outputting the execution result, the method also includes: updating the status corresponding to the task to be executed in the asynchronous task table to executed.

[0010] In one possible design, before obtaining the task to be executed, the method also includes: obtaining a rule table, the rule table including an execution mode confirmation strategy, a task priority of each task, and resource limitation information; accordingly, when it is determined that the execution mode is asynchronous execution, the task to be executed is executed asynchronously, and the execution result is output, including: when it is determined that the execution mode is asynchronous execution, obtaining the target resource limitation information of the task to be executed from the rule table; according to the target resource limitation information, the task to be executed is executed asynchronously, and the execution result is output.

[0011] In a possible design, the task processing method further includes: if the execution result indicates that the task to be executed has failed, storing the failure reason of the task to be executed in the asynchronous task table.

[0012] In the second aspect, the present application provides a task processing device, including: a task acquisition module, used to acquire a task to be executed, the type of the task to be executed is a data import task or a data export task; an execution strategy confirmation module, used to confirm the strategy according to the task to be executed and a pre-configured execution method, and determine the execution method of the task to be executed, the execution method including synchronous execution or asynchronous execution, and the execution method confirmation strategy is related to at least one of the task identifier, task type, system resources, and data volume; an execution module, used to asynchronously execute the task to be executed when it is determined that the execution method is asynchronous execution, and output the execution result.

[0013] In a third aspect, an embodiment of the present application provides an electronic device, comprising: at least one processor and a memory; the memory stores computer execution instructions; at least one processor executes the computer execution instructions stored in the memory, so that the at least one processor executes the task processing method as described in the first aspect above and various possible designs of the first aspect.

[0014] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, in which computer execution instructions are stored. When a processor executes the computer execution instructions, the task processing method as described in the first aspect and various possible designs of the first aspect are implemented.

[0015] In a fifth aspect, an embodiment of the present application provides a computer program product, including a computer program. When the computer program is executed by a processor, it implements the task processing method as described in the first aspect and various possible designs of the first aspect.

[0016] The task processing method, device, equipment and storage medium provided by the present application obtain the task to be executed, the type of the task to be executed is a data import task or a data export task; according to the task to be executed and the pre-configured execution mode confirmation strategy, the execution mode of the task to be executed is determined, the execution mode includes synchronous execution or asynchronous execution, and the execution mode confirmation strategy is related to at least one of the task identifier, task type, system resources, and data volume; when the execution mode is determined to be asynchronous execution, the task to be executed is asynchronously executed and the execution result is output. The present application can solve the problem of too many tasks, occupying a large amount of system resources, and system performance degradation or resource exhaustion in the prior art. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0018] Figure 1 Application scenario diagram for task processing of existing technologies;

[0019] Figure 2It is an application scenario diagram of the task processing method applicable to the embodiment of the present application;

[0020] Figure 3 The process of the task processing method provided in the embodiment of the present application Figure 1 ;

[0021] Figure 4 The process of the task processing method provided in the embodiment of the present application Figure 2 ;

[0022] Figure 5 The process of the task processing method provided in the embodiment of the present application Figure 3 ;

[0023] Figure 6 A schematic diagram of the structure of a task processing device provided in an embodiment of the present application;

[0024] Figure 7 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application.

[0025] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION

[0026] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.

[0027] In the technical solution of this application, the collection, storage, use, processing, transmission, provision and disclosure of information such as financial data or user data involved shall comply with the provisions of relevant laws and regulations and shall not violate public order and good morals.

[0028] It should be noted that in the embodiments of the present application, certain software, components, models and other existing solutions in the industry may be mentioned, and they should be regarded as exemplary. Their purpose is only to illustrate the feasibility of implementing the technical solution of the present application, but it does not mean that the applicant has or will necessarily use the solution.

[0029] Terminology explanation:

[0030] Central Processing Unit (CPU): As the computing and control core of the computer system, it is the final execution unit for information processing and program running.

[0031] Figure 1 This is an application scenario diagram for task processing in the prior art. Figure 1 As shown, the application scenario includes: a front end 11 and a server back end 12.

[0032] In the prior art, a user initiates an import or export task request at the front end 11. After receiving the task request, the server back end 12 generates a unique task ID corresponding to the task request. The server back end 12 puts the task information (including the task ID and related task data) into a task queue and returns the task ID to the front end 11. The user can query the progress and results of the task through the task ID. For the tasks in the task queue, one or more consumers in the server back end 12 consume them, thereby performing the import or export operation and updating the task status and progress information.

[0033] However, the prior art is only applicable to smaller-scale tasks. For asynchronous tasks that take very little time, the user operation experience of the front end 11 is not good. When there are too many asynchronous tasks, the asynchronous tasks need to occupy additional system resources, such as threads and memory. In addition, since the prior art simply puts the asynchronous tasks into the task queue and executes them in the order in which the tasks enter the queue, it is easy to cause message accumulation, which cannot be consumed in time and the task execution order cannot be flexibly adjusted.

[0034] In response to the above technical problems, this application proposes the following technical ideas: confirm strategies for different task types and task execution methods, and confirm the task execution method of the task. In other words, for exports of a small order of magnitude, synchronous exports can be performed without affecting the user experience; for exports of a large order of magnitude, they will be transferred to the asynchronous task table for asynchronous execution to ensure that the backend will not cause system abnormalities due to too many tasks.

[0035] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.

[0036] Figure 2 FIG. 1 is an application scenario diagram of the task processing method applicable to the embodiment of the present application. Figure 2As shown, the application scenario includes: a front end 21 and a server back end 22. Among them, an asynchronous task table and a rule table are set in the server back end 22. The front end 21 is used to send an export or import task request to the server back end 22. After receiving the task instruction, the server back end 22 first determines the task type. For the import task, it is added to the asynchronous task table after a simple verification, and error data feedback is given for those that fail the simple verification; for the export task, the server back end 22 determines whether the export task can be executed according to its configured parameters and the preset rule table, and adds the tasks that cannot be executed and the tasks that need to be executed asynchronously to the asynchronous task table, and executes the tasks that can be executed synchronously synchronously; when executing the tasks in the asynchronous execution table, each asynchronous task can be checked cyclically in combination with the execution conditions in the rule table, and the asynchronous tasks that meet the conditions are executed. The task processing method of the embodiment of the present application is based on an asynchronous task table and a rule table to manage the import and export operations in the system, and determines the execution mode (synchronous or asynchronous) of the task according to different conditions, providing unified task management and rule definition, so that the system can flexibly schedule tasks according to different conditions, while not affecting the user experience, ensuring that the server backend 22 will not cause system abnormalities due to too many tasks.

[0037] based on Figure 2 In the application scenario shown, an embodiment of the present application also provides a task processing method. Figure 3 The process of the task processing method provided in the embodiment of the present application Figure 1 .like Figure 3 As shown, the task processing method includes:

[0038] S301. Obtain a task to be executed, where the type of the task to be executed is a data import task or a data export task.

[0039] The execution subject of the method of this embodiment may be Figure 2 The server backend shown in may also be a task processing system in the server, and the task processing system may be implemented by software.

[0040] In this embodiment, the tasks to be executed may be triggered according to relevant instructions or task requests, and these tasks may be data import tasks or data export tasks. The type of task and related information may be stored in a task information table, including task ID, task type, creation time, status, etc.

[0041] S302. Determine the execution mode of the task to be executed according to the task to be executed and the pre-configured execution mode confirmation strategy, wherein the execution mode includes synchronous execution or asynchronous execution, and the execution mode confirmation strategy is related to at least one of the task identifier, task type, system resources, and data volume.

[0042] In this embodiment, the pre-configured execution mode confirmation strategy can be stored in the form of a rule table. There are many related factors of the execution mode confirmation strategy. It can be understood that the task identifier can be a priority or other special processing requirements; different task types, that is, import tasks or export tasks may have different execution strategies; system resources are the resource usage of the current system, such as CPU, memory, network bandwidth, etc.; data volume is the amount of data involved in the task, and tasks with large data volumes may be more suitable for asynchronous execution.

[0043] Specifically, determining the execution mode of the task to be executed can be to first identify whether the current system resources can enable the task to be executed. For example, if the current CPU usage is 85%, which exceeds the threshold of 80%, the task cannot be executed immediately and needs to be converted to an asynchronous task. If the current system resources can enable the task to be executed, it is necessary to further determine whether the task to be executed is executed synchronously or asynchronously based on the task characteristics and system status. It can be understood that if the task type of the task to be executed is complex or the system load is high, the task to be executed needs to be executed asynchronously.

[0044] As an example but not limitation, for an export task to be executed, the task ID is 123, the task type is data export, and the data volume is 500MB. It is judged according to the pre-configured execution mode confirmation strategy. According to its task ID, it can be determined that it does not have a special priority task identifier. Then, according to its task type of data export, it is necessary to determine the resources and data volume. If the current system CPU utilization rate is 70% and the memory utilization rate is 60%, it is determined according to the pre-configured execution mode confirmation strategy that the current system resources are tight, and the data volume exceeding 100MB is a large data volume. According to the comprehensive judgment result, the task is confirmed to be executed asynchronously.

[0045] S303: When it is determined that the execution mode is asynchronous execution, the task to be executed is executed asynchronously and the execution result is output.

[0046] In this step, if it is determined that a task needs to be executed asynchronously, the task can be put into the asynchronous task table. For each asynchronous task in the asynchronous task table, these tasks can be executed one by one according to system resources and task priority. Further, the execution result can be updated in the task information table and returned to the front-end user after the task is completed.

[0047] It is understandable that the output method can be to send the execution result to the initiator of the task to be executed so that it can be displayed on the terminal page. Specifically, the execution result is related to the task type. If it is an import task, the execution result is import success or import failure; if it is an export task, the execution result is export success or export failure.

[0048] It should be noted that if the execution mode is determined to be synchronous execution, it means that the task can be executed immediately without asynchronous processing. Therefore, directly executing the synchronous task at this time can improve task processing efficiency and reduce unnecessary asynchronous operations.

[0049] The task processing method provided in this embodiment obtains a task to be executed, where the type of the task to be executed is a data import task or a data export task; determines the execution mode of the task to be executed according to the task to be executed and a pre-configured execution mode confirmation strategy, where the execution mode includes synchronous execution or asynchronous execution, and the execution mode confirmation strategy is related to at least one of the task identifier, task type, system resources, and data volume; when it is determined that the execution mode is asynchronous execution, the task to be executed is asynchronously executed, and the execution result is output, which can solve the problems of too many tasks, occupying a large amount of system resources, and system performance degradation or resource exhaustion in the prior art.

[0050] Figure 4 The process of the task processing method provided in the embodiment of the present application Figure 2 .like Figure 4 As shown, the task processing method includes the following steps:

[0051] S401: When it is determined that the execution mode is asynchronous execution, determine the number of tasks currently being asynchronously executed.

[0052] In this embodiment, after determining that the execution mode is asynchronous execution, it is necessary to further determine the number of tasks currently being asynchronously executed. This step is to ensure that the system does not cause resource exhaustion or performance degradation due to too many asynchronous tasks.

[0053] S402: If the number of tasks is less than the preset number of tasks, asynchronously execute the tasks to be executed and output the execution results.

[0054] It is understandable that a maximum number of asynchronous tasks can be preset, and this number is pre-configured according to the processing power and resource conditions of the system. In this step, it is determined whether the number of tasks currently being executed asynchronously is less than this preset value. If the number of tasks is less than the preset number of tasks, the new tasks to be executed can be safely executed asynchronously; if the number of tasks is greater than or equal to the preset number of tasks, the new asynchronous tasks will not be executed temporarily until resources are available.

[0055] For example, for a pending task that has been confirmed to be executed asynchronously, after querying the number of tasks currently being executed asynchronously, it is found that there are currently 3 tasks being executed, and the preset maximum number of asynchronous tasks is 5. The current number of tasks is less than the preset value, so new asynchronous tasks can continue to be executed.

[0056] In a possible implementation manner, after determining the number of tasks currently being asynchronously executed, if the number of tasks is greater than or equal to a preset number of tasks, the task processing method provided in this embodiment further includes the following steps:

[0057] a1. Store the tasks to be executed in an asynchronous task queue, which is used to store the identifiers of tasks waiting for asynchronous execution.

[0058] a2. According to preset execution conditions, the tasks corresponding to the identifiers in the asynchronous task queue are executed in sequence, where the preset execution conditions are related to at least one of the task priority, the time when the task reaches the asynchronous task queue, and the task type.

[0059] It is understandable that if it is found that the current number of asynchronous tasks is greater than or equal to the preset maximum number of asynchronous tasks, the new asynchronous task cannot be executed immediately. At this time, the new task to be executed needs to be stored in the asynchronous task queue for waiting. However, for the tasks in the asynchronous task queue, the execution order is not necessarily completely in the order of entering the queue. For example, for tasks with higher priority, their execution order should be higher; or different types of tasks may have different execution strategies; and in order to ensure that the tasks to be executed will not expire, it is necessary to control the length of time that the tasks enter the asynchronous task queue. Therefore, the execution conditions can be preset to determine the execution order of the tasks in the asynchronous task queue.

[0060] In this embodiment, by reasonably controlling the number of asynchronous tasks, in high concurrency or large data volume scenarios, reasonably controlling the number of asynchronous tasks can improve the stability of the system and avoid system crashes caused by overload.

[0061] Figure 5 The process of the task processing method provided in the embodiment of the present application Figure 3 .like Figure 5 As shown, the task processing method includes the following steps:

[0062] S501 , performing data verification on the task to be executed, wherein the data verification includes at least one of a non-empty check, a non-zero check, a range check, a format check, and a uniqueness check.

[0063] It is understandable that data validation is an important step to ensure the integrity and correctness of task data. Non-empty check is to check whether the data field is empty, so as to ensure that the necessary data items have been filled; non-zero check is to check whether the numeric field is zero, so as to ensure the validity of the numeric data; range check is to check whether the numeric or date field is within the preset range, so as to ensure that the data is within a reasonable range; format check is mainly to check whether the format of the data field meets the expectations, such as the date format; uniqueness check is to check whether the data is unique in the system to avoid duplicate data.

[0064] In this step, the data verification method can be one of the above methods, or a combination of two or more.

[0065] S502: If the task to be executed passes the data verification, a strategy is confirmed according to the task to be executed and a pre-configured execution method to determine the execution method of the task to be executed.

[0066] In this step, the execution mode of the task to be executed is still determined according to the pre-configured execution mode confirmation strategy.

[0067] It should be noted that in this embodiment, if the task to be executed fails to pass the data verification, the error information is directly returned, which can better support the user to modify the information. In other words, by performing data verification on the task to be executed, obviously erroneous data can be quickly filtered out, the subsequent processing burden can be reduced, the data quality can be improved, unnecessary asynchronous tasks can be reduced, and the user experience can be improved according to the feedback mechanism.

[0068] In a possible implementation, if it is determined that the execution mode is asynchronous execution, it further includes: recording relevant information of the task to be executed in an asynchronous task table, the relevant information including the identifier and status of the task to be executed, and the status is not executed.

[0069] In this embodiment, the asynchronous task table is used to record the relevant information of the tasks to be executed. The asynchronous task table can be used to manage and track the status and execution status of all asynchronous tasks.

[0070] Specifically, in the asynchronous task table, the relevant information recorded may include the task ID, task type, creation time, and task execution status of the task to be executed (the initial status of the task in the asynchronous task table is "not executed"), and may also include the task priority, or task parameters, expected execution time, etc.

[0071] Correspondingly, after outputting the execution result, the method further includes: updating the status corresponding to the task to be executed in the asynchronous task table to executed.

[0072] When the asynchronous task is completed, the system will update the status of the task in the asynchronous task table to "executed", which can ensure that the execution status of the task is accurately recorded, facilitating subsequent query and management.

[0073] In a possible implementation, if the execution result indicates that the to-be-executed task fails to execute, the failure reason of the to-be-executed task is stored in the asynchronous task table.

[0074] It is understandable that when the asynchronous task is completed, the status of the task in the asynchronous task table is updated to "executed" or "failed to execute". If the task fails to execute, the system also needs to record the reason for the failure. Exemplarily, the failure reason may include the following information: error code, used to identify the specific error type; error description, which describes the specific cause of the error in detail; occurrence time, which records the time when the error occurred, and other relevant information such as error stack, related parameters, etc. By recording the relevant information and failure reasons of the task in the asynchronous task table, the problem can be quickly located and solved, and the stability of the system can be improved.

[0075] In this embodiment, by managing and recording each asynchronous task that needs to be executed through the asynchronous task table, the status and execution status of all asynchronous tasks can be conveniently tracked and managed. The user can timely understand the execution progress and results of the task, which improves the user experience. In addition, by recording and updating the task status, the integrity and correctness of the task data can be ensured, errors and anomalies can be reduced, and the stability of the system can be improved, avoiding system problems caused by improper task management.

[0076] In a possible implementation manner, before obtaining the tasks to be executed, the method further includes: obtaining a rule table, wherein the rule table includes an execution mode confirmation strategy, a task priority of each task, and resource limitation information.

[0077] It can be understood that the execution mode confirmation strategy can be used to determine whether the task is executed synchronously or asynchronously, and the priority of each task can be used for sorting during task scheduling; resource limitation information is the resource limitation required for each task during execution, such as CPU usage threshold, memory usage threshold, network bandwidth, etc.

[0078] Correspondingly, when it is determined that the execution mode is asynchronous execution, the task to be executed is executed asynchronously and the execution result is output, including: when it is determined that the execution mode is asynchronous execution, the target resource restriction information of the task to be executed is obtained from the rule table; according to the target resource restriction information, the task to be executed is executed asynchronously and the execution result is output.

[0079] In this embodiment, when the execution mode is determined to be asynchronous execution, the target resource limitation information of the task to be executed is obtained from the rule table. This information is used to ensure that the task does not exceed the system resource limitation during execution, thereby ensuring the stability and performance of the system.

[0080] For example, if the rule table includes: the execution mode confirmation policy is that when the data volume of the export task is greater than 100MB, asynchronous execution is adopted; the task priority is divided into three levels: high, medium and low, and the default is medium; the resource limitation information is that the CPU usage does not exceed 50%, and the memory usage does not exceed 60%. For an export task to be executed, its priority task identifier is high, and the data volume is 500MB. According to the execution mode confirmation policy, it is confirmed that the export task needs to be executed asynchronously. At this time, the target resource limitation information CPU of the task is obtained according to the rule table. According to the target resource limitation information and the CPU required for the task, it is determined that the task cannot be executed immediately. After adding the task to the asynchronous task queue, the task scheduler adjusts the execution order according to its priority. When the target resource limitation information meets the conditions, the export task is executed.

[0081] It should be noted that asynchronous tasks need to meet certain conditions before execution, such as system resources returning to an available state. Therefore, each asynchronous queue in the asynchronous task queue can be checked cyclically. For example, when the resource restriction information is that the CPU usage does not exceed 50%, the current CPU usage is 85%, which exceeds the threshold of 50%, and the execution condition is not met, the task to be executed needs to be asynchronously executed until the CPU usage drops below 80%, so as to ensure that the task is executed at the best time and improve system performance.

[0082] In this embodiment, the execution mode and execution status of each task are managed by setting a rule table. By reasonably controlling the execution mode and resource constraints of the tasks, the stability of the system can be improved and system problems caused by improper task management can be avoided.

[0083] Figure 6 This is a schematic diagram of the structure of the task processing device provided in the embodiment of the present application. Figure 6 As shown, the task processing device includes: a task acquisition module 61, an execution strategy confirmation module 62 and an execution module 63;

[0084] The task acquisition module 61 is used to acquire the task to be executed, and the type of the task to be executed is a data import task or a data export task;

[0085] An execution strategy confirmation module 62 is used to confirm a strategy according to the task to be executed and a pre-configured execution mode, and determine the execution mode of the task to be executed, where the execution mode includes synchronous execution or asynchronous execution, and the execution mode confirmation strategy is related to at least one of the task identifier, task type, system resources, and data volume;

[0086] The execution module 63 is used to asynchronously execute the task to be executed and output the execution result when the execution mode is determined to be asynchronous execution.

[0087] In some embodiments, the execution module 63 is specifically used to: when determining that the execution mode is asynchronous execution, determine the number of tasks currently being asynchronously executed; if the number of tasks is less than the preset number of tasks, asynchronously execute the tasks to be executed and output the execution results.

[0088] In some embodiments, the task processing device also includes an asynchronous task checking module 64, which is used to: if the number of tasks is greater than or equal to the preset number of tasks, store the tasks to be executed in an asynchronous task queue, and the asynchronous task queue is used to store the identifiers of tasks waiting for asynchronous execution; according to preset execution conditions, execute the tasks corresponding to each identifier in the asynchronous task queue in sequence, and the preset execution conditions are related to at least one of the task priority, the time of reaching the asynchronous task queue, and the task type.

[0089] In some embodiments, the execution strategy confirmation module 62 is specifically used to: perform data verification on the task to be executed, the data verification includes at least one of non-empty check, non-zero check, range check, format check and uniqueness check; if the task to be executed passes the data verification, then confirm the strategy based on the task to be executed and the pre-configured execution method to determine the execution method of the task to be executed.

[0090] In some embodiments, the task processing device also includes an asynchronous task table update module 65, which is used to: record relevant information of the task to be executed in the asynchronous task table, the relevant information including the identification and status of the task to be executed, and the status is not executed; after outputting the execution result, update the status corresponding to the task to be executed in the asynchronous task table to executed.

[0091] In some embodiments, the execution strategy confirmation module 62 is specifically used to: obtain a rule table, which includes an execution method confirmation strategy, a task priority of each task, and resource limitation information; at this time, the execution module 63 is also specifically used to: when it is determined that the execution method is asynchronous execution, obtain the target resource limitation information of the task to be executed from the rule table; according to the target resource limitation information, asynchronously execute the task to be executed and output the execution result.

[0092] In some embodiments, the asynchronous task table updating module 65 is further specifically configured to: if the execution result indicates that the task to be executed has failed, store the failure reason of the task to be executed in the asynchronous task table.

[0093] The task processing device provided in the embodiment of the present application can be used to execute the technical solution of the task processing method in the above embodiment. Its implementation principle and technical effect are similar and will not be repeated here.

[0094] It should be noted that it should be understood that the division of the various modules of the above device is only a division of logical functions. In actual implementation, they can be fully or partially integrated into one physical entity, or they can be physically separated. And these modules can all be implemented in the form of software called by processing elements; they can also be all implemented in the form of hardware; some modules can also be implemented in the form of software called by processing elements, and some modules can be implemented in the form of hardware. For example, the template construction module 81 can be a separately established processing element, or it can be integrated in a chip of the above device. In addition, it can also be stored in the memory of the above device in the form of program code, and called and executed by a processing element of the above device. The function of the above template construction module 81. The implementation of other modules is similar. In addition, these modules can be fully or partially integrated together, or they can be implemented independently. The processing element here can be an integrated circuit with signal processing capabilities. In the implementation process, each step of the above method or each module above can be completed by an integrated logic circuit of hardware in the processor element or instructions in the form of software.

[0095] Figure 7 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Figure 7 As shown, the electronic device may include: a transceiver 71 , a processor 72 , and a memory 73 .

[0096] The processor 72 executes the computer execution instructions stored in the memory, so that the processor 72 executes the scheme in the above embodiment. The processor 72 can be a general-purpose processor, including a central processing unit CPU, a network processor (NP), etc.; it can also be a digital signal processor DSP, an application-specific integrated circuit ASIC, a field programmable gate array FPGA or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components.

[0097] The memory 73 is connected to the processor 72 via a system bus and completes communication between them. The memory 73 is used to store computer program instructions.

[0098] The transceiver 71 may be used to obtain information such as task requests.

[0099] The system bus can be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The system bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus. The transceiver is used to realize the communication between the database access device and other computers (such as clients, read-write libraries, and read-only libraries). The memory may include random access memory (RAM) and may also include non-volatile memory.

[0100] The electronic device provided in the embodiment of the present application may be the above-mentioned Figure 2 The terminal device at the back end of the server.

[0101] An embodiment of the present application also provides a chip for executing instructions, which is used to execute the technical solution of the task processing method in the above embodiment.

[0102] An embodiment of the present application further provides a computer-readable storage medium, in which computer instructions are stored. When the computer instructions are executed on a computer, the computer executes the technical solution of the task processing method of the above embodiment.

[0103] An embodiment of the present application also provides a computer program product, which includes a computer program stored in a computer-readable storage medium. At least one processor can read the computer program from the computer-readable storage medium. When at least one processor executes the computer program, the technical solution of the task processing method in the above embodiment can be implemented.

[0104] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of modules is only a logical function division, and there may be other division methods in actual implementation, such as multiple modules can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or modules, which can be electrical, mechanical or other forms.

[0105] The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to implement the solution of this embodiment.

[0106] In addition, each functional module in each embodiment of the present application can be integrated into one processing unit, or each module can exist physically separately, or two or more modules can be integrated into one unit. The above-mentioned module-composed unit can be implemented in the form of hardware or in the form of hardware plus software functional units.

[0107] The above-mentioned integrated module implemented in the form of a software function module can be stored in a computer-readable storage medium. The above-mentioned software function module is stored in a storage medium, including a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor to perform some steps of the methods of various embodiments of the present application.

[0108] It should be understood that the processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), etc. A general-purpose processor may be a microprocessor or any conventional processor. The steps of the method disclosed in the invention may be directly implemented as being executed by a hardware processor, or may be implemented by a combination of hardware and software modules in the processor.

[0109] The memory may include a high-speed RAM memory, and may also include a non-volatile storage NVM, such as at least one disk memory, and may also be a USB flash drive, a mobile hard disk, a read-only memory, a magnetic disk or an optical disk, etc.

[0110] The bus may be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, the bus in the drawings of the present application is not limited to only one bus or one type of bus.

[0111] The above storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk. The storage medium can be any available medium that can be accessed by a general or special purpose computer.

[0112] An exemplary storage medium is coupled to a processor so that the processor can read information from the storage medium and write information to the storage medium. Of course, the storage medium can also be a component of the processor. The processor and the storage medium can be located in an application specific integrated circuit (ASIC). Of course, the processor and the storage medium can also exist as discrete components in an electronic control unit or a main control device.

[0113] Those skilled in the art can understand that all or part of the steps of implementing the above-mentioned method embodiments can be completed by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, the steps of the above-mentioned method embodiments are executed; and the aforementioned storage medium includes: ROM, RAM, disk or optical disk and other media that can store program codes.

[0114] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present application.

Claims

1. A task processing method, characterized in that: include: Obtaining a task to be executed, where the type of the task to be executed is a data import task or a data export task; Determining the execution mode of the task to be executed according to the task to be executed and a pre-configured execution mode confirmation strategy, wherein the execution mode includes synchronous execution or asynchronous execution, and the execution mode confirmation strategy is related to at least one of the task identifier, the task type, the system resources, and the data volume; When it is determined that the execution mode is asynchronous execution, the task to be executed is asynchronously executed and the execution result is output.

2. The method according to claim 1, characterized in that: When it is determined that the execution mode is asynchronous execution, asynchronously executing the task to be executed and outputting the execution result includes: When it is determined that the execution mode is asynchronous execution, determining the number of tasks currently being asynchronously executed; If the number of tasks is less than the preset number of tasks, the tasks to be executed are asynchronously executed and the execution results are output.

3. The method according to claim 2, characterized in that The method further comprises: If the number of tasks is greater than or equal to the preset number of tasks, the tasks to be executed are stored in an asynchronous task queue, where the asynchronous task queue is used to store identifiers of tasks waiting for asynchronous execution; According to a preset execution condition, tasks corresponding to the identifiers in the asynchronous task queue are executed in sequence, wherein the preset execution condition is related to at least one of a task priority, a time when the task reaches the asynchronous task queue, and a task type.

4. The method according to any one of claims 1 to 3, characterized in that: The step of confirming a strategy based on the task to be executed and a pre-configured execution mode to determine the execution mode of the task to be executed includes: Performing data verification on the task to be executed, wherein the data verification includes at least one of a non-empty check, a non-zero check, a range check, a format check, and a uniqueness check; If the task to be executed passes the data verification, a strategy is confirmed according to the task to be executed and a pre-configured execution method to determine the execution method of the task to be executed.

5. The method according to any one of claims 1 to 3, characterized in that: After determining that the execution mode is asynchronous execution, the method further includes: Recording relevant information of the task to be executed in the asynchronous task table, wherein the relevant information includes an identifier and a status of the task to be executed, wherein the status is not executed; Accordingly, after outputting the execution result, the method further includes: The status corresponding to the to-be-executed task in the asynchronous task table is updated to executed.

6. The method according to claim 3, characterized in that: Before obtaining the task to be executed, the method further includes: Acquire a rule table, wherein the rule table includes the execution mode confirmation strategy, the task priority of each task, and resource limitation information; Correspondingly, when it is determined that the execution mode is asynchronous execution, the task to be executed is asynchronously executed and the execution result is output, including: When it is determined that the execution mode is asynchronous execution, obtaining target resource restriction information of the task to be executed from the rule table; According to the target resource restriction information, the task to be executed is asynchronously executed, and the execution result is output.

7. The method according to claim 5, characterized in that The method further comprises: If the execution result indicates that the to-be-executed task fails to execute, the failure reason of the to-be-executed task is stored in the asynchronous task table.

8. A task processing device, characterized in that: include: A task acquisition module is used to acquire tasks to be executed, where the type of the tasks to be executed is a data import task or a data export task; An execution strategy confirmation module, used to confirm the strategy according to the task to be executed and the pre-configured execution mode, and determine the execution mode of the task to be executed, wherein the execution mode includes synchronous execution or asynchronous execution, and the execution mode confirmation strategy is related to at least one of the task identifier, task type, system resources, and data volume; The execution module is used to asynchronously execute the task to be executed and output the execution result when it is determined that the execution mode is asynchronous execution.

9. An electronic device, characterized in that: include: A processor, and a memory communicatively connected to the processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory to implement the method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, which are used to implement the method according to any one of claims 1 to 7 when executed by a processor.

11. A computer program product, characterized in that The invention comprises a computer program, which implements the method according to any one of claims 1 to 7 when being executed by a processor.