Task processing method and device, electronic equipment and storage medium
Through the directed acyclic graph scheduling tool, the complex scheduling strategies and high development costs in the application are solved, and efficient and flexible task processing and resource utilization are achieved.
Patent Information
- Application Number
- CN202510237964.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-28
- Publication Date
- 2025-06-06
AI Technical Summary
In the prior art, applications need to schedule multiple tools when processing tasks, resulting in complex scheduling strategies and high development costs, and different tasks require repeated development of the same tools.
Directed acyclic graphs are used to schedule various tools, and subtasks are characterized by nodes in directed acyclic graphs. The target nodes to be executed are determined based on the dependencies and state information of the nodes, and the processing logic of the target nodes is executed, which simplifies the scheduling strategy and reduces development costs.
It simplifies the scheduling strategy, reduces the cost of functional development, and maintains efficient and stable during task processing, has high flexibility in adapting to task process changes, and reduces dependence on electronic device resources.
Smart Images

Figure CN120104338A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of data processing technology, and in particular to the fields of audio and video processing. More specifically, the present disclosure provides a task processing method, device, electronic device, storage medium, and computer program product. Background Art
[0002] Some applications can provide multiple functions by processing tasks, such as generating video summaries by processing summary generation tasks, and multiple tools need to be scheduled during the task processing process. Summary of the invention
[0003] The present disclosure provides a task processing method, apparatus, electronic device, storage medium and computer program product.
[0004] According to one aspect of the present disclosure, a task processing method is provided, comprising: in response to determining that a first queue includes a first message, obtaining the first message in the first queue, the first message including a task identifier of a task to be processed, the task including multiple subtasks, the task identifier being associated with a directed acyclic graph, the directed acyclic graph including multiple nodes, each node representing one of the multiple subtasks; determining a target node to be executed from the multiple nodes according to dependency relationships between the nodes in the directed acyclic graph and status information of the nodes; executing the processing logic of the target node to obtain a processing subresult of the subtask represented by the target node; wherein the first message is generated in response to obtaining a processing subresult of any one of the multiple nodes and is added to the first queue.
[0005] According to another aspect of the present disclosure, a task processing device is provided, including: an acquisition module, a node determination module and an execution module. The acquisition module is used to obtain the first message in the first queue in response to determining that the first queue includes a first message, the first message includes a task identifier of the task to be processed, the task includes multiple subtasks, the task identifier is associated with a directed acyclic graph, the directed acyclic graph includes multiple nodes, and each node represents a subtask among the multiple subtasks. The node determination module is used to determine the target node to be executed from the multiple nodes according to the dependency relationship of each node in the directed acyclic graph and the state information of the node. The execution module is used to execute the processing logic of the target node to obtain the processing subresult of the subtask represented by the target node. Among them, the first message is generated and added to the first queue in response to obtaining the processing subresult of any one of the multiple nodes.
[0006] According to another aspect of the present disclosure, an electronic device is provided, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the method provided by the present disclosure.
[0007] According to another aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to enable a computer to execute the method provided by the present disclosure.
[0008] According to another aspect of the present disclosure, a computer program product is provided, including a computer program, and when the computer program is executed by a processor, the method provided by the present disclosure is implemented.
[0009] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] The accompanying drawings are used to better understand the present solution and do not constitute a limitation of the present disclosure.
[0011] Figure 1 is a schematic diagram of an application scenario of a task processing method and device according to an embodiment of the present disclosure;
[0012] Figure 2 is a schematic flow chart of a task processing method according to an embodiment of the present disclosure;
[0013] Figure 3 is a schematic flow chart of a task processing method according to another embodiment of the present disclosure;
[0014] Figure 4 is a schematic diagram of a task processing method according to an embodiment of the present disclosure;
[0015] Figure 5A is a schematic structural diagram of a directed acyclic graph according to an embodiment of the present disclosure;
[0016] Figure 5B is a schematic diagram of a task processing method according to an embodiment of the present disclosure;
[0017] Figure 6 is a schematic architecture diagram of a task processing method according to an embodiment of the present disclosure;
[0018] Figure 7 is a schematic structural block diagram of a task processing device according to an embodiment of the present disclosure; and
[0019] Figure 8It is a structural block diagram of an electronic device used to implement the task processing method of the embodiment of the present disclosure. DETAILED DESCRIPTION
[0020] The following is a description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.
[0021] In the technical solution of the present disclosure, the collection, storage, use, processing, transmission, provision and disclosure of user personal information involved are in compliance with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0022] In the technical solution of the present disclosure, the user's authorization or consent is obtained before obtaining or collecting the user's personal information.
[0023] Some applications can provide multiple functions by processing tasks. In the process of processing tasks, multiple tools need to be scheduled, and each tool schedules each other. The tool can be a pre-configured data processing logic. For example, in the process of processing summary generation tasks, the subtitle tool needs to be scheduled to generate video subtitles first, and then the subtitle tool schedules the summary tool to generate video summaries. However, the scheduling between each tool makes the scheduling strategy complicated. In addition, different tasks require repeated development of the same tool, which has a high development cost.
[0024] The disclosed embodiments aim to provide a task processing method, which simplifies the scheduling strategy and reduces the cost of function development.
[0025] The technical solution provided by the present disclosure will be described in detail below with reference to the accompanying drawings and specific embodiments.
[0026] Figure 1 It is a schematic diagram of an application scenario of the task processing method and device according to an embodiment of the present disclosure.
[0027] It should be noted that Figure 1 What is shown is merely an example of a system architecture to which the embodiments of the present disclosure can be applied, in order to help those skilled in the art understand the technical content of the present disclosure, but it does not mean that the embodiments of the present disclosure cannot be used in other devices, systems, environments or scenarios.
[0028] like Figure 1As shown, the system architecture 100 according to this embodiment may include terminal devices 101, 102, 103, a network 104 and a server 105. The network 104 is used to provide a medium for communication links between the terminal devices 101, 102, 103 and the server 105. The network 104 may include various connection types, such as wired and / or wireless communication links, etc.
[0029] Users can use terminal devices 101, 102, 103 to interact with server 105 through network 104 to receive or send messages, etc. Terminal devices 101, 102, 103 can be various electronic devices with display screens and supporting web browsing, including but not limited to smart phones, tablet computers, laptops, desktop computers, etc.
[0030] The server 105 may be a server that provides various services, such as a background management server (only an example) that provides support for websites browsed by users using the terminal devices 101, 102, and 103. The background management server may analyze and process the received data such as user requests, and feed back the processing results (such as the task processing results generated according to the user requests, etc.) to the terminal device.
[0031] It should be noted that the task processing method provided in the embodiment of the present disclosure can generally be executed by the server 105. Accordingly, the task processing device provided in the embodiment of the present disclosure can generally be set in the server 105. The task processing method provided in the embodiment of the present disclosure can also be executed by a server or server cluster that is different from the server 105 and can communicate with the terminal devices 101, 102, 103 and / or the server 105. Accordingly, the task processing device provided in the embodiment of the present disclosure can also be set in a server or server cluster that is different from the server 105 and can communicate with the terminal devices 101, 102, 103 and / or the server 105.
[0032] It should be understood that Figure 1 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.
[0033] Figure 2 is a schematic flowchart of a task processing method according to an embodiment of the present disclosure.
[0034] like Figure 2 As shown, the task processing method 200 may include operations S210 to S230.
[0035] In operation S210, in response to determining that the first queue includes a first message, the first message in the first queue is obtained, the first message includes a task identifier of a task, the task includes multiple subtasks, the task identifier is associated with a directed acyclic graph, the directed acyclic graph includes multiple nodes, each node represents a subtask among the multiple subtasks.
[0036] For example, the task to be processed is to generate a video summary. The directed acyclic graph associated with the task identifier of the task may include a first node and a second node. The subtask represented by the first node is to generate video subtitles, and the subtask represented by the second node is to generate a video summary.
[0037] For example, when the task to be processed is triggered, the first message can be added to the first queue. For another example, the task includes multiple subtasks, each subtask corresponds to a node in the directed acyclic graph, and the first message can be generated and added to the first queue after executing the processing logic of any one of the multiple nodes in the directed acyclic graph and obtaining the processing subresult of the subtask represented by the node, that is, after executing the subtask of any node.
[0038] In operation S220, a target node to be executed is determined from a plurality of nodes according to the dependency relationship of each node in the directed acyclic graph and the state information of the node.
[0039] For example, a search may be performed from the root node of the directed acyclic graph to the leaf nodes according to the dependency relationship, and the first unexecuted node in the search path may be determined as the target node.
[0040] In operation S230, the processing logic of the target node is executed to obtain a processing sub-result of the sub-task represented by the target node.
[0041] For example, the processing logic of the node can be pre-encapsulated as a callable tool, and the process of executing the processing logic of the target node can be to call the tool corresponding to the target node, and the result returned by the tool can be used as the processing sub-result of the target node.
[0042] The task processing method provided in this embodiment can schedule various tools based on a directed acyclic graph. Tools refer to the processing logic corresponding to the nodes in the directed acyclic graph. Since various tools are uniformly scheduled by the task center used to implement the task processing method, and there is no need for tools to schedule each other, the scheduling strategy is simplified, and the various tools involved in the task can be decoupled, so that different tasks can reuse the same tools, thereby reducing the development cost of the function. In addition, by adopting the above technical solution, when adding new functions and modifying functions, the scheduling strategy can be adjusted by modifying the dependencies of each node, without modifying the scheduling logic between tools, further reducing the development cost and reducing the amount of business development.
[0043] In addition, during the task processing, after executing the processing logic of the previous node to obtain the processing sub-result, a first message can be added to the first queue, and then the next node can be scheduled according to the first message, so that each sub-task in the task can be executed in sequence. In addition, during the execution process, the distribution and execution of sub-tasks can be decoupled. If an exception occurs in the execution of a sub-task, the call of other tools will be less affected.
[0044] In addition, the first queue can balance the processing load of tasks. For example, when the task volume is large, the problem that the electronic device cannot process all tasks due to insufficient resources can be alleviated by temporarily storing the first message in the first queue. When the task volume is small, the first message can be taken out from the first queue to make full use of the resources of the electronic device, so that the electronic device can maintain stable and efficient operation when the task volume fluctuates.
[0045] Figure 3 is a schematic flowchart of another task processing method according to an embodiment of the present disclosure.
[0046] like Figure 3 As shown, the task processing method 300 may include operations S301 to S303, and the operations S301 to S303 may be performed before obtaining the first message from the first queue.
[0047] In operation S301 , in response to receiving a trigger request, a directed acyclic graph is generated according to the trigger request.
[0048] In operation S302, an initial trigger message is generated, where the initial trigger message includes a task identifier.
[0049] In operation S303, the initial trigger message is taken as the first message and added to the first queue.
[0050] In one example, in response to receiving a trigger request, the termination node can be determined according to the trigger request. According to a predetermined dependency relationship between multiple candidate nodes, other nodes that the termination node depends on are determined from multiple candidate nodes. Then, a directed acyclic graph is generated according to the predetermined dependency relationship between the termination node and other nodes, and between the termination node and other nodes.
[0051] For example, a user or a business person at the back end can make selections, input, and other operations through the front end page, and the front end generates a trigger request based on the operation. It is understandable that the user's operation can reflect the user's needs, and the trigger request can include a termination node. For example, the user selects or inputs "generate video summary", and the trigger request contains a field representing the task as "generate video summary", which can represent the termination node. For another example, a scheduled task can be executed, such as obtaining some video resources at regular intervals and executing the task of "generating video summary". Before execution, the execution process of the task can be triggered by a trigger request, and the trigger request includes a termination node.
[0052] For example, multiple candidate nodes can be configured in advance according to at least one task to be processed, and the dependency relationship between each candidate node can be configured. Then, according to the dependency relationship, the termination node and other nodes that the termination node directly or indirectly depends on can be added to the node set. For example, if the termination node depends on node 1, and node 1 depends on node 2 and node 3, the termination node, node 1, node 2, and node 3 can all be added to the node set.
[0053] Then, a directed acyclic graph is generated based on the node set. For example, the nodes in the directed acyclic graph are consistent with the nodes in the node set, and the dependency relationship between the nodes in the directed acyclic graph is consistent with the dependency relationship between the nodes in the node set.
[0054] With the technical solution provided in this example, the directed acyclic graph is not pre-configured, but generated based on the dependency relationship between the terminal node and each candidate node. Since the directed acyclic graph is not pre-edited as fixed data, when the processing flow of the task changes, only the dependency relationship between each candidate node needs to be updated to dynamically generate a directed acyclic graph that matches the latest processing flow, which is highly flexible. In addition, the process of generating a directed acyclic graph based on dependency relationships requires fewer computer resources, has a higher processing speed, and does not affect the overall processing efficiency of the task.
[0055] In another example, multiple directed acyclic graphs can be preconfigured, and each directed acyclic graph corresponds to a task identifier, and the task needs to be processed based on the directed acyclic graph that uniquely corresponds to the task identifier. Accordingly, in response to receiving a trigger request, the task identifier is determined according to the trigger request, and then the corresponding directed acyclic graph is selected from multiple preconfigured directed acyclic graphs according to the task identifier. Using the solution provided in this example, when a task needs to be processed, there is no need to generate a directed acyclic graph in real time according to demand.
[0056] The task processing method 300 provided in this embodiment generates an initial trigger message including a task identifier after determining the directed acyclic graph, and adds the initial trigger message to the first queue, thereby triggering a subsequent process of obtaining the first message from the first queue and executing the processing logic of the target node, thereby executing each subtask in the task.
[0057] Figure 4 It is a schematic diagram of a task processing method according to an embodiment of the present disclosure.
[0058] like Figure 4 As shown, in this embodiment, a task center for implementing the task processing method may be deployed on a client or a server, and the task center may include at least one scheduling unit 403 and at least one execution unit 404 .
[0059] First, the user can create a task through the front-end page, or can execute a scheduled task through pre-configured rules. It is also necessary to create a task before executing the task. Creating a task may include creating a new task and updating a task. The process of creating a task may include: in response to receiving a trigger request, generating a directed acyclic graph according to the trigger request. The generated directed acyclic graph can be stored in a database. The process of generating a directed acyclic graph can refer to the above, and this embodiment will not be repeated. After generating the directed acyclic graph, an initial trigger message can be generated. The initial trigger message includes a task identifier, and then the initial trigger message is used as the first message msg_1 and added to the first queue 401.
[0060] Next, the scheduling unit 403 detects that the first queue 401 includes the first message msg_1, and the scheduling unit 403 obtains the first message msg_1 from the first queue 401. The first message msg_1 includes the task identifier of the task, and then the scheduling unit 403 can search for the directed acyclic graph for the task from the database according to the task identifier and the corresponding relationship between the task identifier and the directed acyclic graph. Then, the target node to be executed can be determined from multiple nodes according to the dependency relationship of each node in the directed acyclic graph and the state information of the node.
[0061] Next, after determining the target node, the scheduling unit 403 may further generate a second message msg_2 and send it to the second queue 402. The second message msg_2 may include a task identifier and a node identifier of the target node.
[0062] Next, the execution unit 404 detects that the second queue 402 includes the second message msg_2, and the execution unit 404 obtains the second message msg_2 from the second queue 402. Then, the execution unit 404 calls the processing logic of the target node according to the task identifier and the node identifier in the second message msg_2, and obtains the processing sub-result of the target node. For example, the task to be processed is to generate a video summary for the target video, wherein the sub-task corresponding to the target node is to generate video subtitles, and the relevant information (such as audio, image, etc.) of the target video can be obtained from the database according to the task identifier, and then the relevant information of the target video can be added to the input parameters, and the processing logic corresponding to the target node is called based on the input parameters, so as to obtain the video subtitles, which are the processing sub-results of the target node.
[0063] The first queue 401 and the second queue 402 can decouple the distribution and execution of subtasks. If an exception occurs in the execution of a subtask, the call of other tools will be less affected. In addition, the first queue 401 and the second queue 402 can balance the processing load of tasks. For example, when the resources of the electronic device are insufficient, the first message and the second message can be temporarily stored in the first queue 401 and the second queue 402 respectively. When the resources of the electronic device are sufficient, the messages can be taken out from the first queue 401 and the second queue 402 to execute the task.
[0064] Next, after obtaining the processing sub-result of the target node, the execution unit 404 may also update the state information of the target node. For example, the directed acyclic graph is stored in a database, and the attributes of the nodes of the directed acyclic graph include state information. The state information of the target node may be updated in the database.
[0065] In addition, the execution unit 404 may also generate a new first message msg_3, and add the first message msg_3 to the first queue 401. In some embodiments, the first message msg_3 may include the node identifier of the target node that the execution unit 404 has recently completed execution. For example, the execution unit 404 may use the target node as a reference node, and add the node identifier of the reference node to the first message msg_3, and then add the first message msg_3 to the first queue 401. In this way, the scheduling unit 403 may detect again that the first queue 401 includes the first message msg_3, thereby obtaining the first message msg_3 from the first queue 401 again, and then continue to determine the target node and execute the processing sub-logic of the target node until a predetermined termination condition is met. The predetermined termination condition may include: the processing logic executed by the execution unit 404 is the processing logic of the termination node. In this way, the scheduling of the previous subtask, the execution of the previous subtask, and the scheduling of the next subtask can form a closed-loop processing process to ensure that multiple subtasks are executed in order.
[0066] It should be noted that the processing logic of each node can be pre-packaged as a tool 405. In the process of the execution unit 404 calling the processing logic of the target child node, the execution unit 404 can call the corresponding tool 405 through the interface. The tool 405 can be a synchronous tool or an asynchronous tool. For a synchronous tool, the execution unit 404 directly obtains the processing sub-result returned by the tool 405 after calling the synchronous tool. For an asynchronous tool, after the execution unit 404 calls the asynchronous tool, the asynchronous tool can call back the task center used to execute the task processing method, thereby feeding back the processing sub-result to the task center. Before the tool 405 returns the processing sub-result, the processing flow for the target node in the task center can be temporarily blocked and wait for the callback of the asynchronous tool.
[0067] It should be noted that, in actual applications, multiple scheduling units 403 may be deployed, so that when the first queue 401 includes multiple first messages msg_1, multiple scheduling units 403 may schedule in parallel. Similarly, when the second queue 402 includes multiple second messages msg_2, multiple execution units 404 may call the processing logic of multiple target nodes in parallel, thereby improving processing efficiency.
[0068] Next, the process of determining a target node to be executed from multiple nodes is described.
[0069] In one example, a search may be performed from the root node to the leaf nodes of the directed acyclic graph according to the dependency relationship, and the first unexecuted node in the search path may be determined as the target node.
[0070] In another example, in the process of determining the target node to be executed from multiple nodes, the state information of the reference node represented by the node identifier can be determined according to the node identifier in the first message, and the state information can include successful execution and failed execution. In the case of determining that the state information of the reference node is successful execution, other nodes that depend on the reference node among the multiple nodes of the directed acyclic graph are determined as target nodes. For example, the reference node is node 4, and nodes 5, 6 and 7 are all directly dependent on node 4, and node 8 is directly dependent on node 5, so nodes 5, 6 and 7 can be determined as target nodes respectively, so that three second messages can be generated, one second message includes the node identifier of node 5, one second message includes the node identifier of node 6, and one second message includes the node identifier of node 7, and the three second messages are all added to the second queue.
[0071] This example determines the target node based on the state information of the reference node and other nodes that directly depend on the reference node. Compared with the method of searching from the root node to the leaf node of the directed acyclic graph based on the dependency relationship to determine the target node, this example directly obtains the state of the reference node and the child nodes of the reference node to determine the target node, without traversing the state of each node in the directed acyclic graph from the root node, so the processing efficiency is faster.
[0072] Figure 5A It is a schematic structural diagram of a directed acyclic graph according to an embodiment of the present disclosure.
[0073] In this embodiment, the task to be processed is to export video courseware as an example for explanation. The task may include two subtasks: courseware generation and courseware export. Therefore, the directed acyclic graph includes a courseware generation node Node_1 and a courseware export node Node_2, and the courseware export node Node_2 depends on the courseware generation node Node_1.
[0074] Figure 5B It is a schematic diagram of a task processing method according to an embodiment of the present disclosure.
[0075] This embodiment involves a front end 510, an intermediate application 520, a task center 530, and tools. The intermediate application 520 can be an application such as a network disk, or an intelligent assistant in an application can be deployed. Tools can include asynchronous tools and synchronous tools. In this embodiment, the asynchronous tool can be a generation tool 540, which can be used to execute the processing logic of courseware generation, thereby executing the subtasks generated by the courseware. In this embodiment, the synchronous tool can be an export tool 550, which can be used to execute the processing logic of courseware export, thereby executing the subtasks of courseware export. In actual applications, the front end 510 includes the front-end page of the client, the intermediate application 520 can be deployed on the client or the server, and the task center 530 and the tools can be deployed on the same server or different servers.
[0076] First, the user can perform operations such as selection and input through the front end 510, and the front end 510 can send a first trigger request Msg_501 to the intermediate application 520 based on the operation. After receiving the first trigger request Msg_501, the intermediate application 520 can return a feedback message Msg_502 to the front end 510 to prompt the front end 510 that the first trigger request Msg_501 has been received.
[0077] The intermediate application 520 may determine the termination node based on the first trigger request Msg_501, and then send a second trigger request Msg_503 to the task center 530. The second trigger request Msg_503 may include the node identifier of the termination node. After receiving the second trigger request Msg_503, the task center 530 may return a feedback message Msg_504 to the intermediate application 520 to prompt the intermediate application 520 that the second trigger request Msg_503 has been received.
[0078] After receiving the second trigger request Msg_503, the task center 530 can determine other nodes that the terminated node depends on from multiple candidate nodes based on the node identifier of the terminated node and the pre-configured predetermined dependency relationship, and then generate a directed acyclic graph. The task corresponds to a unique directed acyclic graph.
[0079] Next, the task center 530 can determine the first target node from the directed acyclic graph, for example, first determine that the first target node is a courseware generation node, so the task center 530 calls the courseware generation tool 540 to perform the courseware generation subtask, for example, the task center 530 sends a generation request Msg_505 to the courseware generation tool 540, the generation request Msg_505 can include the task identifier of the task, and the courseware generation tool 540 can send a feedback message Msg_506 to the task center 530 after receiving the generation request Msg_505. In addition, the courseware generation tool 540 is an asynchronous tool, so the courseware generation tool 540 performs an asynchronous processing process, for example, the generation request is sent by the task center 530 to an external message queue, and then the courseware generation tool 540 obtains the generation request Msg_505 from the message queue, and can query the relevant information of the video associated with the task identifier from the database based on the generation request Msg_505, and execute its own processing logic, so as to generate the courseware, and then the generated courseware can be stored in the database. After generating the courseware, the generation tool 540 will also call back the task center 530 . The task center 530 may send a feedback message Msg_508 after receiving the callback message Msg_507 from the generation tool 540 .
[0080] Next, the task center 530 can determine the second target node from the directed acyclic graph. For example, the second target node is first determined to be the courseware export node, so the task center 530 calls the export tool 550 to execute the courseware export subtask. For example, the task center 530 sends an export request Msg_509 to the export tool 550, and the export request may include the task identifier of the task. The export tool 550 is a synchronization tool, and then the export tool 550 performs a synchronization process based on the obtained export request Msg_509. For example, the courseware associated with the task identifier can be queried from the database, and its own processing logic is executed to export the courseware. The exported courseware can then be stored in the database, and a feedback message Msg_510 can also be sent to the task center 530 to notify the task 530 that the subtask of the courseware export has been completed.
[0081] Next, the task center 530 may send a first notification message Msg_511 to the intermediate application 520, thereby notifying the intermediate application 520 that the courseware export task has been completed. In addition, the first notification message Msg_511 may include the generated courseware, and may also include the storage address of the courseware in the database, so that the intermediate application 520 can directly or indirectly obtain the generated courseware. After receiving the first notification message Msg_511, the intermediate application 520 may send a feedback message Msg_512 to the task center 530 to declare receipt of the notification.
[0082] If the user leaves the page of the target application, the task center 530 can also send a second notification message Msg_513 to the front end 510, thereby prompting the user that the courseware has been generated and prompting the user to return to the target application to view the courseware. After receiving the second notification message Msg_513, the front end 510 can send a feedback message Msg_514 to the task center 530 to declare receipt of the notification.
[0083] If the user does not leave the page of the target application, the front end 510 can send a polling request Msg_515 to the task center 530, and determine whether the courseware has been generated through the feedback message Msg_516 from the task center 530. The front end 510 can display the courseware directly through the target application after generating it.
[0084] It can be seen that the process of this embodiment can ensure that the courseware export task is asynchronously scheduled and executed according to the dependency relationship, and the task execution efficiency is high. In addition, it not only supports calling local synchronization tools, but also supports asynchronous callbacks. And the status of each subtask in the task can be managed to reduce management costs.
[0085] It should be noted that this embodiment mainly describes the interaction process between the task center 530 and the external front end 510, the intermediate application 520, and the tool. The processing flow inside the task center 530 can refer to the above. For example, the task center 530 can include a scheduling unit and an execution unit. A directed acyclic graph can be created first, and then a first message can be added to the first queue. The scheduling unit can obtain the first message from the first queue and determine the target node, and then send the second message to the second queue. The execution unit can obtain the second message from the second queue, and then call the required tool to obtain the processing sub-result of the tool. Then the execution unit adds a new first message to the first queue again, and the processing is cyclically performed until the processing result of the task is obtained.
[0086] The task processing method provided in this embodiment is applicable to tasks including multiple subtasks with dependencies, such as video courseware, audio and video manuscripts, video summaries, and other tasks.
[0087] Figure 6 It is a schematic architecture diagram of a task processing method according to an embodiment of the present disclosure.
[0088] like Figure 6 As shown, this embodiment can adopt a multi-level system architecture to implement task processing in online and offline scenarios.
[0089] Taking the generation of video summaries as an example, online scenarios may include: after watching a video, the user actively triggers the task execution process through the front-end page to generate a summary of the video. In online scenarios, users can trigger the task processing process of online scenarios through the intelligent assistants of some applications, such as network disks, or users can also trigger the task processing process of online scenarios through applications installed on the client.
[0090] Taking the generation of video summaries as an example, offline scenarios can include the backend pre-processing the video to generate a summary of the video, so that when users browse the video through the front end, the pre-generated video summary can be directly displayed to the user. In offline scenarios, back-end business personnel can trigger the task processing flow of offline scenarios through interactive pages provided by services such as smart summarization, smart courseware, and listening and recording.
[0091] The system architecture in this embodiment may include an interface layer 610, a scheduling layer 620 and a tool layer 630, each layer being responsible for different functional modules to ensure overall coordination and efficient operation, and the functional modules may be implemented through pre-configured data processing logic.
[0092] The interface layer 610 can provide multiple interfaces to the outside world, such as task creation interface, tool execution interface, tool callback interface, status query interface, task modification interface, etc. In the online scenario, the interface layer 610 can create tasks according to the needs of the client. The interface needs to adapt to different parameter requirements to support functions such as tool execution, tool callback, status query and task modification, ensuring that the task can respond in real time and be flexibly adjusted. In the offline scenario, the interface layer 610 can provide a predetermined task interface, and the caller needs to develop according to unified requirements to simplify interface integration and ensure standardized execution of tasks.
[0093] The scheduling layer 620 is used to manage the allocation and execution of each subtask in the task. The scheduling layer 620 may include a scheduling unit and an execution unit. The scheduling unit may perform subtask distribution, and the execution unit may call a tool to execute the subtask. In addition, the scheduling layer 620 may also manage directed acyclic graphs, for example, a directed acyclic graph may be generated to determine that each subtask in the task is executed in a reasonable order. The relevant information of the directed acyclic graph may also be stored, thereby achieving the persistence of the directed acyclic graph, so as to facilitate the recovery and rescheduling of the task. In addition, the implementation of the tool may also be managed, such as the development and integration of the management tool. The configuration of the tool may also be managed, such as flexibly adjusting and setting the parameters of the tool according to actual needs.
[0094] The tool layer 630 may include multiple tools, and the processing logic corresponding to each node in the directed acyclic graph may be encapsulated to obtain a tool. For example, the tool may include a synchronous tool, such as search, video courseware, reading / watching experience, work summary, question assistant and other tools, which support online needs through real-time processing. The tool may also include an asynchronous tool, such as video subtitles, video summary, video highlights, segment summary, document photocopy, etc. The asynchronous tool is suitable for batch processing tasks, supports offline processing of complex data, and improves system efficiency.
[0095] This embodiment adopts the above system architecture, which can efficiently manage and execute tasks in different scenarios, ensure the flexibility and reliability of task processing, and meet the diverse needs of users.
[0096] In practical applications, the above system architecture can also be applied to the field of microservice orchestration. In the microservice architecture, it can help manage the interactions between different services and simplify the communication and coordination between services by defining workflows to ensure that tasks are executed in the expected order and conditions. The above system architecture can also be applied to the field of business process automation. It can be used to automate complex business processes within the enterprise, such as order processing, customer relationship management, and supply chain management, to ensure the consistency and traceability of business logic execution. The above system architecture can also be applied to the field of machine learning. For example, in machine learning projects, it can be used to manage and automate tasks such as data preparation, model training, evaluation, and deployment to ensure the efficiency of the development and operation and maintenance processes of machine learning models.
[0097] Figure 7 It is a schematic structural block diagram of a task processing device according to an embodiment of the present disclosure.
[0098] like Figure 7 As shown, the task processing device 700 may include an acquisition module 710 , a node determination module 720 and an execution module 730 .
[0099] The acquisition module 710 is used to acquire the first message in the first queue in response to determining that the first queue includes a first message, the first message including a task identifier of a task to be processed, the task including multiple subtasks, the task identifier is associated with a directed acyclic graph, the directed acyclic graph includes multiple nodes, and each node represents a subtask among the multiple subtasks.
[0100] The node determination module 720 is used to determine the target node to be executed from multiple nodes according to the dependency relationship of each node in the directed acyclic graph and the state information of the node.
[0101] The execution module 730 is used to execute the processing logic of the target node and obtain the processing sub-result of the sub-task represented by the target node. The first message is generated in response to obtaining the processing sub-result of any one of the multiple nodes and is added to the first queue.
[0102] According to another embodiment of the present disclosure, it also includes: a first determination module, a second determination module and a first generation module. The first determination module is used to determine the termination node according to the trigger request in response to receiving the trigger request. The second determination module is used to determine other nodes that the termination node depends on from multiple candidate nodes according to the predetermined dependency relationship between the multiple candidate nodes. The first generation module is used to generate a directed acyclic graph according to the predetermined dependency relationship between the termination node and other nodes, and the termination node and other nodes.
[0103] According to another embodiment of the present disclosure, the system further includes: a second generation module and a first adding module. The second generation module is used to generate an initial trigger message after generating the directed acyclic graph, and the initial trigger message includes a task identifier. The first adding module is used to add the initial trigger message as a first message to the first queue.
[0104] According to another embodiment of the present disclosure, the execution module includes: an acquisition submodule and a call submodule. The acquisition submodule is used to acquire the second message in response to detecting that the second queue includes a second message; wherein the second message is generated and added to the second queue in response to the determination of the target node, and the second message includes a task identifier and a node identifier of the target node. The call submodule is used to call the processing logic of the target node according to the task identifier and the node identifier in the second message to obtain the processing sub-result of the target node.
[0105] According to another embodiment of the present disclosure, it also includes: an update module and a second adding module. The update module is used to update the state information of the target node after obtaining the processing sub-result of the target node. The second adding module is used to use the target node as a reference node and add the node identifier of the reference node to the first message.
[0106] According to another embodiment of the present disclosure, the node determination module includes: a state determination submodule and a node determination submodule. The state determination submodule is used to determine the state information of the reference node represented by the node identifier according to the node identifier in the first message. The node determination submodule is used to determine other nodes among the multiple nodes that depend on the reference node as target nodes when it is determined that the state information of the reference node is successfully executed.
[0107] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, including at least one processor; and a memory communicatively connected to the at least one processor; the memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can perform the above-mentioned task processing method.
[0108] According to an embodiment of the present disclosure, the present disclosure further provides a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to enable a computer to execute the above-mentioned task processing method.
[0109] According to an embodiment of the present disclosure, the present disclosure further provides a computer program product, including a computer program, and the computer program implements the above-mentioned task processing method when executed by a processor.
[0110] Figure 81 is a block diagram of an electronic device for implementing the task processing method of an embodiment of the present disclosure. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or claimed herein.
[0111] like Figure 8 As shown, the device 800 includes a computing unit 801, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 802 or a computer program loaded from a storage unit 808 to a random access memory (RAM) 803. In the RAM 803, various programs and data required for the operation of the device 800 can also be stored. The computing unit 801, the ROM 802, and the RAM 803 are connected to each other via a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.
[0112] A number of components in the device 800 are connected to the I / O interface 805, including: an input unit 806, such as a keyboard, a mouse, etc.; an output unit 807, such as various types of displays, speakers, etc.; a storage unit 808, such as a disk, an optical disk, etc.; and a communication unit 809, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 809 allows the device 800 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0113] The computing unit 801 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 801 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 801 performs the various methods and processes described above, such as the task processing method. For example, in some embodiments, the task processing method may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 808. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 800 via the ROM 802 and / or the communication unit 809. When the computer program is loaded into the RAM 803 and executed by the computing unit 801, one or more steps of the task processing method described above may be performed. Alternatively, in other embodiments, the computing unit 801 may be configured to perform the task processing method in any other appropriate manner (e.g., by means of firmware).
[0114] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0115] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0116] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or device, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer 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 foregoing.
[0117] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0118] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.
[0119] A computer system may include clients and servers. Clients and servers are generally remote from each other and usually interact through a communication network. The relationship of client and server is generated by computer programs running on respective computers and having a client-server relationship to each other.
[0120] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.
[0121] The above specific implementations do not constitute a limitation on the protection scope of the present disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present disclosure shall be included in the protection scope of the present disclosure.
Claims
1. A task processing method, comprising: In response to determining that the first queue includes a first message, obtaining the first message in the first queue, the first message including a task identifier of a task to be processed, the task including a plurality of subtasks, the task identifier being associated with a directed acyclic graph, the directed acyclic graph including a plurality of nodes, each node representing a subtask among the plurality of subtasks; Determining a target node to be executed from the plurality of nodes according to the dependency relationship of each of the nodes in the directed acyclic graph and the state information of the nodes; as well as Execute the processing logic of the target node to obtain the processing sub-result of the subtask represented by the target node; The first message is generated in response to obtaining a processing sub-result of any one of the multiple nodes and is added to the first queue.
2. The method according to claim 1, further comprising: In response to receiving the trigger request, determining a termination node according to the trigger request; According to a predetermined dependency relationship between a plurality of candidate nodes, determining other nodes that the termination node depends on from the plurality of candidate nodes; as well as The directed acyclic graph is generated according to the termination node and the other nodes, and the predetermined dependency relationship between the termination node and the other nodes.
3. The method according to claim 2, further comprising: After generating the directed acyclic graph, generating an initial trigger message, wherein the initial trigger message includes the task identifier; as well as The initial trigger message is used as the first message and added to the first queue.
4. The method according to claim 1, wherein: The executing the processing logic of the target node to obtain the processing sub-result of the sub-task represented by the target node includes: In response to detecting that the second queue includes a second message, acquiring the second message; wherein the second message is generated and added to the second queue in response to determining the target node, and the second message includes the task identifier and the node identifier of the target node; and According to the task identifier and the node identifier in the second message, the processing logic of the target node is called to obtain the processing sub-result.
5. The method according to claim 1, further comprising: After executing the processing logic of the target node and obtaining the processing sub-result of the sub-task represented by the target node, Updating the status information of the target node; as well as The target node is used as a reference node, and a node identifier of the reference node is added to the first message.
6. The method according to claim 5, wherein determining the target node to be executed from the plurality of nodes according to the dependency relationship of each of the nodes in the directed acyclic graph and the state information of the nodes comprises: Determine, according to the node identifier in the first message, the state information of the reference node represented by the node identifier; When it is determined that the state information of the reference node is successfully executed, other nodes among the multiple nodes that depend on the reference node are determined as the target nodes.
7. A task processing device, comprising: an acquisition module, configured to acquire, in response to determining that the first queue includes a first message, the first message in the first queue, wherein the first message includes a task identifier of a task to be processed, the task includes a plurality of subtasks, the task identifier is associated with a directed acyclic graph, the directed acyclic graph includes a plurality of nodes, each node representing a subtask among the plurality of subtasks; A node determination module, used for determining a target node to be executed from the plurality of nodes according to the dependency relationship of each of the nodes in the directed acyclic graph and the state information of the nodes; as well as An execution module, used to execute the processing logic of the target node and obtain the processing sub-result of the subtask represented by the target node; The first message is generated in response to obtaining a processing sub-result of any one of the multiple nodes and is added to the first queue.
8. An electronic device comprising: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 6.
9. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to cause the computer to execute the method according to any one of claims 1 to 6.
10. A computer program product comprising a computer program, which, when executed by a processor, implements the method according to any one of claims 1 to 6.