Task processing and issuing method and computing device

By dividing tasks into parallel and serial parts, parallel processing utilizes multiple computing units, serial processing is executed in sequence, and progress communication is achieved through shared storage space, the problem of low task processing efficiency in the existing technology is solved and improved Computational efficiency and user experience.

CN118819821APending Publication Date: 2024-10-22XFUSION DIGITAL TECH CO LTD
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202410741564.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-07
Publication Date
2024-10-22

AI Technical Summary

Technical Problem

In the existing technology, multiple computing tasks that need to be executed sequentially lead to low efficiency in serial processing of messages, resulting in long task processing times. Especially in the process of large task message consumption, the advantages of parallel processing of multiple computing units cannot be effectively utilized.

Method used

Each task is divided into a first part of parallel execution and a second part of serial execution. The parallel processing part is processed in parallel by multiple computing units, and the serial processing part is processed in sequence by one computing unit, and parallelism is achieved through shared memory space. Progress communication between and serial processing to ensure sequential execution.

Benefits of technology

By making full use of the computing resources of multiple computing units, the computing efficiency is improved, the task processing time is shortened, the sequence requirements of serial processing are met, and the user experience is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118819821A_ABST
    Figure CN118819821A_ABST
Patent Text Reader

Abstract

The invention provides a task processing method, a task issuing method and computing equipment. The task processing method comprises the steps of obtaining a plurality of target tasks, wherein each target task comprises a first part which is executed in parallel and / or a second part which is executed in series; the plurality of target tasks are executed in the plurality of computing units respectively, the plurality of computing units execute the plurality of first parts of the plurality of target tasks in parallel, the first computing unit executes the plurality of second parts of the plurality of target tasks in series, and the first computing unit is one of the plurality of computing units or one computing unit except the plurality of computing units. According to the multi-task processing method and device, multi-task processing can be carried out by utilizing the parallel processing advantages of a plurality of computing units, and meanwhile, the sequential requirement of multi-task processing is met.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of computing devices, and in particular to a task processing method, a task issuing method and a computing device. Background Art

[0002] There are processing technologies in the art for multiple computing tasks that need to be executed sequentially. For example, these computing tasks can be multiple task messages arranged in a message queue, and the computing units (such as threads) that serve as message consumers process these task messages in sequence according to the order in which they are arranged in the message queue. However, the requirement for sequential execution causes these tasks to be processed only in one computing unit, making the serial processing of messages inefficient. This problem is more obvious in the process of consuming large task messages, resulting in excessively long task processing time. Summary of the invention

[0003] To this end, the present application is dedicated to providing a task processing method, a task issuing method and a computing device, which can utilize the parallel processing advantages of multiple computing units to perform multi-task processing.

[0004] On the one hand, the present application provides a task processing method, including: obtaining multiple target tasks, each target task includes a first part executed in parallel and / or a second part executed in serial, parallel execution means that the multiple first parts are respectively executed in parallel in different computing units or in different threads, and serial execution means that the multiple second parts are executed sequentially in the same computing unit or the same thread; executing the multiple target tasks in multiple computing units respectively, wherein the multiple computing units execute the multiple first parts of the multiple target tasks in parallel, the first computing unit executes the multiple second parts of the multiple target tasks in serial, and the first computing unit is one of the multiple computing units, or a computing unit other than the multiple computing units.

[0005] According to this aspect, each of the multiple target tasks is divided into a first part for parallel processing and a second part for serial processing. The parallel processing part is processed in parallel by multiple computing units, and the serial processing part is processed serially by one computing unit. In this way, the computing resources of multiple computing units can be fully utilized to maximize the computing efficiency while meeting the sequential requirements of serial processing.

[0006] In a possible implementation of the present application, multiple target tasks are obtained by splitting one overall task.

[0007] According to this implementation, multiple target tasks can be obtained by splitting a general task, so that the technical solution of this application is applicable to both multi-task processing scenarios and single-task processing scenarios. When facing a single task, the single general task can be split into multiple target tasks according to the method of this application, and then the multiple target tasks are processed, thereby using the method of this application to improve the task processing speed, expand the scope of application of the technical solution of this application, and improve the application value.

[0008] In a possible implementation of the present application, each target task includes a first-stage task and a second-stage task, the first-stage task includes a first-stage first part executed in parallel and / or a first-stage second part executed in serial, the second-stage task includes a second-stage first part executed in parallel and / or a second-stage second part executed in serial, and multiple second-stage tasks of multiple target tasks are executed after multiple first-stage tasks of multiple target tasks are completed.

[0009] According to this implementation, by dividing each target task into the first stage and the second stage, the one-time computing task amount of each computing unit can be reduced. By dividing into different stages, the computing unit can process tasks step by step in accordance with different stages in sequence, avoiding the large load and long waiting time caused by the one-time processing of large tasks, which is conducive to improving computing efficiency and enhancing user experience.

[0010] In a possible implementation of the present application, multiple target tasks are obtained, including: identifying a task tag for each target task; and dividing the multiple target tasks into parallel execution tasks and serial execution tasks according to the task tag, wherein the parallel execution task includes a first part or includes a first part and a second part, and the serial execution task includes the second part.

[0011] According to this implementation, by marking different task tags on the target task, the computing unit can process the target task differently according to the task tag. When the target task is marked as a parallel execution task, the target task can be assigned to different multiple computing units according to the tag for parallel processing. When the target task is marked as a serial execution task, the target task can be assigned to the same computing unit for serial processing. By controlling the execution mode of the target task through the tag, the execution of the task can be controlled in a simple, effective and low-cost manner, thereby improving the control capability and efficiency.

[0012] In a possible implementation of the present application, each target task includes a first part and a second part, the second part of each target task is processed after the first part is processed, and multiple target tasks are respectively executed in multiple computing units, including: after the computing unit finishes processing the first part of each target task, notifying the first computing unit to allow the first computing unit to process the second part of the corresponding target task.

[0013] According to this implementation, a notification mechanism is established between the computing units for parallel processing and the computing units for serial processing, so that the computing units for serial processing can perform serial processing strictly in accordance with the sequence requirements according to the progress of parallel processing, thereby avoiding confusion in the execution order.

[0014] In a possible implementation of the present application, after the computing unit completes processing the first part of the target task, the first computing unit is notified to allow the first computing unit to process the second part of the target task, including: storing end information indicating the end of processing the first part in a shared storage space; and allowing the first computing unit to read the end information from the shared storage space to obtain a notification of the end of processing the first part.

[0015] According to this implementation method, progress communication between parallel processing computing units and serial processing computing units is achieved by sharing storage space, which can effectively achieve smooth and reliable communication. By utilizing mature storage technology, the first unit can obtain end information on demand, which is convenient and fast.

[0016] In a possible implementation of the present application, the end information includes a key determined according to the task identifier of the first subtask and the processing result information of the first part, and the key and the processing result information constitute a key-value pair.

[0017] According to this implementation, by storing the end information in the form of key-value pairs, the processing result information with a larger amount of data can be matched with the key with a smaller amount of data, so that the end information can be obtained by querying and reading the key, reducing the amount of data processing and speeding up the operation.

[0018] In a possible implementation of the present application, the processing result information includes the processing result of the first part or the address where the processing result is stored.

[0019] According to this implementation, the processing results are stored at a certain address. For processing results with particularly large data volumes, the key-value pairs used to represent end information can have a smaller data volume, thereby facilitating the operation of the notification mechanism and reducing the shared storage space size requirements and data transmission performance requirements for storing key-value pairs.

[0020] In a possible implementation of the present application, the end information indicating the end of the first part of the processing is stored in a shared storage space, including: storing the key and the processing result information associated with the key in the shared storage space. Wherein, the first computing unit is made to read the end information from the shared storage space to obtain a notification of the end of the first part of the processing, including: searching the key-associated processing result information in the shared storage space according to the key. Wherein, the method also includes: after the first computing unit completes processing the second part of the target task, deleting the key and the processing result information associated with the key from the shared storage space.

[0021] According to this implementation method, by adopting the method of key query and deletion, the serial processing computing unit (i.e., the first unit) can efficiently obtain the processing progress of the parallel processing computing unit, and update and delete data in time to avoid data accumulation and occupying storage space, thereby achieving efficient use of data.

[0022] In a possible implementation of the present application, the first computing unit is one of multiple computing units, and the multiple computing units execute multiple first parts of multiple target tasks in parallel, including: processing the first part with a first task amount in the first computing unit, and processing the first part with a second task amount in other computing units of the multiple computing units except the first computing unit, wherein the first task amount is less than the second task amount.

[0023] According to this implementation, by reducing the task load of the first unit with serial processing tasks, the first unit can complete its part of the parallel processing tasks more quickly, making the distribution of tasks among multiple computing units more balanced, thereby achieving balanced and efficient use of computing resources.

[0024] On the other hand, the present application provides a task issuing method, comprising: dividing a total task into multiple target tasks; dividing each target task so that each target task includes a first part executed in parallel and / or a second part executed in serial, wherein the parallel execution means that the multiple first parts are respectively executed in parallel in different computing units or in different threads, and the serial execution means that the multiple second parts are executed sequentially in the same computing unit or the same thread; issuing the multiple target tasks to multiple computing units for processing, wherein the multiple computing units execute the multiple first parts of the multiple target tasks in parallel, the first computing unit executes the multiple second parts of the multiple target tasks in serial, and the first computing unit is one of the multiple computing units, or a computing unit other than the multiple computing units.

[0025] On the other hand, the present application provides a task processing device, including: an acquisition module, used to acquire multiple target tasks, each target task includes a first part executed in parallel and / or a second part executed in serial, parallel execution means that the multiple first parts are executed in parallel in different computing units or in different threads, and serial execution means that the multiple second parts are executed sequentially in the same computing unit or the same thread; an execution module, used to execute the multiple target tasks in multiple computing units respectively, wherein the multiple computing units execute the multiple first parts of the multiple target tasks in parallel, the first computing unit executes the multiple second parts of the multiple target tasks in serial, and the first computing unit is one of the multiple computing units, or a computing unit other than the multiple computing units.

[0026] In a possible implementation of the present application, multiple target tasks are obtained by splitting one overall task.

[0027] In a possible implementation of the present application, each target task includes a first-stage task and a second-stage task, the first-stage task includes a first-stage first part executed in parallel and / or a first-stage second part executed in serial, the second-stage task includes a second-stage first part executed in parallel and / or a second-stage second part executed in serial, and multiple second-stage tasks of multiple target tasks are executed after multiple first-stage tasks of multiple target tasks are completed.

[0028] In a possible implementation of the present application, the acquisition module is further configured to: identify the task tag of each target task; and divide the multiple target tasks into parallel execution tasks and serial execution tasks according to the task tag, wherein the parallel execution tasks include the first part or include the first part and the second part, and the serial execution tasks include the second part.

[0029] In a possible implementation of the present application, each target task includes a first part and a second part, and the second part of each target task is processed after the first part is processed. The execution module is further configured to: after the computing unit completes processing the first part of each target task, notify the first computing unit to allow the first computing unit to process the second part of the corresponding target task.

[0030] In a possible implementation of the present application, the execution module is further configured to: store end information indicating the end of the first part of the processing in a shared storage space; and enable the first computing unit to read the end information from the shared storage space to obtain a notification of the end of the first part of the processing.

[0031] In a possible implementation of the present application, the end information includes a key determined according to the task identifier of the first subtask and the processing result information of the first part, and the key and the processing result information constitute a key-value pair.

[0032] In a possible implementation of the present application, the processing result information includes the processing result of the first part or the address where the processing result is stored.

[0033] In a possible implementation of the present application, the execution module is further configured to: store the key and the processing result information associated with the key in a shared storage space. The execution module is further configured to: find the processing result information associated with the key in the shared storage space according to the key. The device is further configured to: delete the key and the processing result information associated with the key from the shared storage space after the first computing unit completes processing the second part of the target task.

[0034] In a possible implementation of the present application, the first computing unit is one of multiple computing units, and the execution module is further configured to: process a first part having a first task amount in the first computing unit, and process a first part having a second task amount in other computing units of the multiple computing units except the first computing unit, wherein the first task amount is less than the second task amount.

[0035] On the other hand, the present application provides a task processing system, comprising: multiple computing units, the multiple computing units respectively execute multiple target tasks, each target task includes a first part executed in parallel and / or a second part executed in serial, the parallel execution means that the multiple first parts are respectively executed in parallel in different computing units or in different threads, and the serial execution means that the multiple second parts are executed sequentially in the same computing unit or the same thread, wherein the multiple computing units execute the multiple first parts of the multiple target tasks in parallel; a first computing unit, the first computing unit executes the multiple second parts of the multiple target tasks in serial, and the first computing unit is one of the multiple computing units, or a computing unit other than the multiple computing units.

[0036] On the other hand, the present application provides a computing device, which includes a processor and a memory, and the processor is used to execute a computer program stored in the memory to implement the above-mentioned task processing method.

[0037] On the other hand, the present application provides a computer-readable storage medium, which stores a computer program, and the computer program is used to execute the above-mentioned task processing method.

[0038] On the other hand, the present application provides a computer program product, including program code, which enables a computer to implement the above-mentioned task processing method when the computer program product is executed on the computer.

[0039] Any of the task processing devices, task processing systems, computing devices, computer-readable storage media or computer program products provided above are used to execute the task processing methods provided above. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects of the corresponding schemes in the corresponding methods provided above, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] The specific implementation of the present application is described in detail below with reference to the accompanying drawings, wherein:

[0041] Figure 1 A schematic diagram showing a hardware architecture of a task processing method according to an embodiment of the present application;

[0042] Figure 2 A schematic diagram showing a process flow of a task processing method according to an embodiment of the present application;

[0043] Figure 3 A schematic diagram showing a flow chart of a task processing method according to another embodiment of the present application;

[0044] Figure 4 A schematic diagram showing a flow chart of a task processing method according to another embodiment of the present application;

[0045] Figure 5 A schematic diagram showing a flow chart of a task processing method according to another embodiment of the present application;

[0046] Figure 6 A schematic diagram showing a flow chart of a task processing method according to another embodiment of the present application;

[0047] Figure 7 A schematic diagram showing the structure of a task processing device according to an embodiment of the present application is shown;

[0048] Figure 8 A schematic diagram of the structure of a computing device according to an embodiment of the present application is shown. DETAILED DESCRIPTION

[0049] In order to make those skilled in the art understand the concept and thought of the present application more clearly, the present application is described in detail below in conjunction with specific embodiments. It should be understood that the embodiments provided herein are only a part of all embodiments that the present application may have. After reading the specification of the present application, those skilled in the art have the ability to make improvements, transformations, or replacements to part or all of the following embodiments, and these improvements, transformations, or replacements are also included in the scope of the present application.

[0050] In this document, the terms "one", "an" and other similar words are not intended to indicate that there is only one of the things described, but rather that the relevant description is only for one of the things described, and the things described may have one or more. In this document, the terms "comprises", "includes" and other similar words are intended to indicate logical relationships, and cannot be regarded as indicating spatial structural relationships. For example, "A includes B" is intended to indicate that B logically belongs to A, but does not mean that B is spatially located inside A. In addition, the meanings of the terms "comprises", "includes" and other similar words should be regarded as open, rather than closed. For example, "A includes B" is intended to indicate that B belongs to A, but B does not necessarily constitute the whole of A, and A may also include other elements such as C, D, and E.

[0051] In this document, the terms "first", "second" and other similar words are not intended to imply any order, quantity and importance, but are merely used to distinguish different elements. In this document, the terms "embodiment", "present embodiment", "one embodiment", "an embodiment" do not mean that the relevant description is only applicable to a specific embodiment, but rather that these descriptions may also be applicable to one or more other embodiments. Those skilled in the art should understand that in this document, any description made for a certain embodiment can be replaced, combined, or otherwise combined with the relevant description in one or more other embodiments, and the new embodiment produced by the replacement, combination, or other combination is easily conceivable by those skilled in the art and falls within the scope of protection of this application. In this document, "multitasking" is synonymous with "multiple tasks" and can be substituted for each other.

[0052] In each embodiment of the present application, task processing may refer to the processing, execution and implementation process of computing tasks by computing device hardware or software. Task processing includes single-task processing and multi-task processing. Single-task processing may refer to the processing process for one task. Multi-task processing may refer to the processing and calculation of multiple interrelated tasks by computing device hardware or software, and an overall goal is achieved by completing each task separately. For example, multi-task processing may refer to the system being able to run multiple processes at the same time, and each process may also execute multiple threads at the same time. For example, multi-task processing means that a user can run multiple applications at the same time, and each application is called a task.

[0053] The message queue is a typical producer and consumer model. It is mainly used for system decoupling, task asynchrony, and traffic peak shaving. The message queue is a communication mode for transmitting messages between applications or different components. It is essentially a queue for storing messages. The producer is a client that sends messages to the message queue. The consumer is a client that obtains data from the message queue. The introduction of message queues will introduce new problems, such as reduced system availability, disordered message consumption, and inconsistent data. In some specific business scenarios, there are strict requirements for the order of message consumption. For example, for the addition, deletion, and modification operations of an order, the messages for a certain record operation are added, modified, and deleted in order, but if multiple consumers execute deletion, modification, and addition, data errors will occur. Sequential consumption is consumption in the order in which the messages are sent.

[0054] Some technologies in this field can realize the sequential consumption of messages, but the sequential consumption of messages will lead to inefficient serial processing of messages, which is particularly obvious in the process of large task message consumption, resulting in long consumption time, heavy load on individual nodes, and inability to balance the use of multiple servers for parallel processing.

[0055] In some embodiments of the present application, the parallel parts of the multiple message consumption process are processed in parallel by multiple threads, which can fully balance the utilization of cluster server resources; in addition, the serial parts of the multiple message consumption process are processed serially by a single thread, which is simple and reliable and avoids the synchronization of multiple threads; in addition, under the premise of processing task messages in sequence, the execution time can be minimized.

[0056] In some embodiments of the present application, for the message consumption process with sequential requirements, the parallel execution process and the serial execution process are distinguished, the parallelizable parts are processed in parallel by multiple servers, and the non-parallel parts are processed by a single server, and the message processing efficiency is improved. In addition, by introducing a cache or other appropriate storage, the synchronization of parallel and serial execution of multiple message consumption threads is achieved.

[0057] Figure 1 A schematic diagram of the hardware architecture of a task processing method according to an embodiment of the present application is shown.

[0058] like Figure 1 As shown, in this embodiment, the producer is a server that generates task messages, and the producer can send task messages to the message queue. Figure 1 In the example, there are three task messages, namely, task message 1, task message 2, and task message 3. Those skilled in the art should know that the task message can have any suitable number and is not limited to three. The message queue can be formed in the producer server or in a separate server. The consumer is the server that receives the task message, for example, by listening to the message queue. Figure 1In the example, there are three consumers, namely, consumer 1, consumer 2, and consumer 3. Those skilled in the art should know that the number of consumers can be flexibly configured according to the number of task messages and the computing amount of the tasks issued by the producer, and is not limited to 3. Consumers 1, 2, and 3 obtain task messages 1, 2, and 3 respectively by monitoring the message queue, so that they can process the corresponding task messages.

[0059] Figure 2 A flowchart of a task processing method according to an embodiment of the present application is shown.

[0060] like Figure 2 As shown, the producer of the task message (e.g., a server that sends a task message to a message queue) first generates multiple target tasks, such as target task 1, target task 2, and target task 3. Since target task 1, target task 2, and target task 3 have sequential execution requirements, according to some technologies in the art, only one computing unit (e.g., computing unit 1) can sequentially complete target task 1, target task 2, and target task 3 (i.e., when divided into multiple parts, first part 1, second part 1, first part 2, second part 2, first part 3, and second part 3 are completed in sequence), resulting in excessively long task processing time and reduced computing efficiency.

[0061] According to this embodiment, each target task is divided by the producer into a first part that can be processed in parallel and a second part that needs to be processed in series. That is, target task 1 is divided into a first part 1 that can be processed in parallel and a second part 1 that needs to be processed in series, target task 2 is divided into a first part 2 that can be processed in parallel and a second part 2 that needs to be processed in series, and target task 3 is divided into a first part 3 that can be processed in parallel and a second part 3 that needs to be processed in series. Among them, the first part 1, the first part 2 and the first part 3 can be processed in parallel (i.e., simultaneously) by the calculation unit 1 (i.e., the first calculation unit), the calculation unit 2 (i.e., other calculation units) and the calculation unit 3 (i.e., other calculation units), and the second part 1, the second part 2 and the second part 3 can be processed in series (i.e., in the order of 1, 2, 3) by the calculation unit 1. In addition, in some cases, there is a sequential relationship between the first and second parts, and the second part 1 needs to be executed after the first part 1, the second part 2 needs to be executed after the first part 2, and the second part 3 needs to be executed after the first part 3.

[0062] According to this embodiment, the producer divides the target task into parts that can be executed in parallel (i.e., the first part 1, 2, 3) and parts that need to be executed serially (i.e., the second part 1, 2, 3). The parallel part is executed in parallel by multiple computing units (i.e., computing units 1, 2, 3), and the serial part is executed by a single computing unit (e.g., computing unit 1), thereby greatly reducing the time for multi-tasking processing and improving computing efficiency.

[0063] Figure 3 A flowchart of a task processing method according to an embodiment of the present application is shown.

[0064] According to this embodiment, the method includes step S310 to step S320, and each step is described in detail below.

[0065] S310. Obtain multiple target tasks, each target task includes a first part executed in parallel and / or a second part executed in serial. Parallel execution means that the multiple first parts are executed in parallel in different computing units or in different threads, and serial execution means that the multiple second parts are executed sequentially in the same computing unit or the same thread.

[0066] In this embodiment, multiple target tasks may refer to multiple computing tasks issued by a computing device (as a consumer of task messages) itself, or may refer to multiple task messages issued by a producer of task messages to a computing device cluster. These target tasks may be processed by a single computing device or by multiple computing devices in collaboration.

[0067] In the present embodiment, the first part can be executed in parallel, which may mean that multiple first parts can be processed by different computing units at the same time, and each computing unit processes one of the first parts. The second part needs to be executed serially, which may mean that multiple second parts can be processed in sequence by one computing unit. For each target task, there may be multiple first parts (e.g., first part 1, first part 2, etc.), which can be processed in a single computing unit or distributed to multiple computing units for processing. For each target task, there may also be multiple second parts (e.g., second part 1, second part 2, etc.), which can all be processed by computing units that undertake serial processing tasks.

[0068] In this embodiment, parallel execution means that multiple first parts are executed simultaneously, respectively in different computing units or in different threads. Here, simultaneous means that multiple first parts do not have to be executed sequentially, but can be started together in different computing units or threads. Simultaneous execution does not necessarily mean that the start time and / or end time of execution are the same, but can be different. In this embodiment, the computing unit can be a computing unit in the sense of hardware or software. For example, the computing unit can be a server, or a pod (container group) on a server.

[0069] As an example, multiple target tasks are split from one overall task.

[0070] In this example, the multiple target tasks may be multiple subtasks divided from a total task. For example, the multiple target tasks may be multiple video segment sampling tasks divided from a video sampling task, and each video segment sampling task samples only one segment in a whole video.

[0071] In this example, the total task can be split according to the nature of the task. For example, if the total task has a time order requirement, it can be split into multiple target tasks according to the time order of the total task. For example, if the total task is to process a certain video, then in terms of time order, the video can be divided into multiple video clips, and a target task can be set for each video clip. For another example, if the total task has a spatial order requirement, it can be split into multiple target tasks according to the spatial order of the total task. For example, for the analysis operation of a high-precision map, a high-precision map can be divided into multiple small blocks, and a target task can be set for each small block.

[0072] As an example, each target task includes a first-stage task and a second-stage task, the first-stage task includes a first-stage first part executed in parallel and / or a first-stage second part executed in serial, the second-stage task includes a second-stage first part executed in parallel and / or a second-stage second part executed in serial, and multiple second-stage tasks of multiple target tasks are executed after multiple first-stage tasks of multiple target tasks are completed.

[0073] In this example, each target task is divided into a first-stage task and a second-stage task, which can be implemented, for example, in the process of sampling two large videos. The sampling task for the first large video is a first-stage task, and the first large video is divided into multiple segments. The sampling of each segment is the first part of the first stage that can be executed in parallel, and the video frames obtained by sampling each segment are stored in sequence as the second part of the first stage that needs to be executed serially. The sampling task for the second large video is a second-stage task, and the second large video is divided into multiple segments. The sampling of each segment is the first part of the second stage that can be executed in parallel, and the video frames obtained by sampling each segment are stored in sequence as the second part of the second stage that needs to be executed serially. The sampling task for the second large video needs to be executed after the sampling task for the first large video is completed.

[0074] As an example, in order to obtain multiple target tasks, you can first identify the task tag of each target task; then, based on the task tag, divide the multiple target tasks into parallel execution tasks and serial execution tasks, where the parallel execution tasks include the first part or the first part and the second part, and the serial execution tasks include the second part.

[0075] In this example, the task tag of the target task can be a tag marked after the task ID of each target task. For example, a parallel or serial identifier can be marked after the task ID, so that the computing unit can identify whether the currently acquired target task is a parallel execution task or a serial execution task. For parallel execution tasks, the degree of parallelism can also be marked. For example, if the degree of parallelism is 10, the parallel execution task can be assigned to 10 computing units for parallel processing. The tag can be generated by the producer who issues the target task, or it can be generated for each target task when the producer divides the total task into multiple target tasks.

[0076] S320. Execute multiple target tasks in multiple computing units respectively, wherein the multiple computing units execute multiple first parts of the multiple target tasks in parallel, the first computing unit executes multiple second parts of the multiple target tasks in series, and the first computing unit is one of the multiple computing units, or a computing unit other than the multiple computing units.

[0077] In this embodiment, multiple computing units execute multiple first parts of multiple target tasks in parallel, which may mean that each computing unit processes one or more first parts, so that multiple computing units process their respective first parts at the same time, thereby speeding up the processing progress of multiple tasks. Among them, the first computing unit may be a computing unit that processes the first first part, and the other computing units may be computing units that process the second to Nth first parts. When the first computing unit is one of the multiple computing units, in addition to being required to undertake the parallel computing processing of the first part, the first computing unit also has to undertake the serial computing processing of the second part.

[0078] In this embodiment, the first computing unit serially executes multiple second parts of multiple target tasks, which may refer to sequentially processing multiple second parts that need to be processed serially divided from multiple target tasks in a specified computing unit among the multiple computing units in accordance with a set order. The set order may be the order of the tasks themselves (for example, sequentially executing second part 1, second part 2, and second part 3 in the order of target task 1, target task 2, and target task 3), or other orders. Processing the second parts that need to be processed serially in the same computing unit can ensure that the processing order of the multiple second parts is not confused, while ensuring the reliability and consistency of the processing results.

[0079] As an example, the first computing unit is one of the plurality of computing units. In order to enable the plurality of computing units to execute the plurality of first parts of the plurality of target tasks in parallel, the first part having a first task amount may be processed in the first computing unit, and the first part having a second task amount may be processed in other computing units of the plurality of computing units except the first computing unit, wherein the first task amount is less than the second task amount.

[0080] In this example, when multiple computing units process multiple first parts in parallel, the first computing unit needs to additionally undertake the serial processing of multiple second parts. At this time, in order to ensure the balance of computing tasks and time coordination between the first computing unit and other computing units, the parallel tasks undertaken by the first computing unit can be appropriately reduced, and the parallel tasks undertaken by other computing units can be appropriately increased. The specific adjustment range can be determined by referring to the computing amount of the task, the computing resources and capabilities of the first computing unit and other computing units.

[0081] In this example, if each first part is the same, the first computing unit is likely to take the longest time to execute. In this way, the amount of tasks for the first part undertaken by the first computing unit can be reduced. The reduced amount of tasks can refer to the serial processing time of the first computing unit to execute this task. This can reduce the waiting time for serial execution of other computing units and minimize the execution time.

[0082] As an example, each target task includes a first part and a second part, and the second part of each target task is processed after the first part is processed. In order to respectively execute multiple target tasks in multiple computing units, after the computing unit finishes processing the first part of each target task, the first computing unit can be notified to allow the first computing unit to process the second part of the corresponding target task.

[0083] In this example, the method of notifying the first computing unit may be that the computing unit sends a message to the first computing unit to inform it that the first part has been processed and that it can start processing the corresponding second part; or the computing unit sends the information that the processing of the first part is completed to the first computing unit, and the first computing unit can start processing the corresponding second part after receiving the completion information; or the computing unit stores the information that the processing of the first part is completed in a certain storage space, and the first computing unit can periodically poll the storage space to obtain the completion information, and after obtaining it, it can start processing the second part; other forms of notification are also conceivable.

[0084] In this example, in order to ensure that the second part of each task is processed after the first part, it is necessary to establish a communication mechanism between the first computing unit and other computing units, so that after the other computing units have processed the first part they are responsible for, they will send a notification of completion to the first computing unit, so that the first computing unit can start processing the second part corresponding to the first part (i.e., divided by the same target task) after receiving the notification. In practice, the second part that needs to be processed serially often needs to rely on the processing result of the first part. If the processing result of the first part has not been given, the processing of the corresponding second part will often cause errors. Therefore, the present application ensures the processing order of the first and second parts of each target task through a notification mechanism to prevent the occurrence of incorrect calculation results.

[0085] As an example, in order to notify the first computing unit after the computing unit finishes processing the first part of the target task to allow the first computing unit to process the second part of the target task, the end information indicating the end of the processing of the first part can be first stored in the shared storage space; then, the first computing unit reads the end information from the shared storage space to obtain the notification of the end of the processing of the first part.

[0086] In this example, a shared storage space, such as a database, can be set between multiple computing units, so that the progress information can be shared between the multiple computing units, thereby achieving synchronization of task progress. Specifically, other computing units can store the end information of a first part processed by them in the shared storage space, so that the first computing unit can read the end information from the shared storage space, thereby knowing that the first part has been processed and can start processing the corresponding second part.

[0087] In this example, the end information may refer to any information that can indicate or record that the first part has been processed, and may be a field or value corresponding to each first part, or a result or an identifier of the result generated after the first part is processed. Other forms of end information are also conceivable, and the present application is not limited thereto.

[0088] In this example, the shared storage space may refer to any storage space that multiple computing units can access together. For example, when the computing units are multiple threads in a processor of a computing device, the shared storage space may be the memory space of the computing device. For example, when the computing unit is a computing device cluster (e.g., a server cluster) composed of multiple computing devices, the shared storage space may be a database (e.g., a Redis database) shared by the cluster. Other forms of shared storage space are also conceivable, and the present application is not limited thereto.

[0089] As an example, a computing unit includes a computing device, a computing module in a computing device, or a thread in a computing device.

[0090] In this example, the specific form of the computing unit can be an independent computing device that has the ability to issue multiple tasks or can communicate with other devices to obtain one or more tasks that need to be executed. In addition, the specific implementation form of the computing device can be different computing modules in a computing device, such as different computing modules in a computing device chip, which have a communication mechanism between them, can independently execute certain computing tasks and can synchronize the progress of task execution. In addition, the specific implementation form of the computing device can also be a running thread in the computing device, each thread is responsible for processing a computing task, and there is also a communication mechanism or message notification function between threads to achieve progress synchronization. Those skilled in the art should understand that the specific form of the computing unit is not limited to the above three specific forms. In addition to the above, the computing unit can also be a process, etc.

[0091] As an example, the plurality of computing units include a plurality of threads distributed in a plurality of computing devices, wherein each computing device has at least one thread. The plurality of tasks include a plurality of task messages obtained by the plurality of computing devices by monitoring a message queue.

[0092] In this example, the specific implementation form of the computing unit is a thread, and it is distributed in multiple computing devices (such as a computing device cluster). Each computing device can have one thread or multiple threads. There is a mutual communication mechanism between multiple computing devices, for example, mutual communication can be achieved through message queues. Specifically, multiple computing devices can monitor a message queue together. When the producer of the message produces a task message, it puts multiple task messages in a message queue, and multiple computing devices can obtain corresponding computing tasks from the message queue. Among them, each computing device can obtain one task or multiple tasks.

[0093] Figure 4 A flowchart of a task processing method according to another embodiment of the present application is shown.

[0094] According to this embodiment, the method includes steps S410 to S450, each of which is described in detail below.

[0095] S410. Obtain multiple target tasks, each target task includes a first part executed in parallel and a second part executed in serial. The second part of each target task is processed after the first part is processed. Parallel execution means that the multiple first parts are executed in parallel in different computing units or in different threads, and serial execution means that the multiple second parts are executed sequentially in the same computing unit or the same thread.

[0096] S420. Execute multiple target tasks in multiple computing units respectively, wherein the multiple computing units execute multiple first parts of the multiple target tasks in parallel, the first computing unit executes multiple second parts of the multiple target tasks in series, and the first computing unit is one of the multiple computing units, or a computing unit other than the multiple computing units.

[0097] For details of S410 to S420, see the above reference Figure 3 The detailed description of S310 to S320 in the described embodiment will not be repeated here.

[0098] S430. After the computing unit completes processing the first part of each target task, the key determined according to the task identifier of the first part and the processing result information of the first part are stored in a shared storage space, wherein the key and the processing result information constitute a key-value pair.

[0099] According to this embodiment, a key-value pair indicates that each key corresponds to a value, the key is used as the index of the element, and the value represents the stored and read data. The task identifier of the first part may refer to the task identifier of each task determined when multiple tasks are issued, such as a task ID. The key determined according to the task identifier of the first part may refer to the key determined according to the task ID of the task to which it belongs. The processing result information of the first part may refer to information related to the processing result of the first part, such as the processing result itself, or information that can only be determined according to the processing result. The key-value pair with the processing result information as the value can be stored in a shared storage space, wherein a certain key is an index for searching for the processing result information of a certain first part, and other units can know the key in advance (because the key can be determined when multiple tasks are issued), and search for the corresponding processing result information according to the key. If found, it means that the corresponding first part has been processed and the corresponding second part can be processed; if not found, it is necessary to wait for the corresponding other units to complete the processing of the first part they undertake.

[0100] As an example, the processing result information includes the processing result of the first part or the address where the processing result is stored.

[0101] According to this example, the processing result of the first part may refer to the data or information obtained after the first part is executed. For example, after the video clip sampling task is completed, the sampled video frame can be obtained. The address where the processing result is stored may refer to the address in the storage space where the data or information content generated by the first part after the execution is completed is stored. For example, when the data volume of the processing result of the first part is large, for example, the processing result is a long video, the long video can be stored in a certain storage space, and its storage address in the storage space is used as the processing result information, and is stored together with the corresponding key in a shared storage space between multiple computing units (different from the storage space where the long video is stored) for easy search.

[0102] S440: Enable the first computing unit to search for processing result information associated with the key in the shared storage space according to the key, so as to obtain a notification of completion of the first part of processing.

[0103] According to this embodiment, since the key has been determined in the process of generating and issuing multiple target tasks, the first computing unit already knows the key of the first part being processed in each other computing unit. In order to determine whether the first part being processed in other computing units has been processed, the first computing unit searches for the corresponding value in the shared storage space according to the key it has mastered. If the value corresponding to the key is found, it means that the processing result of the first part has come out, the first part has been executed, and the corresponding second part can be executed; if the value corresponding to the key is not found, it means that the processing result of the first part has not come out, the first part has not been executed, and the corresponding second part cannot be executed, and it is necessary to wait for the first part to be processed.

[0104] S450: After the first computing unit finishes processing the second part of the corresponding target task, delete the key and the processing result information associated with the key from the shared storage space.

[0105] According to this embodiment, after the first part undertaken by other computing units is processed, the first computing unit obtains information that a certain first part has been processed by querying the shared storage space, and can start processing the corresponding second part. After the second part is processed, the first computing unit can delete the key-value pair corresponding to the first part from the shared storage space to save storage space and clean up data in time. In the case where there are multiple first parts (for example, the first part of the first stage, the first part of the second stage, the first part of the third stage, etc.), when the key-value pair corresponding to the first part of a certain stage is deleted, it means that the parallel tasks of this stage have been processed, and the computing unit queries that the key of the first part of this stage no longer exists, then it can start processing the first part of the next stage.

[0106] In one embodiment, the present application also provides a task issuing method.

[0107] According to this embodiment, the task issuing method includes: dividing the total task into multiple target tasks; dividing each target task so that each target task includes a first part executed in parallel and / or a second part executed in serial, parallel execution means that multiple first parts are executed simultaneously, respectively, in different computing units or in different threads, and serial execution means that multiple second parts are executed in sequence; issuing multiple target tasks to multiple computing units for processing, wherein the multiple computing units execute the multiple first parts of the multiple target tasks in parallel, the first computing unit executes the multiple second parts of the multiple target tasks in serial, and the first computing unit is one of the multiple computing units, or a computing unit other than the multiple computing units.

[0108] According to this embodiment, the task issuing method can be executed by the producer of the message queue. For example, in the case where the computing unit is a server cluster, each computing unit represents a server, and multiple servers obtain multiple target tasks by listening to the message queue. At this time, the producer of the message queue can be a server that sends task messages to the message queue. The consumer of the message queue can be a server that obtains task messages from the message queue. The producer can send multiple target tasks or a total task to the message queue. The producer can split the total task into multiple target tasks, and then multiple consumers as multiple computing units process the multiple target tasks in accordance with the present application.

[0109] Figure 5 A flowchart of a task processing method according to an embodiment of the present application is shown.

[0110] In this embodiment, the producer sends Task 1, Task 2 and Task 3 to the message queue, and Consumers 1, Consumer 2 and Consumer 3 (consumers are computing units, which can be threads in this embodiment) receive Task 1, Task 2 and Task 3 respectively by monitoring the message queue. After receiving the tasks, Consumer 1 generates the first stage result 1 (equivalent to the processing result of the first part 1), Consumer 2 generates the first stage result 2 (equivalent to the processing result of the first part 2), and Consumer 3 generates the first stage result 3 (equivalent to the processing result of the first part 3). Consumers 2 and 3 store their first stage processing results in the shared storage space respectively.

[0111] At this point, consumer 1 can start to execute serial tasks. Consumer 1 first starts to process the serial processing tasks corresponding to the first-stage result 1 (equivalent to the second part 1) based on the first-stage result 1 generated by itself. Then, consumer 1 obtains the first-stage result 2 uploaded by consumer 2 from the shared storage space, and then it can be known that the parallel processing task of consumer 2 has been completed, and it can start to process the serial processing tasks corresponding to the first-stage result 2 (equivalent to the second part 2). After processing the first-stage result 2, the key corresponding to result 2 can be deleted. Then, consumer 1 obtains the first-stage result 3 uploaded by consumer 3 from the shared storage space, and then it can be known that the parallel processing task of consumer 3 has been completed, and it can start to process the serial processing tasks corresponding to the first-stage result 3 (equivalent to the second part 3). After processing the first-stage result 3, the key corresponding to result 3 can be deleted. In short, after consumers 2 and 3 upload their first-stage results to the shared storage space respectively, consumer 1 can process results 1, 2, and 3 in serial order, and delete the corresponding key of one after processing.

[0112] After that, consumer 1 determines whether there is a next stage after the first stage. If not, the entire task processing ends. If there is a second stage, such as Figure 5 As shown, consumers 1, 2, and 3 can continue to execute the tasks of the next stage. Consumer 1 starts to execute the parallel processing tasks of the second stage and generates the second stage result 1. Consumer 2 polls the shared storage space to see whether the key associated with the first stage result 2 has been deleted. If it has been deleted, it starts to execute the parallel processing tasks of the second stage and generates the second stage result 2. Consumer 3 polls the shared storage space to see whether the key associated with the first stage result 3 has been deleted. If it has been deleted, it starts to execute the parallel processing tasks of the second stage and generates the second stage result 3.

[0113] After that, after both consumers 2 and 3 store the results of the second stage in the shared storage space, consumer 1 starts to execute the serial processing task, that is, it processes results 1, 2, and 3 in serial order, deleting one corresponding key after processing one, and the whole process is similar to the first stage. Then, consumer 1 continues to determine whether there is a next stage. If so, it continues to process in the manner described above; if not, it ends the entire task processing process.

[0114] Figure 6 A flowchart of a task processing method according to an embodiment of the present application is shown.

[0115] In this embodiment, the multiple tasks are multiple video segment sampling tasks decomposed from the overall task of large video sampling. In the video picture sampling task, the picture sampling records need to be saved to the database in order to ensure that the sampled pictures viewed by the user are displayed in the order of video playback.

[0116] The total task of large video sampling is decomposed into multiple video segment sampling tasks by the producer (not shown), and corresponding segment sampling task messages (including segment sampling message 1, segment sampling message 2 and segment sampling message 3) are generated and sent to the message queue. Consumers (such as a server) obtain corresponding messages by monitoring the message queue. In this embodiment, consumer 1 obtains message 1, consumer 2 obtains message 2, and consumer 3 obtains message 3. Each segment sampling task is divided into three subtasks or parts, namely, the segment image acquisition task, the segment image storage hard disk task and the segment image storage record saving task to the database. Among them, the segment image acquisition task and the segment image storage hard disk task are more time-consuming and can be used as parallel processing tasks, and the segment image storage record saving task to the database is faster and can be used as a serial processing task. Therefore, the tasks are divided as follows: Consumer 1 undertakes two parallel tasks, namely, the task of collecting pictures for segment 1 and the task of saving pictures for segment 1 to the hard disk. In addition, as the first unit, Consumer 1 also undertakes serial tasks, namely, the task of saving the pictures for segment 1 to the database, the task of saving the pictures for segment 2 to the database, and the task of saving the pictures for segment 3 to the database; Consumer 2 undertakes two parallel tasks, namely, the task of collecting pictures for segment 2 and the task of saving pictures for segment 2 to the hard disk; Consumer 3 undertakes two parallel tasks, namely, the task of collecting pictures for segment 3 and the task of saving pictures for segment 3 to the hard disk.

[0117] After the tasks are divided, consumers 1, 2, and 3 each perform their corresponding tasks. After consumer 1 completes the tasks of collecting segment 1 images, saving segment 1 images to the hard disk, and saving segment 1 image storage records to the database, it starts waiting for consumers 2 and 3 to complete their respective tasks.

[0118] When consumer 2 has completed the task of collecting segment 2 images and saving segment 2 images to the hard disk, it will save the storage record to the key2 (i.e. key 2) corresponding to the cache, that is, save the result of the task of saving segment 2 images to the hard disk together with the associated key (i.e. key2) to the shared storage space. At this time, consumer 1 can read the data previously saved by consumer 2 from the shared storage space, that is, obtain the data associated with key2, and then execute the task of saving the segment 2 image storage record to the database. After execution, consumer 1 deletes key2 and associated data.

[0119] After that, consumer 1 starts to wait for consumer 3 to complete the task. When consumer 3 completes the segment 3 image acquisition task and the segment 3 image storage hard disk task, it saves the storage record to the key3 (i.e. key 3) corresponding to the cache, that is, saves the result of the segment 3 image storage hard disk task together with the associated key (i.e. key3) to the shared storage space. At this time, consumer 1 can read the data previously saved by consumer 3 from the shared storage space, that is, obtain the data associated with key3, and then execute the task of saving the segment 3 image storage record to the database. After execution, consumer 1 deletes key3 and associated data. When each segment sampling task is completed, the entire large video sampling task is completed.

[0120] Based on the aforementioned Figure 3 The method embodiment described above, the present application embodiment also provides a task processing device, the structural diagram of which is as follows Figure 7 The device is used to perform the above Figure 3 The various steps in .

[0121] According to this embodiment, the task processing device 700 includes an acquisition module 710 and an execution module 720. The acquisition module 710 is used to acquire multiple target tasks, each target task includes a first part executed in parallel and / or a second part executed in serial, parallel execution means that multiple first parts are respectively executed in parallel in different computing units or in different threads, and serial execution means that multiple second parts are executed sequentially in the same computing unit or the same thread. The execution module 720 is used to execute multiple target tasks in multiple computing units respectively, wherein multiple computing units execute multiple first parts of multiple target tasks in parallel, the first computing unit executes multiple second parts of multiple target tasks in serial, and the first computing unit is one of the multiple computing units, or a computing unit other than the multiple computing units.

[0122] It should be noted that Figure 7 The task processing device 700 provided in the embodiment shown in the figure only uses the division of the above-mentioned functional modules as an example when executing the method. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. Figure 3 The task processing method embodiments shown belong to the same concept, and their specific implementation processes are detailed in the method embodiments, which will not be repeated here.

[0123] Figure 8 It is a schematic diagram of the hardware structure of a computing device 800 provided in an embodiment of the present application.

[0124] See also Figure 8The computing device 800 includes a processor 810, a memory 820, a communication interface 830, and a bus 840, wherein the processor 810, the memory 820, and the communication interface 830 are connected to each other via the bus 840. The processor 810, the memory 820, and the communication interface 830 may also be connected in other connection modes besides the bus 840.

[0125] Among them, the memory 820 can be various types of storage media, such as random access memory (RAM), read-only memory (ROM), non-volatile RAM (NVRAM), programmable ROM (PROM), erasable PROM (EPROM), electrically erasable PROM (EEPROM), flash memory, optical storage, hard disk, etc.

[0126] The processor 810 may be a general-purpose processor, which may be a processor that performs specific steps and / or operations by reading and executing the contents stored in a memory (e.g., the memory 820). For example, the general-purpose processor may be a central processing unit (CPU). The processor 810 may include at least one circuit to execute Figure 3 The illustrated embodiment provides all or part of the steps of the task processing method.

[0127] Among them, the communication interface 830 includes input / output (I / O) interfaces, physical interfaces, and logical interfaces for interconnecting devices within the computing device 800, as well as interfaces for interconnecting the computing device 800 with other devices (such as other computing devices or user devices). The physical interface can be an Ethernet interface, an optical fiber interface, an ATM interface, etc. The communication interface 830 can be connected to an external input device and an output device. For example, the input device can be a microphone or a microphone array for capturing voice input signals; it can be a communication network connector for receiving collected input signals from the cloud or other devices; it can also include, for example, a keyboard, a mouse, etc. The output device can output various information to the outside, including determined distance information, direction information, etc. The output device can include, for example, a display, a speaker, a printer, a communication network and a remote output device connected thereto, etc.

[0128] The bus 840 may be any type of communication bus for interconnecting the processor 810 , the memory 820 , and the communication interface 830 , such as a system bus.

[0129] The above devices may be arranged on independent chips, or at least partially or completely on the same chip. Whether to arrange each device independently on different chips or to integrate them on one or more chips often depends on the needs of product design. The embodiments of the present application do not limit the specific implementation form of the above devices.

[0130] Figure 8 The computing device 800 shown is merely exemplary. During implementation, the computing device 800 may further include other components, which are not listed one by one herein.

[0131] An embodiment of the present application may also be a computer-readable storage medium having computer program instructions stored thereon, which, when executed by a processor, causes the processor to execute the steps of the task processing method according to various embodiments of the present application described above in this specification.

[0132] The computer readable storage medium can adopt any combination of one or more readable media. The readable medium can be a readable signal medium or a readable storage medium. The readable storage medium can include, for example, but is not limited to, a system, device or device of electricity, magnetism, light, electromagnetic, infrared, or semiconductor, or any combination of the above. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, 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 disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.

[0133] The concepts, principles and ideas of the present application are described in detail above in conjunction with specific implementation methods (including embodiments and examples). Those skilled in the art should understand that the implementation methods of the present application are more than the several forms given above. After reading the application documents, those skilled in the art can make any possible improvements, replacements and equivalent forms to the steps, methods, devices and components in the above-mentioned implementation methods, and these improvements, replacements and equivalent forms should be deemed to fall within the scope of the present application. The scope of protection of the present application shall be subject only to the claims.

Claims

1. A task processing method, characterized in that: The method comprises: Acquire multiple target tasks, each of the target tasks includes a first part executed in parallel and / or a second part executed in series, wherein the parallel execution means that the multiple first parts are respectively executed in parallel in different computing units or in different threads, and the series execution means that the multiple second parts are executed in sequence in the same computing unit or the same thread; The multiple target tasks are respectively executed in the multiple computing units, wherein the multiple computing units execute the multiple first parts of the multiple target tasks in parallel, and the first computing unit executes the multiple second parts of the multiple target tasks in series, and the first computing unit is one of the multiple computing units, or a computing unit other than the multiple computing units.

2. The method according to claim 1, characterized in that The multiple target tasks are obtained by splitting one overall task.

3. The method according to claim 1, characterized in that Each target task includes a first-stage task and a second-stage task, wherein the first-stage task includes a first-stage first part executed in parallel and / or a first-stage second part executed in serial, and the second-stage task includes a second-stage first part executed in parallel and / or a second-stage second part executed in serial, and the multiple second-stage tasks of the multiple target tasks are executed after the multiple first-stage tasks of the multiple target tasks are completed.

4. The method according to claim 1, characterized in that: The obtaining of multiple target tasks includes: Identify the task marker for each target task; According to the task tags, the multiple target tasks are divided into parallel execution tasks and serial execution tasks, wherein the parallel execution tasks include the first part or include the first part and the second part, and the serial execution tasks include the second part.

5. The method according to claim 1, characterized in that Each target task includes the first part and the second part, and the second part of each target task is processed after the first part is processed. The executing the multiple target tasks in multiple computing units respectively includes: After the computing unit finishes processing the first part of each target task, the first computing unit is notified to allow the first computing unit to process the second part of the corresponding target task.

6. The method according to claim 5, characterized in that After the computing unit completes processing the first part of the target task, notifying the first computing unit to allow the first computing unit to process the second part of the target task includes: storing, in the shared storage space, end information indicating the end of the first part of the processing; The first computing unit is enabled to read the end information from the shared storage space to obtain a notification of the end of the first part of the processing.

7. The method according to any one of claims 6, characterized in that The end information includes a key determined according to the task identifier of the first part and processing result information of the first part, and the key and the processing result information constitute a key-value pair.

8. The method according to claim 7, characterized in that The processing result information includes the processing result of the first part or the address where the processing result is stored.

9. The method according to any one of claims 7, characterized in that The storing, in a shared storage space, end information indicating the end of the first part of the processing comprises: storing the key and the processing result information associated with the key in the shared storage space; The step of causing the first computing unit to read the end information from the shared storage space to obtain a notification of the end of the first part of the processing includes: Searching for processing result information associated with the key in the shared storage space according to the key; Wherein, the method further comprises: After the first computing unit finishes processing the second part of the target task, the key and the processing result information associated with the key are deleted from the shared storage space.

10. The method according to claim 1, characterized in that The first computing unit is one of the plurality of computing units, and the plurality of computing units execute the plurality of first parts of the plurality of target tasks in parallel, including: A first portion having a first workload is processed in the first computing unit, and a first portion having a second workload is processed in computing units other than the first computing unit of the plurality of computing units, wherein the first workload is less than the second workload.

11. A task issuing method, characterized in that: The method comprises: Divide the overall task into multiple target tasks; Divide each target task so that each target task includes a first part executed in parallel and / or a second part executed in series, wherein the parallel execution means that a plurality of first parts are respectively executed in parallel in different computing units or in different threads, and the series execution means that a plurality of second parts are executed in sequence in the same computing unit or in the same thread; The multiple target tasks are sent to the multiple computing units for processing, wherein the multiple computing units execute the multiple first parts of the multiple target tasks in parallel, and the first computing unit executes the multiple second parts of the multiple target tasks in series, and the first computing unit is one of the multiple computing units, or a computing unit other than the multiple computing units.

12. A computing device, characterized in that: The computing device comprises a processor and a memory, wherein the processor is configured to execute a computer program stored in the memory to implement the task processing method according to any one of claims 1 to 10.

Citation Information

Cited By

  • Data parallel processing method and device

    CN120523594A

  • Task processing method and device, storage medium, electronic equipment and program product

    CN120909799B