CN117149365A - Task processing method, device, electronic equipment and storage medium - Google Patents

Task processing method, device, electronic equipment and storage medium Download PDF

Info

Publication number
CN117149365A
CN117149365A CN202210561272.3A CN202210561272A CN117149365A CN 117149365 A CN117149365 A CN 117149365A CN 202210561272 A CN202210561272 A CN 202210561272A CN 117149365 A CN117149365 A CN 117149365A
Authority
CN
China
Prior art keywords
task
processing
target
processed
new
Prior art date
Legal status (The legal status 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 status listed.)
Pending
Application number
CN202210561272.3A
Other languages
Chinese (zh)
Inventor
田镇源
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Jingdong Century Trading Co Ltd
Beijing Wodong Tianjun Information Technology Co Ltd
Original Assignee
Beijing Jingdong Century Trading Co Ltd
Beijing Wodong Tianjun Information Technology Co Ltd
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 Beijing Jingdong Century Trading Co Ltd, Beijing Wodong Tianjun Information Technology Co Ltd filed Critical Beijing Jingdong Century Trading Co Ltd
Priority to CN202210561272.3A priority Critical patent/CN117149365A/en
Publication of CN117149365A publication Critical patent/CN117149365A/en
Pending legal-status Critical Current

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/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • G06F9/4881Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues
    • 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/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/546Message passing systems or structures, e.g. queues
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/54Indexing scheme relating to G06F9/54
    • G06F2209/548Queue
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The application discloses a task processing method, a task processing device, electronic equipment and a storage medium, and relates to the technical field of computers. One embodiment of the method comprises the following steps: responding to a task trigger instruction, acquiring a corresponding task set to be processed, and issuing the trigger instruction to a processing program corresponding to the task set to be processed; searching a target task with the highest priority in a task set to be processed, and monitoring the processing state of the target task; responding to the processing state as the waiting result processing, and acquiring the processing result of the target task to judge whether the target task meets the execution condition or not; if yes, executing a processing result of the target task; if not, searching a new task with the highest priority and lower than the target task from the to-be-processed task set, updating the new task into the target task, and monitoring the corresponding processing state until the new task is empty or the processing result of the new task is executed. The implementation mode can solve the problems that the task serial triggering mode is used for determining the task to be executed, the time is long, and the efficiency is low.

Description

Task processing method, device, electronic equipment and storage medium
Technical Field
The present application relates to the field of computer technologies, and in particular, to a task processing method, a task processing device, an electronic device, and a storage medium.
Background
In the running process of a system such as an application, a plurality of scenes with the same task trigger conditions sometimes appear, so that when the trigger conditions are met, a corresponding task processing method needs to be configured to determine which task is executed. In the prior art, when a plurality of tasks simultaneously satisfy a trigger condition, a task with a high priority is usually triggered first, then whether the task with a high priority satisfies an execution condition is determined based on a processing result, when the task with a high priority satisfies the execution condition, a processing result of the task is executed, and when the task with a high priority does not satisfy the execution condition, a task with a low priority is triggered again, so that the task to be executed is determined by a task serial trigger mode, so as to process the task. However, in a task scenario where a task with a low priority is determined to be executed, this approach takes a long time and is inefficient.
Disclosure of Invention
In view of the above, embodiments of the present application provide a task processing method, device, electronic apparatus, and storage medium, which can solve the problems of long time and low efficiency that a task to be executed is determined by a task serial triggering method.
To achieve the above object, according to one aspect of the embodiments of the present application, there is provided a method of data comparison.
The task processing method of the embodiment of the application comprises the following steps: responding to a task trigger instruction, acquiring a corresponding task set to be processed, and issuing a trigger instruction to a processing program corresponding to the task set to be processed; searching a target task with the highest priority in the task set to be processed, and monitoring the processing state of the target task; responding to the processing state as waiting result processing, and acquiring a processing result of the target task to judge whether the target task meets an execution condition or not; if yes, executing the processing result of the target task; if not, searching a new task with highest priority and lower than the target task from the task set to be processed, and updating the new task into a new target task so as to monitor the corresponding processing state until the new task is empty or the processing result of the new task is executed.
In one embodiment, determining whether the target task satisfies an execution condition includes:
acquiring a parameter value of a preset parameter in the processing result to judge whether the parameter value is a target value or not;
if yes, determining that the target task meets an execution condition; if not, determining that the target task does not meet the execution condition.
In yet another embodiment, monitoring the processing state of the target task includes:
receiving task state updating information sent by a processing program corresponding to the task set to be processed so as to update state parameters of each task in the task set to be processed;
and monitoring the processing state of the target task based on the state parameter of the target task.
In yet another embodiment, searching the target task with the highest priority in the task set to be processed includes:
based on the order of priority from high to low, storing the tasks in the task set to be processed into a preset task queue;
and searching the target task from the task queue based on the sequence.
In yet another embodiment, searching for a new task with highest priority and lower than the target task from the set of tasks to be processed comprises:
and searching tasks which are adjacent to the target task and have lower priority than the target task from the task queue to determine the tasks as the new tasks.
In yet another embodiment, after executing the processing result of the target task, the method further includes:
and calling a preset task cleaning program to clean the tasks in the task queue.
In yet another embodiment, obtaining a corresponding set of tasks to be processed includes:
and acquiring a target event of the task triggering instruction, inquiring a task to be processed taking the target event as a triggering condition, and obtaining the task set to be processed.
To achieve the above object, according to another aspect of an embodiment of the present application, there is provided a task processing device.
The task processing device of the embodiment of the application comprises: the response unit is used for responding to the task trigger instruction, acquiring a corresponding task set to be processed and issuing the trigger instruction to a processing program corresponding to the task set to be processed; the monitoring unit is used for searching a target task with the highest priority in the task set to be processed and monitoring the processing state of the target task; the judging unit is used for responding to the processing state as the generated processing result and acquiring the processing result of the target task so as to judge whether the target task meets the execution condition or not; the processing unit is used for executing the processing result of the target task if yes; if not, searching a new task with highest priority and lower than the target task from the task set to be processed, and updating the new task into a new target task so as to monitor the corresponding processing state until the new task is empty or the processing result of the new task is executed.
In one embodiment, the judging unit is specifically configured to:
acquiring a parameter value of a preset parameter in the processing result to judge whether the parameter value is a target value or not;
if yes, determining that the target task meets an execution condition; if not, determining that the target task does not meet the execution condition.
In a further embodiment, the monitoring unit is specifically configured to:
receiving task state updating information sent by a processing program corresponding to the task set to be processed so as to update state parameters of each task in the task set to be processed;
and monitoring the processing state of the target task based on the state parameter of the target task.
In a further embodiment, the monitoring unit is specifically configured to:
based on the order of priority from high to low, storing the tasks in the task set to be processed into a preset task queue;
and searching the target task from the task queue based on the sequence.
In a further embodiment, the processing unit is specifically configured to:
and searching tasks which are adjacent to the target task and have lower priority than the target task from the task queue to determine the tasks as the new tasks.
In a further embodiment, the processing unit is specifically configured to:
and calling a preset task cleaning program to clean the tasks in the task queue.
In a further embodiment, the response unit is specifically configured to:
and acquiring a target event of the task triggering instruction, inquiring a task to be processed taking the target event as a triggering condition, and obtaining the task set to be processed.
To achieve the above object, according to still another aspect of an embodiment of the present application, there is provided an electronic apparatus.
An electronic device according to an embodiment of the present application includes: one or more processors; and the storage device is used for storing one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors are enabled to realize the task processing method provided by the embodiment of the application.
To achieve the above object, according to still another aspect of an embodiment of the present application, a computer-readable medium is provided.
A computer readable medium of an embodiment of the present application stores a computer program thereon, which when executed by a processor implements the task processing method provided by the embodiment of the present application.
One embodiment of the above application has the following advantages or benefits: in the embodiment of the application, a to-be-processed task set simultaneously issues a trigger instruction to a corresponding processing program to trigger tasks in the to-be-processed task set simultaneously, and then a target task with the highest priority in the to-be-processed task set is searched out to monitor the processing state of the target task; the processing state of the target task is waiting for result processing, and the target task is indicated to obtain the processing result, so that the processing result can be directly obtained, and whether the target task meets the execution condition or not is judged; if the task priority is not met, a new task with the highest priority in the tasks with the priority lower than the target task can be searched from the to-be-processed set, and then the new task is updated into the target task to judge whether the execution condition is met or not again. In the embodiment of the application, as the tasks to be processed are triggered in parallel, the tasks are processed simultaneously, and after the high-priority task is judged to not meet the execution condition, the processing result can be obtained without waiting the processing time of the low-priority task, thereby reducing the time consumption of task processing and improving the efficiency of task processing. In addition, in the embodiment of the application, each task to be processed is triggered simultaneously, but the judgment of whether the execution condition is met or not is not needed after all the processing states are the processing results of waiting, but the processing results can be obtained after the processing states of the tasks with high priority are the processing results of waiting, so that even if the processing time of different tasks is different, the processing results of the tasks with high priority can be processed first without changing the processing states of other tasks into the processing results of waiting when the processing time of the tasks with high priority is shorter, thereby further reducing the processing time of the tasks and improving the efficiency of the task processing.
Further effects of the above-described non-conventional alternatives are described below in connection with the embodiments.
Drawings
The drawings are included to provide a better understanding of the application and are not to be construed as unduly limiting the application. Wherein:
FIG. 1 is a schematic diagram of a system architecture of a task processing system according to an embodiment of the present application;
FIG. 2 is a schematic diagram of one main flow of a task processing method according to an embodiment of the present application;
FIG. 3 is a schematic diagram of yet another main flow of a task processing method according to an embodiment of the present application;
FIG. 4 is a schematic diagram of the main units of a task processing device according to an embodiment of the present application;
FIG. 5 is a diagram of yet another exemplary system architecture in which embodiments of the present application may be applied;
FIG. 6 is a schematic diagram of a computer system suitable for use in implementing embodiments of the present application.
Detailed Description
Exemplary embodiments of the present application will now be described with reference to the accompanying drawings, in which various details of the embodiments of the present application are included to facilitate understanding, and are to be considered merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the application. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
It is noted that embodiments of the application and features of the embodiments may be combined with each other without conflict. The technical scheme of the application obtains, stores, uses, processes and the like the data, which all meet the relevant regulations of national laws and regulations.
The embodiment of the application provides a task processing system which can be used for processing a task scene, in particular to a task processing scene under the condition that trigger conditions of a plurality of tasks are the same. The trigger conditions of the tasks are the same, and the trigger conditions are also satisfied at the same time. After each task is triggered, task processing can be carried out, the task processing generally comprises two steps, the first step carries out judgment on task execution conditions, if the first step determines that the execution conditions are met, the task execution of the second step is carried out, and a processing result is obtained, wherein the processing result at the moment is a processing result which needs to be executed subsequently; if the first step determines that the execution condition is not satisfied, the second step is not executed, and the processing result is obtained to be empty at the moment, that is, the processing result at the moment is not executed again later.
Specifically, a plurality of tasks with successful user login as trigger conditions are configured in an application system. For example, the a task is: if the login user is a new user logged in for the first time, popping up a coupon receiving popup window corresponding to the new user; the task B is as follows: if the login user is an old user who does not log in for the first time, popping up a coupon receiving popup window corresponding to the old user; the task C is as follows: if the currently executed preferential activities exist, popping up a preferential activity prompt popup window; the task D is as follows: if the version of the application system used by the user login is not the highest version, popup the popup window of version upgrade, wherein the task priority is A > B > C > D. It is necessary to determine which task of A, B, C, D to execute the processing result in order from high to low based on the priority after the user login is successful.
In an embodiment of the present application, a task processing system may include a task manager and a task processor, and fig. 1 is a system architecture diagram of the task processing system. The task manager can be used for managing task triggering and task result execution, and the task processor can be used for processing each task and obtaining a processing result and a processing state of the task. The task manager and the task processor establish connection and can be used for data transmission, and the task manager and the task processor can be located in the same device or can process different devices. The task processor may include a handler configured for task processing, running through a process or thread in the task processor. In particular, in the context of a certain application system described above, the task processing system may be specifically the application system.
The embodiment of the application provides a task processing method, which can be executed by a task manager in a system architecture shown in fig. 1, as shown in fig. 2, and comprises the following steps:
s201: responding to the task trigger instruction, acquiring a corresponding task set to be processed, and issuing the trigger instruction to a processing program corresponding to the task set to be processed.
The task trigger instruction may be automatic trigger or may be external instruction receiving trigger. The task manager receives the task trigger instruction and responds to the task trigger instruction, and can acquire the task information to be processed corresponding to the task trigger instruction, so as to obtain a task set to be processed.
Specifically, the task triggering instruction may include information for triggering the instruction, that is, a target event, where the target event represents a triggering condition of a task, so that a task taking the target event as the triggering condition may be queried, that is, a task to be processed, so as to obtain a set of tasks to be processed.
After the task manager acquires the task set to be processed, namely, the task set to be processed which meets the triggering condition is determined, a triggering instruction can be issued to a processing program corresponding to the task set to be processed, so that the task set to be processed is triggered in parallel, and the processing program corresponding to the task set to be processed represents a task processing program corresponding to each task to be processed in the task set to be processed. Each task processing program is preconfigured and is arranged on the task processor, so that the task manager can issue a trigger instruction to the task processor, and meanwhile, the trigger instruction comprises information of each task to be processed, so that after the task processor receives the trigger instruction, the corresponding processing program can be triggered based on the information of the task to be processed.
S202: searching a target task with the highest priority in a task set to be processed, and monitoring the processing state of the target task.
The tasks with the same triggering conditions are triggered simultaneously, and the processing result of which task to be processed is executed needs to be determined sequentially based on the order of the priority from high to low, so that the task to be processed with the highest priority can be searched out first. The priority of each task to be processed in the set to be processed is pre-configured, so that the task to be processed with the highest priority can be searched from the set of tasks to be processed based on the configured priority, and the task to be processed can be determined as the target task.
After the target task is determined, the processing state of the target task can be monitored. The processing state of the task may include a triggered state and a state waiting for the result to be processed, where the triggered state indicates that the processing program corresponding to the task is triggered to process the task, and the waiting for the result to be processed indicates that the processing program obtains the processing result, and after the target task obtains the processing result, the task manager may determine whether the processing result of the target task meets the execution condition, so that the processing state of the target task is monitored in this step.
In some embodiments, when the processing state of each task to be processed changes, the processing program of each task may send task state update information to the task manager, so that the task manager may monitor the processing state of each task. Specifically, the task manager may configure a status parameter for each task, so after receiving task status update information sent by a processing program corresponding to a task set to be processed, the status parameter of each task in the task set to be processed may be updated, so as to monitor a processing status of a target task based on the status parameter of the target task.
In still other embodiments, a task queue may be preset in the task manager to store tasks in the task set to be processed through the task queue, so in embodiments of the present application, the tasks in the task set to be processed may be stored in the task queue based on a priority order from high to low.
It should be noted that, in the embodiment of the present application, the tasks in the task set to be processed may be stored in the task queue by means of annotation or code injection.
S203: and responding to the processing state as the waiting result processing, and acquiring the processing result of the target task to judge whether the target task meets the execution condition.
The processing state of the target task is waiting for result processing, which means that the processing result of the target task is obtained in the task processor, so that the processing result can be obtained from the task processor. If the task processing judges that the execution condition is met, a processing result which needs to be further executed is generated, for example, a task A can generate a coupon receiving popup window corresponding to a new user; if the non-execution condition is judged to be satisfied during task processing, the processing result may be null, i.e., there is no processing result that needs to be further executed. It can be determined whether the target task satisfies the execution condition based on the processing result in this step.
Specifically, the processing result of the task may include a preset parameter for indicating whether the task satisfies the execution condition. When the task meets the execution condition, setting a parameter value of a preset parameter as a target value; when the task does not meet the execution condition, the parameter value of the preset parameter may be set to be a non-target value. For example, the target value may be set to true and the non-target value may be set to false. Therefore, the parameter value of the preset parameter in the processing result can be obtained in the step so as to judge whether the parameter value is a target value or not; if yes, determining that the target task meets the execution condition; if not, determining that the target task does not meet the execution condition.
S204: if yes, executing a processing result of the target task; if not, searching a new task with the highest priority and lower than the target task from the task set to be processed, updating the new task into the new target task, and monitoring the corresponding processing state until the new task is empty or the processing result of the new task is executed.
If yes, it is determined that the target task meets the execution condition, so that it can be determined that the task to be executed in the task set to be processed is the target task, a processing result of the target task can be executed, and a task processing flow is finished. If not, it is determined that the target task does not meet the execution condition, so that it is required to determine whether the task to be processed with low priority meets the execution condition again, and then a new task with highest priority and lower than the target task is searched from the set of tasks to be processed, so as to update the task to the target task. Since the processing state of the new task is the waiting result processing, it is determined whether the execution condition is satisfied, so after the new task is updated to the target task, the processing state of the new task can be monitored, and further, whether the new task satisfies the execution condition is determined through step S203, and the process is repeated until the new task is empty or the processing result of the new task is executed, so as to end the task processing flow.
The task manager stores the tasks to be processed into the task queue based on the order of the priority from high to low, so that after the target task does not meet the execution condition, the task adjacent to the target task and having the priority lower than that of the target task is searched from the task queue to be determined as a new task, and the checking and reading process of the new task is simplified.
It should be noted that, in the embodiment of the present application, the task manager may further configure a task cleaning program for cleaning the tasks in the task queue. In the step, after the processing result of the execution target task is determined, a task cleaning program can be called to clean task information in the task queue, so that the storage space of the task queue is released, and the utilization rate of resources is improved.
It should be noted that, in the embodiment of the present application, the task processor and the task manager are decoupled, and the task manager does not interfere with the task processing process in the task processing. The task manager acquires the task set to be processed when responding to the task trigger instruction, so that even if the task to be processed increases or decreases in the task processing system, the task set to be processed only has the influence on the data residual of the task to be processed, and the task processing mode in the task manager does not need to be logically changed, thereby improving the expandability of task processing.
In the embodiment of the application, as the tasks to be processed are triggered in parallel, the tasks are processed simultaneously, and after the high-priority task is judged to not meet the execution condition, the processing result can be obtained without waiting for the task processing time of the low-priority task, thereby reducing the total time consumption of task processing and improving the task processing efficiency. In addition, in the embodiment of the application, each task to be processed is triggered simultaneously, but the judgment of whether the execution condition is met or not is not needed after all the processing states are the processing results of waiting, but the processing results can be obtained after the processing states of the tasks with high priority are the processing results of waiting, so that even if the processing time of different tasks is different, the processing results of the tasks with high priority can be processed first without changing the processing states of other tasks into the processing results of waiting when the processing time of the tasks with high priority is shorter, thereby further reducing the processing time of the tasks and improving the efficiency of the task processing.
The task processing method in the embodiment of the present application is specifically described below by taking a task in which a task a, a task B, a task C, and a task D are configured in the above-mentioned certain application system, and a user login success is taken as a trigger condition, as shown in fig. 3, where the method includes:
s301: and responding to a task trigger instruction triggered by successful login of the user, acquiring a corresponding task set to be processed, and issuing the trigger instruction to a processing program corresponding to the task set to be processed.
The task set to be processed comprises a task A, a task B, a task C and a task D, and the processing programs corresponding to the task set to be processed comprise processing programs corresponding to the task A, the task B, the task C and the task D respectively.
S302: and storing the tasks in the task set to be processed to a preset task queue based on the order of the priority from high to low, and searching the target task with the highest priority from the task queue based on the order.
The priority order is A task > B task > C task > D task, so the order stored in the task queue is A task, B task, C task and D task in sequence, and the target task is A task.
S303: and receiving task state update information sent by a processing program corresponding to the task set to be processed so as to monitor the processing state of the target task.
S304: and responding to the processing state as the waiting result processing, and acquiring the processing result of the target task.
S305: judging whether the target task meets the execution condition, if so, executing step S309; if not, step S306 is performed.
S306: and searching a new task which is adjacent to the target task and has a lower priority than the target task from the task queue.
If the target task is the A task, judging that the A task does not meet the execution condition, and searching the B task from the task queue to be a new task.
S307: judging whether the new task is empty or not, if so, ending the task processing flow; if not, step S308 is performed.
Whether the new task is empty or not, which means that no new task with a lower priority than the non-target task is available, so that it can be determined that the non-task result is further executed, and the task processing flow can be ended.
S308: the new task is updated to the new target task, and step S303 is performed.
S309: and executing a processing result of the target task, and calling a preset task cleaning program to clean the task in the task queue.
After step S309 is executed, the task processing flow ends.
It should be noted that, in the embodiment of the present application, the data processing principle is the same as the corresponding data processing principle in the embodiment shown in fig. 2, and will not be described again.
In the embodiment of the application, as the tasks to be processed are triggered in parallel, the tasks are processed simultaneously, and after the high-priority task is judged to not meet the execution condition, the processing result can be obtained without waiting the processing time of the low-priority task, thereby reducing the time consumption of task processing and improving the efficiency of task processing. In addition, in the embodiment of the application, each task to be processed is triggered simultaneously, but the judgment of whether the execution condition is met or not is not needed after all the processing states are the processing results of waiting, but the processing results can be obtained after the processing states of the tasks with high priority are the processing results of waiting, so that even if the processing time of different tasks is different, the processing results of the tasks with high priority can be processed first without changing the processing states of other tasks into the processing results of waiting when the processing time of the tasks with high priority is shorter, thereby further reducing the processing time of the tasks and improving the efficiency of the task processing.
In order to solve the problems existing in the prior art, an embodiment of the present application provides a task processing device 400, as shown in fig. 4, the device 400 includes:
a response unit 401, configured to obtain a corresponding task set to be processed in response to a task trigger instruction, and issue a trigger instruction to a processing program corresponding to the task set to be processed;
a monitoring unit 402, configured to find a target task with a highest priority in the task set to be processed, and monitor a processing state of the target task;
a judging unit 403, configured to obtain a processing result of the target task in response to the processing state being a generated processing result, so as to judge whether the target task meets an execution condition;
a processing unit 404, configured to execute a processing result of the target task if yes; if not, searching a new task with highest priority and lower than the target task from the task set to be processed, and updating the new task into a new target task so as to monitor the corresponding processing state until the new task is empty or the processing result of the new task is executed.
It should be understood that the manner of implementing this embodiment is the same as that of implementing the embodiment shown in fig. 2, and will not be described here again.
In one embodiment, the determining unit 403 is specifically configured to:
acquiring a parameter value of a preset parameter in the processing result to judge whether the parameter value is a target value or not;
if yes, determining that the target task meets an execution condition; if not, determining that the target task does not meet the execution condition.
In yet another embodiment, the monitoring unit 402 is specifically configured to:
receiving task state updating information sent by a processing program corresponding to the task set to be processed so as to update state parameters of each task in the task set to be processed;
and monitoring the processing state of the target task based on the state parameter of the target task.
In yet another embodiment, the monitoring unit 402 is specifically configured to:
based on the order of priority from high to low, storing the tasks in the task set to be processed into a preset task queue;
and searching the target task from the task queue based on the sequence.
In yet another embodiment, the processing unit 404 is specifically configured to:
and searching tasks which are adjacent to the target task and have lower priority than the target task from the task queue to determine the tasks as the new tasks.
In yet another embodiment, the processing unit 404 is specifically configured to:
and calling a preset task cleaning program to clean the tasks in the task queue.
In yet another embodiment, the response unit 401 is specifically configured to:
and acquiring a target event of the task triggering instruction, inquiring a task to be processed taking the target event as a triggering condition, and obtaining the task set to be processed.
It should be understood that the manner of implementing this embodiment is the same as that of implementing the embodiment shown in fig. 2 or 3, and will not be described in detail herein.
In the embodiment of the application, as the tasks to be processed are triggered in parallel, the tasks are processed simultaneously, and after the high-priority task is judged to not meet the execution condition, the processing result can be obtained without waiting for the task processing time of the low-priority task, thereby reducing the total time consumption of task processing and improving the task processing efficiency. In addition, in the embodiment of the application, each task to be processed is triggered simultaneously, but the judgment of whether the execution condition is met or not is not needed after all the processing states are the processing results of waiting, but the processing results can be obtained after the processing states of the tasks with high priority are the processing results of waiting, so that even if the processing time of different tasks is different, the processing results of the tasks with high priority can be processed first without changing the processing states of other tasks into the processing results of waiting when the processing time of the tasks with high priority is shorter, thereby further reducing the processing time of the tasks and improving the efficiency of the task processing.
According to an embodiment of the present application, an electronic device and a readable storage medium are also provided.
The electronic equipment of the embodiment of the application comprises: at least one processor; and a memory communicatively coupled to the at least one processor; the memory stores instructions executable by the one processor, and the instructions are executed by the at least one processor, so that the at least one processor executes the task processing method provided by the embodiment of the application.
Fig. 5 illustrates an exemplary system architecture 500 to which the task processing method or task processing device of embodiments of the present application may be applied.
As shown in fig. 5, the system architecture 500 may include terminal devices 501, 502, 503, a network 504, and a server 505. The network 504 is used as a medium to provide communication links between the terminal devices 501, 502, 503 and the server 505. The network 504 may include various connection types, such as wired, wireless communication links, or fiber optic cables, among others.
A user may interact with the server 505 via the network 504 using the terminal devices 501, 502, 503 to receive or send messages or the like. Various client applications may be installed on the terminal devices 501, 502, 503.
The terminal devices 501, 502, 503 may be, but are not limited to, smartphones, tablets, laptop and desktop computers, and the like.
The server 505 may be a server providing various services, and may perform processing such as analysis on received data such as a task trigger instruction, and feed back a processing result (e.g., a processing result—merely an example) to the terminal device.
It should be noted that, the task processing method provided in the embodiment of the present application is generally executed by the server 505, and accordingly, the task processing device is generally disposed in the server 505.
It should be understood that the number of terminal devices, networks and servers in fig. 5 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
Referring now to FIG. 6, there is illustrated a schematic diagram of a computer system 600 suitable for use in implementing embodiments of the present application. The computer system shown in fig. 6 is merely an example, and should not be construed as limiting the functionality and scope of use of embodiments of the present application.
As shown in fig. 6, the computer system 600 includes a Central Processing Unit (CPU) 601, which can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 602 or a program loaded from a storage section 608 into a Random Access Memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the system 600 are also stored. The CPU 601, ROM 602, and RAM 603 are connected to each other through a bus 604. An input/output (I/O) interface 605 is also connected to bus 604.
The following components are connected to the I/O interface 605: an input portion 606 including a keyboard, mouse, etc.; an output portion 607 including a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, a speaker, and the like; a storage section 608 including a hard disk and the like; and a communication section 609 including a network interface card such as a LAN card, a modem, or the like. The communication section 609 performs communication processing via a network such as the internet. The drive 610 is also connected to the I/O interface 605 as needed. Removable media 611 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is installed as needed on drive 610 so that a computer program read therefrom is installed as needed into storage section 608.
In particular, according to embodiments of the present disclosure, the processes described above with reference to flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method shown in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication portion 609, and/or installed from the removable medium 611. The above-described functions defined in the system of the present application are performed when the computer program is executed by a Central Processing Unit (CPU) 601.
The computer readable medium shown in the present application may be a computer readable signal medium or a computer readable storage medium, or any combination of the two. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples of the computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present application, however, the computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, with the computer-readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present application. In this regard, each block in the flowchart or block diagrams may represent a unit, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units involved in the embodiments of the present application may be implemented in software or in hardware. The described units may also be provided in a processor, for example, described as: a processor includes a response unit, a monitoring unit, a judging unit, and a processing unit. Where the names of these units do not constitute a limitation on the unit itself in some cases, for example, a response unit may also be described as a "unit of the function of an instruction response unit".
As another aspect, the present application also provides a computer-readable medium that may be contained in the apparatus described in the above embodiments; or may be present alone without being fitted into the device. The computer readable medium carries one or more programs which, when executed by one of the devices, cause the device to perform the task processing method provided by the present application.
As another aspect, the present application further provides a computer program product, including a computer program, where the program when executed by a processor implements the task processing method provided by the embodiment of the present application.
The above embodiments do not limit the scope of the present application. It will be apparent to those skilled in the art that various modifications, combinations, sub-combinations and alternatives can occur depending upon design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present application should be included in the scope of the present application.

Claims (10)

1. A method of task processing, comprising:
responding to a task trigger instruction, acquiring a corresponding task set to be processed, and issuing a trigger instruction to a processing program corresponding to the task set to be processed;
searching a target task with the highest priority in the task set to be processed, and monitoring the processing state of the target task;
responding to the processing state as waiting result processing, and acquiring a processing result of the target task to judge whether the target task meets an execution condition or not;
if yes, executing the processing result of the target task; if not, searching a new task with highest priority and lower than the target task from the task set to be processed, and updating the new task into a new target task so as to monitor the corresponding processing state until the new task is empty or the processing result of the new task is executed.
2. The method of claim 1, wherein determining whether the target task satisfies an execution condition comprises:
acquiring a parameter value of a preset parameter in the processing result to judge whether the parameter value is a target value or not;
if yes, determining that the target task meets an execution condition; if not, determining that the target task does not meet the execution condition.
3. The method of claim 1, wherein monitoring the processing state of the target task comprises:
receiving task state updating information sent by a processing program corresponding to the task set to be processed so as to update state parameters of each task in the task set to be processed;
and monitoring the processing state of the target task based on the state parameter of the target task.
4. The method of claim 1, wherein searching for a highest priority target task in the set of tasks to be processed comprises:
based on the order of priority from high to low, storing the tasks in the task set to be processed into a preset task queue;
and searching the target task from the task queue based on the sequence.
5. The method of claim 4, wherein searching for new tasks from the set of tasks to be processed that have highest priority and are lower than the target task comprises:
and searching tasks which are adjacent to the target task and have lower priority than the target task from the task queue to determine the tasks as the new tasks.
6. The method of claim 4, further comprising, after performing the processing result of the target task:
and calling a preset task cleaning program to clean the tasks in the task queue.
7. The method of claim 1, wherein obtaining a corresponding set of tasks to be processed comprises:
and acquiring a target event of the task triggering instruction, inquiring a task to be processed taking the target event as a triggering condition, and obtaining the task set to be processed.
8. A task processing device, comprising:
the response unit is used for responding to the task trigger instruction, acquiring a corresponding task set to be processed and issuing the trigger instruction to a processing program corresponding to the task set to be processed;
the monitoring unit is used for searching a target task with the highest priority in the task set to be processed and monitoring the processing state of the target task;
the judging unit is used for responding to the processing state as the generated processing result and acquiring the processing result of the target task so as to judge whether the target task meets the execution condition or not;
the processing unit is used for executing the processing result of the target task if yes; if not, searching a new task with highest priority and lower than the target task from the task set to be processed, and updating the new task into a new target task so as to monitor the corresponding processing state until the new task is empty or the processing result of the new task is executed.
9. An electronic device, comprising:
one or more processors;
storage means for storing one or more programs,
when executed by the one or more processors, causes the one or more processors to implement the method of any of claims 1-7.
10. A computer readable medium, on which a computer program is stored, characterized in that the program, when being executed by a processor, implements the method according to any of claims 1-7.
CN202210561272.3A 2022-05-23 2022-05-23 Task processing method, device, electronic equipment and storage medium Pending CN117149365A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210561272.3A CN117149365A (en) 2022-05-23 2022-05-23 Task processing method, device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210561272.3A CN117149365A (en) 2022-05-23 2022-05-23 Task processing method, device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN117149365A true CN117149365A (en) 2023-12-01

Family

ID=88910611

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210561272.3A Pending CN117149365A (en) 2022-05-23 2022-05-23 Task processing method, device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN117149365A (en)

Similar Documents

Publication Publication Date Title
CN111427701A (en) Workflow engine system and business processing method
CN112596920A (en) Message processing method and device, electronic equipment and storage medium
CN113722056A (en) Task scheduling method and device, electronic equipment and computer readable medium
CN108764866B (en) Method and equipment for allocating resources and drawing resources
CN110413210B (en) Method, apparatus and computer program product for processing data
CN109873731B (en) Test method, device and system
CN109218338B (en) Information processing system, method and device
CN108696554B (en) Load balancing method and device
CN110515749B (en) Method, device, server and storage medium for queue scheduling of information transmission
CN113360815A (en) Request retry method and device
CN113760494B (en) Task scheduling method and device
CN115525411A (en) Method, device, electronic equipment and computer readable medium for processing service request
CN108933802B (en) Method and apparatus for monitoring operation
CN106933449B (en) Icon processing method and device
CN117149365A (en) Task processing method, device, electronic equipment and storage medium
CN114926045A (en) Operation management method and device
CN114064403A (en) Task delay analysis processing method and device
CN114374657A (en) Data processing method and device
CN109614137B (en) Software version control method, device, equipment and medium
CN112925623A (en) Task processing method and device, electronic equipment and medium
CN109213815B (en) Method, device, server terminal and readable medium for controlling execution times
CN111179097B (en) Method, device, electronic equipment and storage medium for modifying warranty
CN113391896B (en) Task processing method and device, storage medium and electronic equipment
CN110851150B (en) Method and apparatus for installing applications
CN112965827B (en) Information scheduling method and device, electronic equipment and computer medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination