[go: up one dir, main page]

CN113344548B - Workflow generation method, device, equipment and storage medium - Google Patents

Workflow generation method, device, equipment and storage medium Download PDF

Info

Publication number
CN113344548B
CN113344548B CN202110731532.2A CN202110731532A CN113344548B CN 113344548 B CN113344548 B CN 113344548B CN 202110731532 A CN202110731532 A CN 202110731532A CN 113344548 B CN113344548 B CN 113344548B
Authority
CN
China
Prior art keywords
task
array
historical
node
target
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202110731532.2A
Other languages
Chinese (zh)
Other versions
CN113344548A (en
Inventor
乔一航
周可
邸帅
卢道和
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
WeBank Co Ltd
Original Assignee
WeBank Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by WeBank Co Ltd filed Critical WeBank Co Ltd
Priority to CN202110731532.2A priority Critical patent/CN113344548B/en
Publication of CN113344548A publication Critical patent/CN113344548A/en
Priority to PCT/CN2021/135115 priority patent/WO2023273157A1/en
Application granted granted Critical
Publication of CN113344548B publication Critical patent/CN113344548B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q10/00Administration; Management
    • G06Q10/10Office automation; Time management
    • G06Q10/103Workflow collaboration or project management

Landscapes

  • Business, Economics & Management (AREA)
  • Human Resources & Organizations (AREA)
  • Strategic Management (AREA)
  • Engineering & Computer Science (AREA)
  • Entrepreneurship & Innovation (AREA)
  • Operations Research (AREA)
  • Economics (AREA)
  • Marketing (AREA)
  • Data Mining & Analysis (AREA)
  • Quality & Reliability (AREA)
  • Tourism & Hospitality (AREA)
  • Physics & Mathematics (AREA)
  • General Business, Economics & Management (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The embodiment of the application provides a workflow generation method, a device, equipment and a storage medium, relating to the technical field of financial science and technology (Fintech), wherein the method comprises the following steps: after the scheduling system receives the task adjustment instruction aiming at the first workflow, a preliminary adjustment result of the first workflow is obtained by executing target adjustment operation aiming at least one task to be adjusted, and then the priority of each task in the preliminary adjustment result is adjusted to automatically obtain the second workflow.

Description

Workflow generation method, device, equipment and storage medium
Technical Field
The embodiment of the invention relates to the technical field of financial science and technology (Fintech), in particular to a workflow generation method, a workflow generation device, workflow generation equipment and a workflow storage medium.
Background
With the development of computer technology, more and more technologies are applied in the financial field, and the traditional financial industry is gradually changed to the financial technology (Fintech), but due to the requirements of safety and real-time performance of the financial industry, the requirements of the technology are also higher. In particular, in the context of multitasking, there is often a priority between different tasks. The user needs to manually edit the workflow and submit the system execution based on the priorities of the individual tasks. In the prior art, when a task changes, the workflow which is manually edited originally cannot meet the requirement of a user, and at the moment, the user needs to manually modify the workflow in a workflow engine and submit a new workflow to a system again, so that the processing efficiency is lower.
Disclosure of Invention
The embodiment of the application provides a workflow generation method, device, equipment and storage medium, which are used for improving the efficiency of workflow generation.
In one aspect, an embodiment of the present application provides a workflow generating method, where the method includes:
Receiving a task adjustment instruction aiming at a first workflow, wherein a task pool corresponding to the first workflow comprises a plurality of historical tasks in the first workflow and priorities corresponding to the historical tasks, the historical tasks are stored in a first array of the task pool, and the task adjustment instruction comprises target adjustment operation aiming at least one task to be adjusted;
Performing target adjustment operation for the at least one task to be adjusted in a first array of the task pool, and obtaining a preliminary adjustment result of the first workflow;
And adjusting the priority of each task in the preliminary adjustment result to obtain a second workflow.
In one aspect, an embodiment of the present application provides a workflow generating apparatus, including:
The task adjustment device comprises a receiving module, a task adjustment module and a task adjustment module, wherein the receiving module is used for receiving a task adjustment instruction aiming at a first workflow, a task pool corresponding to the first workflow comprises a plurality of historical tasks in the first workflow and priorities corresponding to the historical tasks, the historical tasks are stored in a first array of the task pool, and the task adjustment instruction comprises target adjustment operation aiming at least one task to be adjusted;
The execution module is used for executing target adjustment operation aiming at the at least one task to be adjusted in a first array of the task pool to obtain a preliminary adjustment result of the first workflow;
and the adjustment module is used for adjusting the priority of each task in the preliminary adjustment result to obtain a second workflow.
In one aspect, an embodiment of the present application provides a computer device, including a memory, a processor, and a computer program stored on the memory and executable on the processor, where the processor implements the steps of the workflow generation method described above when the processor executes the program.
In one aspect, embodiments of the present application provide a computer-readable storage medium storing a computer program executable by a computer device, which when run on the computer device, causes the computer device to perform the steps of the workflow generation method described above.
In the embodiment of the application, after the scheduling system receives the task adjustment instruction for the first workflow, the scheduling system obtains the preliminary adjustment result of the first workflow by executing the target adjustment operation for at least one task to be adjusted, and then adjusts the priority of each task in the preliminary adjustment result to automatically obtain the second workflow.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings that are needed in the description of the embodiments will be briefly described below, it will be apparent that the drawings in the following description are only some embodiments of the present invention, and that other drawings can be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a schematic diagram of a system architecture according to an embodiment of the present application;
FIG. 2 is a schematic flow chart of a workflow generating method according to an embodiment of the present application;
FIG. 3 is a schematic diagram of a first workflow according to an embodiment of the present application;
Fig. 4 is a flow chart of a workflow generating method according to an embodiment of the present application;
FIG. 5 is a schematic diagram of a second workflow according to an embodiment of the present application;
FIG. 6 is a flowchart illustrating a method for adjusting a first array according to an embodiment of the present application;
FIG. 7 is a flowchart illustrating a method for adjusting a second array according to an embodiment of the present application;
FIG. 8 is a schematic diagram of a ring array according to an embodiment of the present application;
FIG. 9 is a flow chart of a method for dynamic capacity expansion according to an embodiment of the present application;
FIG. 10 is a flowchart illustrating a method for array reclamation according to an embodiment of the present application;
FIG. 11 is a flowchart illustrating a method for adjusting a second array according to an embodiment of the present application;
FIG. 12 is a schematic diagram of a historical binary tree according to an embodiment of the present application;
FIG. 13 is a schematic diagram of an adjusted binary tree according to an embodiment of the present application;
fig. 14 is a schematic structural diagram of a target binary tree according to an embodiment of the present application;
FIG. 15 is a flowchart illustrating a method for adjusting a second array according to an embodiment of the present application;
FIG. 16 is a flowchart illustrating a method for adjusting a first array according to an embodiment of the present application;
FIG. 17 is a flowchart illustrating a method for adjusting a second array according to an embodiment of the present application;
FIG. 18 is a flow chart of a method for adjusting a binary tree according to an embodiment of the present application;
FIG. 19 is a flowchart illustrating a method for adjusting a second array according to an embodiment of the present application;
FIG. 20 is a schematic diagram of a first array, a second array, and a third array according to an embodiment of the present application;
FIG. 21 is a flowchart illustrating a method for adjusting a third array according to an embodiment of the present application;
FIG. 22 is a schematic diagram of a first array according to an embodiment of the present application;
fig. 23 is a schematic structural diagram of a target binary tree according to an embodiment of the present application;
FIG. 24 is a flowchart illustrating a method for adjusting a second array according to an embodiment of the present application;
FIG. 25 is a schematic diagram of a first array, a second array, and a third array according to an embodiment of the present application;
FIG. 26 is a flowchart illustrating a method for adjusting a third array according to an embodiment of the present application;
Fig. 27 is a schematic structural diagram of a workflow generating device according to an embodiment of the present application;
Fig. 28 is a schematic structural diagram of a computer device according to an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantageous effects of the present invention more apparent, the present invention will be further described in detail with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the invention.
For ease of understanding, the terms involved in the embodiments of the present invention are explained below.
Scheduling system: scheduling and managing tasks based on time and events.
The workflow: a directed acyclic graph is composed of a plurality of tasks, each task being executed in the order of the directed acyclic graph within a scheduling system.
Tasks: a specific task such as cleaning, processing, handling of data.
DCN: DATA CENTER Node, data center Node, including application layer, access layer, database layer. Each DCN carries a specified number of users.
Referring to fig. 1, a system architecture diagram applicable to an embodiment of the present application includes at least a terminal device 101 and a scheduling system 102.
The terminal device 101 is installed with a target application for generating a workflow, which may be a pre-installed client, a web page application, or an applet embedded in other applications, or the like. The terminal device 101 may be, but is not limited to, a smart phone, a tablet computer, a notebook computer, a desktop computer, and the like.
The dispatch system 102 serves the target application for its background servers. The dispatch system 102 may be an independent physical server, a server cluster or a distributed system formed by a plurality of physical servers, or a cloud server providing cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content distribution networks (Content Delivery Network, CDN), basic cloud computing services such as big data and artificial intelligence platforms, and the like. The terminal device 101 and the scheduling system 102 may be directly or indirectly connected through wired or wireless communication, which is not limited herein.
The terminal device 101 sends a workflow creation request to the scheduling system 102 in response to a workflow creation operation by a user, where the workflow creation request carries each task and a priority corresponding to each task. Scheduling system 102 orders the tasks based on their respective priorities to form a first workflow.
The terminal device 101 responds to the workflow adjustment operation of the user, and sends a task adjustment instruction for the first workflow to the scheduling system 102, wherein the task adjustment instruction comprises a target adjustment operation for at least one task to be adjusted. The scheduling system 102 receives the task adjustment instruction, performs a target adjustment operation for at least one task to be adjusted, obtains a preliminary adjustment result of the first workflow, and then adjusts priorities of the tasks in the preliminary adjustment result to obtain the second workflow. The scheduling system 102 executes the second workflow.
Based on the system architecture diagram shown in fig. 1, an embodiment of the present application provides a workflow generating method, as shown in fig. 2, where the method is performed by a computer device, and the computer device may be the scheduling system 102 shown in fig. 1, and includes the following steps:
Step S201, a task adjustment instruction for the first workflow is received.
Specifically, the task pool corresponding to the first workflow includes a plurality of historical tasks in the first workflow and priorities corresponding to the historical tasks. The plurality of historical tasks are stored in a first array of the task pool. The first workflow is a directed acyclic graph composed according to priorities of a plurality of historical tasks, the directed acyclic graph is a loop-free directed graph, and the first workflow executes tasks corresponding to each point in the graph according to the order of the directed acyclic graph.
For example, in the DCN scenario, the directed acyclic graph corresponding to the first workflow is shown in fig. 3, and includes tasks of task1, task2, task3, and task4, where task1 represents a derivative from data center node a, task2 represents a derivative from data center node B, task3 represents a derivative from data center node C, and task4 represents a derivative from data center node D.
The execution process of the first workflow is as follows: the derivative is first from data center node A, then from data center node B, then from data center node C, and finally from data center node D.
In addition, the task adjustment instruction includes a target adjustment operation for at least one task to be adjusted, where the task to be adjusted may be a newly added task or a historical task, and the target adjustment operation includes a newly added task operation, a task deletion operation, a task priority adjustment operation, and the like.
Step S202, a target adjustment operation for at least one task to be adjusted is executed in a first array of the task pool, and a preliminary adjustment result of the first workflow is obtained.
Specifically, the first array may be a ring array or a non-ring array.
When the target adjustment operation is a new task operation, the preliminary adjustment result includes the target new task and a plurality of historical tasks in the first workflow.
When the target adjustment operation is a task deletion operation, the preliminary adjustment result is a plurality of historical tasks remained after the target deletion task is deleted in the first workflow.
When the target adjustment operation is a task priority adjustment operation, the preliminary adjustment result is the first workflow.
Step S203, the priority of each task in the preliminary adjustment result is adjusted, and a second workflow is obtained.
Specifically, when the target adjustment operation is a new task operation, priorities of the target new task and a plurality of historical tasks in the first workflow are adjusted, and then a directed acyclic graph is formed according to the adjusted priorities of the tasks, so that the second workflow is obtained.
When the target adjustment operation is a task deletion operation, adjusting priorities of a plurality of historical tasks remained after the target deletion task is deleted, and then forming a directed acyclic graph according to the adjusted priorities of the historical tasks to obtain a second workflow.
When the target adjustment operation is a task priority adjustment operation, the priorities of a plurality of historical tasks are adjusted according to the task priority adjustment operation, and then a directed acyclic graph is formed according to the adjusted priorities of the historical tasks, so that a second workflow is obtained.
After the first workflow is executed or after the first workflow is finished in advance, the second workflow is executed according to the newly generated directed acyclic graph, and the scheduling system does not need to stop the executing workflow in the process.
It should be noted that, the second workflow may be adjusted based on the task adjustment instruction sent by the terminal device, to obtain a new workflow. The procedure for adjusting the second workflow is the same as the procedure for adjusting the first workflow, and will not be described here again.
For example, as shown in fig. 4, after the terminal device edits a plurality of tasks and priorities corresponding to the plurality of tasks, the user submits the tasks to the scheduling system, where the plurality of tasks are task1, task2, task3, and task4 shown in fig. 3, and the scheduling system executes each task based on the directed acyclic graph shown in fig. 3, where each task and the priorities of each task are stored in the task pool.
The terminal equipment sends a task adjusting instruction to the dispatching system, wherein the task adjusting instruction comprises task priority adjusting operations aiming at task3 and task 4. The scheduling system executes task priority adjustment operation aiming at task3 and task4, and adjusts the priorities of task3 and task4 in the task pool. And then generating a directed acyclic graph based on the adjusted tasks to obtain a second workflow, as shown in fig. 5.
The second workflow is executed according to the execution sequence shown in fig. 5, specifically: the derivative is first from data center node A, then from data center node B, then from data center node D, and finally from data center node C.
In the embodiment of the application, after the scheduling system receives the task adjustment instruction for the first workflow, the scheduling system obtains the preliminary adjustment result of the first workflow by executing the target adjustment operation for at least one task to be adjusted, and then adjusts the priority of each task in the preliminary adjustment result to automatically obtain the second workflow.
Optionally, in the step S202, the target adjustment operation is a task adding operation, and the task to be adjusted is a target task adding operation. And inserting the target newly-added task into the first array to obtain a preliminary adjustment result.
Specifically, the target newly added task may be inserted into an arbitrary empty position in the first array, so as to obtain a preliminary adjustment result.
For example, as shown in fig. 6, the first array is set to be a non-annular array, the first array includes historical tasks task1, task3, task4, task7 and task9, and task numbers corresponding to task1, task3, task4, task7 and task9 in the first array are sequentially 0, 2, 3, 6 and 8. And inserting the target newly added task2 into the position with the task number of 10 in the first array to obtain a preliminary adjustment result.
Optionally, the task pool further includes a second array, where the second array is configured to store task numbers corresponding to each of the plurality of historical tasks in the first array according to priorities corresponding to each of the plurality of historical tasks. And adding the task number corresponding to the target newly-added task in the first array into the second array.
Specifically, the second array may be a ring array or a non-ring array. And sequencing the plurality of historical tasks according to the sequence from the large priority to the small priority to obtain sequencing results of the plurality of historical tasks, and then determining the sequencing results of the task numbers corresponding to the plurality of historical tasks based on the sequencing results of the plurality of historical tasks. According to the sequencing result of the task numbers, the task numbers corresponding to the historical tasks are sequentially stored into the second array, the head pointer points to the task number corresponding to the task with the highest priority, and the tail pointer points to the latter position of the task number corresponding to the task with the lowest priority.
Optionally, the second array is a ring array, if it is determined that the space of the second array is not fully occupied based on the positions pointed by the head pointer and the tail pointer in the second array, the task number corresponding to the new task in the first array is added to the position pointed by the tail pointer in the second array, and the tail pointer is moved backward by one position.
Specifically, when the second array is a ring array, if the task corresponding to the task number pointed by the head pointer is executed, the task number pointed by the head pointer is deleted, the head pointer moves backwards by one position, and the vacated position can be used for storing the task number of the newly added task, so that the array space is utilized more effectively, and frequent memory allocation and release are avoided.
When the second array is a ring array, judging whether the space of the second array is fully occupied or not by adopting the following mode that the head pointer front and the tail pointer rear meet the relation: (rear index+1)% array length=front index.
When the second array is a non-annular array, if the tail pointer points to the last position of the array, the space of the second array is occupied.
For example, as shown in fig. 6, task numbers corresponding to the historical tasks task1, task3, task4, task7 and task9 are sequentially 0, 2, 3, 6 and 8, task numbers corresponding to the target newly added task2 are 10, priorities of the historical tasks are ordered as task1> task3> task4> task7> task9, and ordering results of the corresponding task numbers are 0, 2, 3, 6 and 8.
As shown in fig. 7, the second array is set to be a ring array, and the task numbers are sequentially stored in the second array according to the sorting result of any number, wherein the front pointer front points to the task number 0 corresponding to the task with the highest priority, the rear pointer rear points to the position, which is a free position and has the subscript of 5, of the task number 8 corresponding to the task with the highest priority. At this time (5+1)% 10=6, 6-! =0, so the array space is not fully occupied. And adding the task number 10 corresponding to the target newly added task2 to the empty position pointed by the tail pointer, and simultaneously moving the tail pointer backwards by one bit to point to the empty position with the index of 6.
Optionally, if it is determined that the space of the second array is occupied entirely based on the positions pointed by the head pointer and the tail pointer in the second array, a fourth array is constructed, and the fourth array is a ring array. And adding the task number corresponding to the target newly-added task in the first array to the initial position of the fourth array, and pointing the tail pointer to the position behind the initial position.
Specifically, when the space of the second array is fully occupied, a fourth array which is empty is initialized, and the space of the fourth array is larger than that of the second array. And writing the task number of the target newly-added task into the initial bit of the fourth array, and pointing the tail pointer of the second array to the position behind the initial position in the fourth array. When the data in the second array is all fetched, the head pointer of the second array also points to the fourth array, and the second array is automatically retrieved from the memory.
For example, as shown in fig. 8, the array has a length of 5, and four data a1, a2, a3, a4 are included in the array. The tail pointer rear points to the position of array index 4 and the head pointer front points to the position of array index 0. A5 and a6 are sequentially stored in the array, and at the moment, the index of the head pointer and the index of the tail pointer meet the formula (4+1)% 5=0, the space of the original annular array is occupied completely, and a5 and a6 cannot be stored in the annular array.
At this time, a new annular array is created, the space of which is larger than that of the original annular array. As shown in particular in fig. 9. A5 and a6 are sequentially stored in the new annular array, and the tail pointer rear points to the position with the subscript of 2 of the new annular array, the head pointer points to the position with the subscript of 0 of the original annular array, and the position is unchanged.
When a1, a2, a3 and a4 are sequentially taken out from the original annular array, the original annular array is empty, and the head pointer front points to the position with the subscript of 0 of the new annular array, so that the space of the original annular array is released, as shown in fig. 10.
In the embodiment of the application, when the space of the array is fully occupied, the dynamic expansion can realize the allocation of the space of the array along with the increase of the task quantity, thereby avoiding the situation that the task cannot be executed because the space of the array is fully occupied and avoiding the situation that a larger array space cannot be fully utilized because the space of the array is allocated. When the data in the original array are all taken out, the original array is automatically recovered from the memory, and the array space is automatically allocated and recovered, so that the waste of memory resources is avoided.
Optionally, a task number threshold of the task pool is preset, and when the task number in the task pool reaches the task number threshold, the task submitted by the terminal equipment is stopped, so that the resource exhaustion risk caused by infinite task creation of a user is avoided.
In step S203, the task number corresponding to the target newly-added task and the storage position of the task number corresponding to the plurality of history tasks in the second array are adjusted according to the priority of the target newly-added task and the priorities corresponding to the plurality of history tasks, and then the second workflow is obtained based on the adjusted first array and second array.
In one possible implementation manner, the task numbers corresponding to the target newly-added task and the task numbers corresponding to the plurality of historical tasks are arranged according to the priorities of the target newly-added task and the priorities corresponding to the plurality of historical tasks. And then, according to the sequencing result, adjusting the task number corresponding to the target newly-added task and the storage positions of the task numbers corresponding to the historical tasks in the second array, so as to obtain an adjusted second array.
For example, as can be seen from fig. 6, the priorities of the history tasks are set to be task1> task3> task4> task7> task9, and the task numbers corresponding to the history tasks in the first array are sequentially 0, 2, 3, 6, and 8. The task2 is newly added to the target, and the corresponding task number in the first array is 10. The relation between the priorities of the target newly added task and each history task is task1> task3> task2> task4> task7> task9. And sequencing task numbers corresponding to the target newly-added task and each historical task according to the relation of the priorities of the target newly-added task and each historical task, and determining sequencing results 0, 2, 10, 3, 6 and 8. And adjusting the storage positions of the task numbers 10 corresponding to the target newly added task2 and the task numbers corresponding to the historical tasks in the second array based on the sequencing result to obtain an adjusted second array. As shown in particular in fig. 11.
In another possible implementation manner, the task pool further comprises a history binary tree for representing priorities corresponding to the plurality of history tasks, each node in the history binary tree represents one history task, and a connection relationship between any two nodes is used for representing a priority relationship corresponding to any two nodes.
Adding new nodes corresponding to the target new tasks to the historical binary tree, and then adjusting the connection relation among all nodes in the historical binary tree based on the priorities of the target new tasks and the priorities corresponding to the plurality of historical tasks to obtain the target binary tree. And based on the target binary tree, adjusting the task number corresponding to the target newly-added task and the positions of the task numbers corresponding to the historical tasks in the second array.
Specifically, the historical binary tree may be a complete binary tree or a non-complete binary tree. The new node corresponding to the target new task may be a child node of any one leaf node in the history binary tree. For example, the new node corresponding to the target new task is a child node of the last leaf node in the history binary tree.
Judging whether the priority of the newly added node is greater than or equal to the priority of the father node, if so, exchanging the positions of the newly added node and the father node, judging whether the priority of the newly added node is greater than or equal to the priority of the father node, and so on until the priority of the newly added node is less than the priority of the father node, or the newly added node is the root node, and stopping updating the binary tree.
In addition, the second array may be adjusted using the updated binary tree after each exchange of the positions of the newly added node and its parent node; the second array may also be adjusted using the updated binary tree after the updating of the binary tree has ceased.
For example, the priorities of the history tasks are task1> task3> task4> task7> task9, and the history binary tree constructed based on the priorities of the history tasks is shown in fig. 12, where task1 corresponds to node 0, task3 corresponds to node 2, task4 corresponds to node 3, task7 corresponds to node 6, and task9 corresponds to node 8. the nodes corresponding to the task1 are used as root nodes, the nodes corresponding to the task3 and the task4 are respectively used as left and right sub-nodes of the nodes corresponding to the task1, and the nodes corresponding to the task7 and the task9 are respectively used as left and right sub-nodes of the nodes corresponding to the task 3.
The relation between the priority of the target newly added task2 and the priority of each history task is task1> task3> task2> task4> task7> task9, and the newly added node 10 corresponding to the target newly added task2 is inserted into a binary tree as a left child node of the node 3, as shown in fig. 13.
The priority corresponding to the newly added node 10 is compared with the priority corresponding to the node 3, and the position of the newly added node 10 is exchanged with the position of the node 3 because the priority corresponding to the newly added node 10 is greater than the priority corresponding to the node 3. As particularly shown in fig. 14.
Further, based on the binary tree shown in fig. 14, the saved positions of the task number 10 corresponding to the task2 and the task number 3 corresponding to the task4 in the second array are exchanged, so as to obtain an adjusted second array, as shown in fig. 15.
Then, the priority corresponding to the newly added node 10 in the binary tree is compared with the priority corresponding to the node 0, and the priority corresponding to the newly added node 10 is smaller than the priority corresponding to the node 0, so that the node is not exchanged. As shown in fig. 14.
In the embodiment of the application, each node in the history binary tree represents a history task, and the connection relation between any two nodes is used for representing the priority relation corresponding to any two nodes. When a target newly-added task is newly-added, adding the newly-added node corresponding to the target newly-added task to a history binary tree, gradually comparing the magnitude relation between the priority of the newly-added node and the priority of the father node of the newly-added node, and then adjusting the positions of the newly-added node and the father node of the newly-added node in the binary tree based on the obtained magnitude relation until the adjustment is finished.
Optionally, in the above step S202, the target adjustment operation is a task deletion operation, and the task to be adjusted is a target deletion task. And deleting the target deletion task from the first array to obtain a preliminary adjustment result.
Specifically, the first array may be a ring array or a non-ring array, and the target deletion task is deleted from the first array to obtain the preliminary adjustment result.
For example, as shown in fig. 16, a first array is set as a non-ring array, the first array includes historical tasks task1, task3, task4, task7, task9 and task2, the target deletion task1 is deleted from the first array, and task numbers of each retained historical task in the first array are respectively 2, 3, 6, 8 and 10.
Optionally, the task pool further includes a second array, where the second array is configured to store task numbers corresponding to the plurality of historical tasks in the first array according to priorities corresponding to the plurality of historical tasks. And deleting the task number corresponding to the target deletion task from the second array.
Specifically, the second array may be a ring array or a non-ring array. And sequencing the plurality of historical tasks according to the sequence from the large priority to the small priority to obtain sequencing results of the plurality of historical tasks, and then determining the sequencing results of the task numbers corresponding to the plurality of historical tasks based on the sequencing results of the plurality of historical tasks. And sequentially storing task numbers corresponding to the plurality of historical tasks into a second array according to the sequencing result of the task numbers. And deleting the task number corresponding to the target deletion task in the first array from the second array after receiving the task adjustment instruction.
In the embodiment of the application, the second array adopts the annular structure, so that the array space can be more effectively utilized, and frequent memory allocation and release are avoided.
Optionally, according to the priority corresponding to each historical task reserved in the second array, the storage position of the task number corresponding to each reserved historical task in the second array is adjusted, and the second workflow is obtained based on the adjusted first array and second array.
In one possible implementation manner, the task numbers corresponding to the target deletion tasks are deleted from the second group, the reserved historical tasks are ordered according to the priority of the reserved historical tasks, and the task numbers corresponding to the reserved historical tasks are arranged according to the ordering result of the historical tasks. And then, according to the task number sequencing result, correspondingly adjusting the storage positions of the task numbers corresponding to the reserved historical tasks in the second array, and obtaining an adjusted second array.
For example, as can be seen from fig. 16, the first array is set to include historical tasks task1, task3, task4, task7, task9 and task2, and the task numbers corresponding to the historical tasks in the first array are sequentially 0, 2, 3, 6, 8 and 10. The priority of each historical task is task1> task3> task2> task7> task9> task4, and the task numbers of each historical task are ordered according to the priority, so that ordering results are 0, 2, 10, 6, 8 and 3. And storing the task numbers of the historical tasks in a second array according to the sequencing result, as shown in fig. 17.
And deleting the task number 0 corresponding to the target deletion task1 from the second array, sorting the task numbers according to the reserved relation of the priorities of the historical tasks, and determining the sorting result as 2, 10, 6, 8 and 3. And adjusting the storage positions of task numbers corresponding to the reserved task3, task2, task7, task9 and task4 in the second array based on the sequencing result to obtain an adjusted second array.
In another possible implementation manner, the task pool further comprises a history binary tree for representing priorities corresponding to the plurality of history tasks, each node in the history binary tree represents one history task, and a connection relationship between any two nodes is used for representing a priority relationship corresponding to any two nodes.
And deleting the node corresponding to the target deletion task from the historical binary tree, and then adjusting the connection relation among all nodes in the historical binary tree based on the reserved priorities corresponding to all the historical tasks to obtain the target binary tree. And then, based on the target binary tree, adjusting the storage positions of the task numbers corresponding to the reserved historical tasks in the second array.
Specifically, the historical binary tree may be a complete binary tree or a non-complete binary tree. The deleting node corresponding to the target deleting task can be any node in the history binary tree, and after deleting the target deleting node from the history binary tree, the node with the smallest priority is selected from the reserved nodes to serve as a replacing node to be inserted into the position of the target deleting node. For example, when executing the task with the highest priority, at this time, the deleting node corresponding to the target deleting task is the root node, deleting the root node, and then inserting the node with the lowest priority in the reserved nodes as the replacing node into the position of the original root node.
After inserting the node with the smallest priority into the position of the target deletion node, judging whether the priority of the new insertion node is smaller than the priority of the left child node, if so, exchanging the positions of the new insertion node and the left child node, if not, judging whether the priority of the new insertion node is smaller than the priority of the right child node, and if so, exchanging the positions of the new insertion node and the right child node. And then judging whether the priority of the new inserted node is smaller than the priorities of the left and right child nodes, and so on until the priority of the new inserted node is larger than or equal to the priorities of the left and right child nodes, or the new inserted node is a leaf node, and stopping updating the binary tree.
In addition, after the positions of the new inserted node and the left and right child nodes are exchanged each time, the second array can be adjusted by adopting an updated binary tree; the second array may also be adjusted using the updated binary tree after the updating of the binary tree has ceased.
For example, as shown in fig. 18 and 19, the priorities of the history tasks are set to be task1> task3> task2> task7> task9> task4, and a history binary tree is constructed based on the priorities of the history tasks, where task1 corresponds to node 0, task3 corresponds to node 2, task2 corresponds to node 10, task7 corresponds to node 6, task9 corresponds to node 8, task4 corresponds to node 3, node 0 is a root node, node 2 and node 10 are left and right sub-nodes of node 0, node 6 and node 8 are left and right sub-nodes of node 2, and node 3 is a left sub-node of task 10.
And sequencing the task numbers corresponding to the historical tasks in the first array according to the priority, obtaining sequencing results of 0, 2, 10, 6, 8 and 3, and storing the task numbers of the historical tasks in the second array according to the sequencing results.
Setting a target deletion task as task1, setting a corresponding node as node 0, deleting the node 0 from the binary tree, and inserting a node with the minimum priority (namely node 3 corresponding to task 4) into the position of the original node 0 to obtain the binary tree after first adjustment.
Correspondingly, the storage position of the task number 3 in the second array is adjusted to the storage position of the task number 0, and the second array after the first adjustment is obtained, wherein the task number 3 is the task number corresponding to the task4, and the task number 0 is the task number corresponding to the task 1.
And comparing the priority corresponding to the newly inserted node 3 with the priority of the node 2, and exchanging the position of the node 3 with the position of the node 2 because the priority of the node 3 is smaller than the priority of the node 2 to obtain a binary tree after the second adjustment.
Correspondingly, the storage positions of the task number 3 and the task number 2 in the second array are exchanged to obtain a second array after the second adjustment, wherein the task number 3 is a task number corresponding to the task4, and the task number 2 is a task number corresponding to the task 3.
And comparing the priority corresponding to the newly inserted node 3 with the priority corresponding to the node 6, and exchanging the position of the node 3 with the position of the node 6 because the priority corresponding to the node 3 is smaller than the priority corresponding to the node 6, thereby obtaining a binary tree after the third adjustment.
Correspondingly, the storage positions of the task number 3 corresponding to the task4 and the task number 6 corresponding to the task7 in the second array are exchanged, and a second array after the third adjustment is obtained. At this point the newly inserted node 3 is already a leaf node, so updating the binary tree is stopped.
In the embodiment of the application, each node in the history binary tree represents a history task, and the connection relation between any two nodes is used for representing the priority relation corresponding to any two nodes. When deleting the target deletion task, deleting the node corresponding to the target deletion task in the history binary tree, adopting the node with the smallest priority in the reserved nodes as the replacement node to replace the deleted node, then gradually comparing the priority of the replacement node with the priority of the child node of the replacement node, adjusting the positions of the replacement node and the child node of the replacement node in the binary tree based on the obtained size relationship until the adjustment is finished, and because only the replacement node and the child node of the replacement node are adjusted, other nodes can be kept unchanged, the number of times of adjusting the position of the node is effectively reduced, and when correspondingly adjusting the second array based on the binary tree, the number of times of modifying the second array is also reduced, thereby improving the efficiency of adjusting the priority.
Optionally, the task pool further includes a third array, for any one of the historical tasks, the third array is used for associating a task number of the historical task in the first array with a storage location of a task number of the historical task in the second array. And updating the third array before the second workflow is obtained based on the adjusted first array and second array.
Specifically, the third array may be a ring array or a non-ring array. The number of a history task in the third array corresponds to the task number of the history task in the first array, and the storage position of the task number of the history task in the second array is stored in the third array. When the storage position of the historical task in the second array changes, the storage position of the historical task stored in the third array in the second array is correspondingly updated.
For example, as shown in fig. 20, the first array and the third array are set to be non-annular arrays, the second array is set to be annular arrays, the first array includes tasks task1, task3, task4, task7, task9 and task2, and task numbers corresponding to the tasks in the first array are sequentially 0, 2, 3, 6, 8 and 10.
Sequencing each task according to the priority of each task, and obtaining sequencing results as follows: task1, task3, task2, task7, task9 and task4, and correspondingly, the sequencing result of the task numbers corresponding to each task in the first array is as follows: 0.2, 10, 6, 8, 3. And storing the task numbers corresponding to the tasks in the first array in the second array according to the sequencing result of the task numbers.
Based on the first array and the second array, the position with the number of 0 in the third array saves the save position 0 of task1 in the second array, the position with the number of 2 in the third array saves the save position 1 of task3 in the second array, the position with the number of 3 in the third array saves the save position 5 of task4 in the second array, the position with the number of 6 in the third array saves the save position 3 of task7 in the second array, the position with the number of 8 in the third array saves the save position 4 of task9 in the second array, the position with the number of 10 in the third array saves the save position 2 in the second array, and the rest positions are empty.
Further, deleting the task number 0 corresponding to the task1 from the second array, and storing the task number 3 corresponding to the task4 in the position of the task number 0 corresponding to the original task1 to obtain an adjusted second array. When the second array is adjusted, a third array is correspondingly adjusted, namely, the content stored in the position 0 associated with the task number corresponding to the task1 is set to be empty, the content 5 stored in the number 3 corresponding to the task4 is modified to be 0, and the adjusted third array is shown in fig. 21.
Because the third array is used for associating the task number of one historical task in the first array with the storage position of the task number of the historical task in the second array, when the second array needs to be adjusted, the storage position of the task number of the task in the second array can be quickly determined by inquiring the third array based on the task number corresponding to the task in the first array, and then the priority of the task is adjusted by adjusting the storage position of the task number of the task, so that the efficiency of adjusting the task priority is improved, and the efficiency of generating the workflow is also improved.
Optionally, in step S202, the target adjustment operation is a task priority adjustment operation, the task to be adjusted includes a first historical task and a second historical task, the task pool includes a second array, and the second array is used for storing task numbers corresponding to the plurality of historical tasks in the first array according to priorities corresponding to the plurality of historical tasks.
And respectively determining a first storage position of a first task number corresponding to the first historical task in the first array in the second array and a second storage position of a second task number corresponding to the second historical task in the first array in the second array. And then, storing the task number corresponding to the second historical task in a first storage position, and storing the task number corresponding to the first historical task in a second storage position. And obtaining a second workflow based on the first array and the adjusted second array.
Specifically, the task pool further comprises a history binary tree for representing priorities corresponding to the plurality of history tasks, each node in the history binary tree represents one history task, and the connection relation between any two nodes is used for representing the priority relation corresponding to any two nodes. Determining nodes of the first historical task in the binary tree, determining nodes of the second historical task in the binary tree, and exchanging the two nodes to obtain a target binary tree. And then, based on the target binary tree, adjusting the storage positions of the task numbers corresponding to the historical tasks in the second array.
In the embodiment of the present application, the task to be adjusted is not limited to the two history tasks of the first history task and the second history task, but may be more than two history tasks. The task priority adjustment operation is not limited to the position adjustment performed once in the second array, and may be performed a plurality of times, and the applicant is not particularly limited.
For example, as shown in fig. 22, task3, task4, task7, task9, task2 are stored in the first array, task numbers corresponding to each task in the first array are sequentially 2, 3, 6, 8, 10, priorities of each history task are task3> task7> task2> task4> task9, and corresponding binary tree is the binary tree after the third adjustment in fig. 18.
The first historical task to be adjusted is task3, the second historical task to be adjusted is task7, the priority of task3 and task7 is adjusted, namely, the node 2 corresponding to task3 in the binary tree is exchanged with the node 6 corresponding to task7, and the binary tree obtained after exchanging is shown in fig. 23.
Further, based on the binary tree shown in fig. 23, the save positions of the task number 2 corresponding to the task3 and the task number 6 corresponding to the task7 in the second array are exchanged, and an adjusted second array is obtained, as shown in fig. 24.
Optionally, based on the first task number corresponding to the first historical task in the first array, querying the third array, and determining a first storage position of the first task number in the second array. And inquiring a third array based on a second task number corresponding to the second historical task in the first array, and determining a second storage position of the second task number in the second array.
Further, a second task number corresponding to the second historical task is stored in a first storage position, a first task number corresponding to the first historical task is stored in a second storage position, and a third array is updated based on the first array and the adjusted second array.
For example, as shown in fig. 25, the first array and the third array are set to be non-annular arrays, the second array is set to be annular arrays, and task numbers corresponding to the first array including the historical tasks task3, task4, task7, task9 and task2 are sequentially 2, 3, 6, 8 and 10.
Sequencing each task according to the priority of each task, and obtaining sequencing results as follows: task3, task7, task2, task4 and task9, and correspondingly, the sequencing result of the task numbers corresponding to each task in the first array is as follows: 2.6, 10, 3 and 8. And storing the task numbers corresponding to the tasks in the first array in the second array according to the sequencing result of the task numbers.
The position numbered 2 in the third array saves the position 0 of task3 in the second array, the position numbered 3 in the third array saves the position 3 of task4 in the second array, the position numbered 6 in the third array saves the position 1 of task7 in the second array, the position numbered 8 in the third array saves the position numbered 8 of task9 in the second array, the position numbered 10 in the third array saves the position 2 of task2 in the second array, and the rest positions are empty.
Inquiring a third array according to a task number 2 corresponding to the task3, and determining that the storage position of the task number 2 in the second array is 0; and inquiring the third array according to the task number 6 corresponding to the task7, and determining the storage position of the task number 6 in the second array as 1. And exchanging the content with the storage position of 0 and the storage position of 1 in the second array to obtain an adjusted second array.
Correspondingly adjusting the third array, wherein the adjusted third array is shown in fig. 26, the position numbered 2 in the third array saves the save position 1 of the task3 in the second array, and the position numbered 6 in the third array saves the save position 0 of the task7 in the second array.
The third array is used for associating the task number of one historical task in the first array with the storage position of the task number of the historical task in the second array, so that when the second array needs to be adjusted, the storage position of the task number of the task in the second array can be quickly determined by inquiring the third array based on the task number corresponding to the task in the first array, and further the priority of the task is adjusted by adjusting the storage position of the task number of the task, thereby improving the efficiency of task priority adjustment and the efficiency of workflow generation.
Based on the same technical concept, an embodiment of the present application provides a workflow generating apparatus, as shown in fig. 27, the apparatus 2700 includes:
A receiving module 2701, configured to receive a task adjustment instruction for a first workflow, where a task pool corresponding to the first workflow includes a plurality of historical tasks in the first workflow and priorities corresponding to the plurality of historical tasks, where the plurality of historical tasks are stored in a first array of the task pool, and the task adjustment instruction includes a target adjustment operation for at least one task to be adjusted;
An execution module 2702, configured to execute a target adjustment operation for the at least one task to be adjusted in a first array of the task pool, to obtain a preliminary adjustment result of the first workflow;
The adjusting module 2703 is configured to adjust priorities of the tasks in the preliminary adjustment result, and obtain a second workflow.
Optionally, the plurality of historical tasks are stored in a first array of the task pool, the target adjustment operation is a newly added task operation, and the task to be adjusted is a target newly added task;
the execution module 2702 is specifically configured to:
And inserting the target newly-added task into the first array to obtain the preliminary adjustment result.
Optionally, the task pool further includes a second array, where the second array is configured to store task numbers corresponding to the plurality of historical tasks in the first array according to priorities corresponding to the plurality of historical tasks;
the adjustment module 2703 is specifically configured to:
adding a task number corresponding to the target newly-added task in the first array to the second array;
according to the priority of the target newly-added task and the priorities corresponding to the plurality of historical tasks, adjusting the task numbers corresponding to the target newly-added task and the storage positions of the task numbers corresponding to the plurality of historical tasks in the second array;
and obtaining a second workflow based on the adjusted first array and second array.
Optionally, the second array is a ring array;
the adjustment module 2703 is specifically configured to:
If the space of the second array is not fully occupied based on the positions pointed by the head pointer and the tail pointer in the second array, adding the task number corresponding to the target newly-added task in the first array to the position pointed by the tail pointer in the second array, and moving the tail pointer backwards by one position.
Optionally, the adjusting module 2703 is specifically configured to:
if the space of the second array is determined to be occupied completely based on the positions pointed by the head pointer and the tail pointer in the second array respectively, a fourth array is constructed, and the fourth array is an annular array;
And adding the task number corresponding to the target newly-added task in the first array to the initial position of the fourth array, and pointing the tail pointer to the position behind the initial position.
Optionally, the task pool further includes a history binary tree for representing priorities corresponding to the plurality of history tasks, each node in the history binary tree represents a history task, and a connection relationship between any two nodes is used for representing a priority relationship corresponding to any two nodes;
the adjustment module 2703 is specifically configured to:
adding a new node corresponding to the target new task to the historical binary tree;
based on the priority of the target newly-added task and the priorities corresponding to the historical tasks, adjusting the connection relation among all nodes in the historical binary tree to obtain a target binary tree;
And adjusting the task numbers corresponding to the target newly-added task and the positions of the task numbers corresponding to the historical tasks in the second array based on the target binary tree.
Optionally, the task pool further includes a third array, for any one historical task, where the third array is used to associate a task number of the one historical task in the first array and a storage location of the task number of the one historical task in the second array;
The adjustment module 2703 is further configured to:
And updating the third array based on the adjusted first array and the second array before the second workflow is obtained.
Optionally, the target adjustment operation is a task priority adjustment operation, the task to be adjusted includes a first historical task and a second historical task, the task pool includes a second array, the second array is used for storing task numbers corresponding to the plurality of historical tasks in the first array according to priorities corresponding to the plurality of historical tasks, and the second array is a ring array;
the adjustment module 2703 is specifically configured to:
respectively determining a first storage position of a first task number corresponding to the first historical task in the first array in the second array and a second storage position of a second task number corresponding to the second historical task in the first array in the second array;
Storing the task number corresponding to the second historical task in the first storage position, and storing the task number corresponding to the first historical task in the second storage position;
and obtaining a second workflow based on the first array and the adjusted second array.
Optionally, the task pool further includes a third array, for any one historical task, where the third array is used to associate a task number of the one historical task in the first array and a storage location of the task number of the one historical task in the second array;
the adjustment module 2703 is specifically configured to:
inquiring the third array based on a first task number corresponding to the first historical task in the first array, and determining a first storage position of the first task number in the second array;
and inquiring the third array based on a second task number corresponding to the second historical task in the first array, and determining a second storage position of the second task number in the second array.
Based on the same technical concept, the embodiment of the present application provides a computer device, which may be a terminal or a server, as shown in fig. 28, including at least one processor 2801 and a memory 2802 connected to the at least one processor, where a specific connection medium between the processor 2801 and the memory 2802 is not limited in the embodiment of the present application, and in fig. 28, the processor 2801 and the memory 2802 are connected by a bus as an example. The buses may be divided into address buses, data buses, control buses, etc.
In an embodiment of the present application, the memory 2802 stores instructions executable by the at least one processor 2801, and the at least one processor 2801 may perform steps included in the above-described workflow generation method by executing the instructions stored in the memory 2802.
Where processor 2801 is a control center for a computer device, various interfaces and lines may be used to connect various portions of the computer device for workflow generation by executing or executing instructions stored in memory 2802 and invoking data stored in memory 2802. Alternatively, processor 2801 may include one or more processing units, and processor 2801 may integrate an application processor that primarily processes operating systems, user interfaces, application programs, and the like, with a modem processor that primarily processes wireless communications. It will be appreciated that the modem processor described above may not be integrated into the processor 2801. In some embodiments, processor 2801 and memory 2802 may be implemented on the same chip, or they may be implemented separately on separate chips in some embodiments.
The processor 2801 may be a general purpose processor such as a Central Processing Unit (CPU), digital signal processor, application SPECIFIC INTEGRATED Circuit (ASIC), field programmable gate array or other programmable logic device, discrete gate or transistor logic, discrete hardware components, etc., that may implement or perform the methods, steps, and logic diagrams disclosed in embodiments of the application. The general purpose processor may be a microprocessor or any conventional processor or the like. The steps of a method disclosed in connection with the embodiments of the present application may be embodied directly in a hardware processor for execution, or in a combination of hardware and software modules in the processor for execution.
Memory 2802 serves as a non-volatile computer-readable storage medium that can be used to store non-volatile software programs, non-volatile computer-executable programs, and modules. The Memory 2802 may include at least one type of storage medium, and may include, for example, flash Memory, hard disk, multimedia card, card Memory, random access Memory (Random Access Memory, RAM), static random access Memory (Static Random Access Memory, SRAM), programmable Read-Only Memory (Programmable Read Only Memory, PROM), read-Only Memory (ROM), charged erasable programmable Read-Only Memory (ELECTRICALLY ERASABLE PROGRAMMABLE READ-Only Memory, EEPROM), magnetic Memory, magnetic disk, optical disk, and the like. Memory 2802 is any other medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a computer, but is not limited to such. The memory 2802 of embodiments of the present application may also be circuitry or any other device capable of performing memory functions for storing program instructions and/or data.
Based on the same inventive concept, an embodiment of the present application provides a computer-readable storage medium storing a computer program executable by a computer device, which when run on the computer device, causes the computer device to perform the steps of the above-described workflow generation method.
It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as a method, or as a computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
While preferred embodiments of the present invention have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. It is therefore intended that the following claims be interpreted as including the preferred embodiments and all such alterations and modifications as fall within the scope of the invention.
It will be apparent to those skilled in the art that various modifications and variations can be made to the present invention without departing from the spirit or scope of the invention. Thus, it is intended that the present invention also include such modifications and alterations insofar as they come within the scope of the appended claims or the equivalents thereof.

Claims (8)

1. A workflow generation method, comprising:
Receiving a task adjustment instruction aiming at a first workflow, wherein a task pool corresponding to the first workflow comprises a plurality of historical tasks in the first workflow and priorities corresponding to the historical tasks, the historical tasks are stored in a first array of the task pool, and the task adjustment instruction comprises target adjustment operation aiming at least one task to be adjusted;
Performing target adjustment operation for the at least one task to be adjusted in a first array of the task pool, and obtaining a preliminary adjustment result of the first workflow;
adjusting the priority of each task in the preliminary adjustment result to obtain a second workflow;
the target adjustment operation is a newly added task operation, and the task to be adjusted is a target newly added task;
the performing, in the first array of the task pool, a target adjustment operation for the at least one task to be adjusted, to obtain a preliminary adjustment result of the first workflow, including:
inserting the target newly-added task into the first array to obtain the preliminary adjustment result;
the task pool also comprises a second array, wherein the second array is used for storing task numbers corresponding to the historical tasks in the first array according to priorities corresponding to the historical tasks;
The step of adjusting the priority of each task in the preliminary adjustment result to obtain a second workflow comprises the following steps:
adding a task number corresponding to the target newly-added task in the first array to the second array;
according to the priority of the target newly-added task and the priorities corresponding to the plurality of historical tasks, adjusting the task numbers corresponding to the target newly-added task and the storage positions of the task numbers corresponding to the plurality of historical tasks in the second array;
Obtaining a second workflow based on the adjusted first array and second array;
the second array is a ring array; the adding the task number corresponding to the target newly added task in the first array to the second array includes:
If the space of the second array is not fully occupied based on the positions pointed by the head pointer and the tail pointer in the second array, adding the task number corresponding to the target newly-added task in the first array to the position pointed by the tail pointer in the second array, and moving the tail pointer backwards by one position;
The task pool also comprises a history binary tree for representing priorities corresponding to the plurality of history tasks, each node in the history binary tree represents a history task, and a connection relationship between any two nodes is used for representing a priority relationship corresponding to any two nodes;
the adjusting the task number corresponding to the target newly-added task and the storage position of the task number corresponding to the plurality of historical tasks in the second array according to the priority of the target newly-added task and the priorities corresponding to the plurality of historical tasks respectively, includes:
adding a new node corresponding to the target new task to the historical binary tree;
Judging whether the priority of the newly added node is greater than or equal to the priority of the father node of the newly added node, if so, exchanging the positions of the newly added node and the father node of the newly added node, judging again whether the priority of the newly added node is greater than or equal to the priority of the father node of the newly added node, and so on until the priority of the newly added node is less than the priority of the father node of the newly added node, or the newly added node is a root node, stopping updating the binary tree, and obtaining a target binary tree;
And adjusting the task numbers corresponding to the target newly-added task and the positions of the task numbers corresponding to the historical tasks in the second array based on the target binary tree.
2. The method as recited in claim 1, further comprising:
if the space of the second array is determined to be occupied completely based on the positions pointed by the head pointer and the tail pointer in the second array respectively, a fourth array is constructed, and the fourth array is an annular array;
And adding the task number corresponding to the target newly-added task in the first array to the initial position of the fourth array, and pointing the tail pointer to the position behind the initial position.
3. The method of claim 2, further comprising a third array in the task pool, wherein the third array is used to associate, for any one of the historical tasks, a task number of the one historical task in the first array, and a saved location of the task number of the one historical task in the second array;
before the second workflow is obtained based on the adjusted first array and the second array, the method further comprises:
and updating the third array based on the adjusted first array and second array.
4. A method according to any one of claims 1 to 3, wherein the target adjustment operation is a task priority adjustment operation, the task to be adjusted includes a first historical task and a second historical task, the task pool includes a second array, the second array is used for storing task numbers corresponding to each of the plurality of historical tasks in a first array according to priorities corresponding to each of the plurality of historical tasks, and the second array is a ring array;
The step of adjusting the priority of each task in the preliminary adjustment result to obtain a second workflow comprises the following steps:
respectively determining a first storage position of a first task number corresponding to the first historical task in the first array in the second array and a second storage position of a second task number corresponding to the second historical task in the first array in the second array;
Storing the task number corresponding to the second historical task in the first storage position, and storing the task number corresponding to the first historical task in the second storage position;
and obtaining a second workflow based on the first array and the adjusted second array.
5. The method of claim 4, further comprising a third array in the task pool, wherein the third array is configured to associate, for any one of the historical tasks, a task number of the one historical task in the first array, and a saved location of the task number of the one historical task in the second array;
the determining, respectively, a first storage location of a task number corresponding to the first historical task in the first array in the second array, and a second storage location of a task number corresponding to the second historical task in the first array in the second array includes:
inquiring the third array based on a first task number corresponding to the first historical task in the first array, and determining a first storage position of the first task number in the second array;
and inquiring the third array based on a second task number corresponding to the second historical task in the first array, and determining a second storage position of the second task number in the second array.
6. A workflow generating apparatus, comprising:
The task adjustment device comprises a receiving module, a task adjustment module and a task adjustment module, wherein the receiving module is used for receiving a task adjustment instruction aiming at a first workflow, a task pool corresponding to the first workflow comprises a plurality of historical tasks in the first workflow and priorities corresponding to the historical tasks, the historical tasks are stored in a first array of the task pool, and the task adjustment instruction comprises target adjustment operation aiming at least one task to be adjusted;
The execution module is used for executing target adjustment operation aiming at the at least one task to be adjusted in a first array of the task pool to obtain a preliminary adjustment result of the first workflow;
the adjustment module is used for adjusting the priority of each task in the preliminary adjustment result to obtain a second workflow;
the target adjustment operation is a newly added task operation, and the task to be adjusted is a target newly added task;
The execution module is further configured to insert the target newly-added task into the first array to obtain the preliminary adjustment result;
the task pool also comprises a second array, wherein the second array is used for storing task numbers corresponding to the historical tasks in the first array according to priorities corresponding to the historical tasks;
The adjusting module is further configured to add a task number corresponding to the target newly-added task in the first array to the second array; according to the priority of the target newly-added task and the priorities corresponding to the plurality of historical tasks, adjusting the task numbers corresponding to the target newly-added task and the storage positions of the task numbers corresponding to the plurality of historical tasks in the second array; obtaining a second workflow based on the adjusted first array and second array;
The second array is a ring array; the adjusting module is further configured to, if it is determined that the space of the second array is not fully occupied based on the positions pointed by the head pointer and the tail pointer in the second array, add the task number corresponding to the target newly added task in the first array to the position pointed by the tail pointer in the second array, and move the tail pointer backward by one position;
The task pool also comprises a history binary tree for representing priorities corresponding to the plurality of history tasks, each node in the history binary tree represents a history task, and a connection relationship between any two nodes is used for representing a priority relationship corresponding to any two nodes;
The adjustment module is further configured to add a new node corresponding to the target new task to the historical binary tree; judging whether the priority of the newly added node is greater than or equal to the priority of the father node of the newly added node, if so, exchanging the positions of the newly added node and the father node of the newly added node, judging again whether the priority of the newly added node is greater than or equal to the priority of the father node of the newly added node, and so on until the priority of the newly added node is less than the priority of the father node of the newly added node, or the newly added node is a root node, stopping updating the binary tree, and obtaining a target binary tree; and adjusting the task numbers corresponding to the target newly-added task and the positions of the task numbers corresponding to the historical tasks in the second array based on the target binary tree.
7. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the steps of the method of any of claims 1-5 when the program is executed.
8. A computer readable storage medium, characterized in that it stores a computer program executable by a computer device, which when run on the computer device causes the computer device to perform the steps of the method of any of claims 1-5.
CN202110731532.2A 2021-06-30 2021-06-30 Workflow generation method, device, equipment and storage medium Active CN113344548B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN202110731532.2A CN113344548B (en) 2021-06-30 2021-06-30 Workflow generation method, device, equipment and storage medium
PCT/CN2021/135115 WO2023273157A1 (en) 2021-06-30 2021-12-02 Workflow generation method and apparatus, and device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110731532.2A CN113344548B (en) 2021-06-30 2021-06-30 Workflow generation method, device, equipment and storage medium

Publications (2)

Publication Number Publication Date
CN113344548A CN113344548A (en) 2021-09-03
CN113344548B true CN113344548B (en) 2024-10-15

Family

ID=77481614

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110731532.2A Active CN113344548B (en) 2021-06-30 2021-06-30 Workflow generation method, device, equipment and storage medium

Country Status (2)

Country Link
CN (1) CN113344548B (en)
WO (1) WO2023273157A1 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113344548B (en) * 2021-06-30 2024-10-15 深圳前海微众银行股份有限公司 Workflow generation method, device, equipment and storage medium

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110689232A (en) * 2019-09-03 2020-01-14 深圳壹账通智能科技有限公司 Workflow configuration optimization processing method and device and computer equipment

Family Cites Families (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2007132547A1 (en) * 2006-05-16 2007-11-22 Fujitsu Limited Job model generation program, job model generation method, and job model generation device
US11816616B2 (en) * 2016-05-20 2023-11-14 International Business Machines Corporation Workflow scheduling and optimization tools
CN108665129A (en) * 2017-03-31 2018-10-16 华为软件技术有限公司 A kind of Workflow Custom method and device
CN110018860B (en) * 2019-04-04 2022-11-08 深圳市永兴元科技股份有限公司 Workflow management method, device, equipment and computer storage medium
CN110727969B (en) * 2019-10-22 2021-10-15 深圳前海微众银行股份有限公司 Workflow automatic adjustment method, device, device and storage medium
CN111813525B (en) * 2020-07-09 2024-05-03 西北工业大学 Heterogeneous system workflow scheduling method
CN112001707A (en) * 2020-09-02 2020-11-27 平安养老保险股份有限公司 Business workflow generation method and system based on business data
CN112367205B (en) * 2020-11-12 2023-04-18 深圳前海微众银行股份有限公司 Processing method and scheduling system for HTTP scheduling request
CN113344548B (en) * 2021-06-30 2024-10-15 深圳前海微众银行股份有限公司 Workflow generation method, device, equipment and storage medium

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110689232A (en) * 2019-09-03 2020-01-14 深圳壹账通智能科技有限公司 Workflow configuration optimization processing method and device and computer equipment

Also Published As

Publication number Publication date
WO2023273157A1 (en) 2023-01-05
CN113344548A (en) 2021-09-03

Similar Documents

Publication Publication Date Title
US10990561B2 (en) Parameter server and method for sharing distributed deep learning parameter using the same
CN109254733B (en) Method, device and system for storing data
CN102103497B (en) Finite state machine actuating device and method, and method for establishing and using finite state machine
US20130246554A1 (en) System and method for transmitting complex structures based on a shared memory queue
CN107066498B (en) Key value KV storage method and device
CN114239060B (en) Data acquisition method and device, electronic equipment and storage medium
CN111813515B (en) Multi-process-based task scheduling method, device, computer equipment and medium
CN104881466A (en) Method and device for processing data fragments and deleting garbage files
US20120224482A1 (en) Credit feedback system for parallel data flow control
CN109657177A (en) The generation method of the page, device, storage medium and computer equipment after upgrading
CN112965939A (en) File merging method, device and equipment
CN111209120A (en) Data synchronization method and device for microservice and computer readable storage medium
CN113377724A (en) Cache space management method, device and storage medium
CN115964002B (en) Electric energy meter terminal archive management method, device, equipment and medium
CN113344548B (en) Workflow generation method, device, equipment and storage medium
CN116643890A (en) Cluster resource scheduling method, device, equipment and medium
CN109376001A (en) A kind of method and apparatus of resource allocation
US9009731B2 (en) Conversion of lightweight object to a heavyweight object
CN108111598B (en) Cloud disk data issuing method and device and storage medium
CN114969165B (en) Data query request processing method, device, equipment and storage medium
US9652766B1 (en) Managing data stored in memory locations having size limitations
CN113127207B (en) Crowd-sourced task resource allocation method and device, electronic equipment and storage medium
CN117632433A (en) Method, device equipment and storage medium for improving interrupt response speed
CN115062044B (en) A data query method, device, equipment and storage medium
US10447607B2 (en) System and method for dequeue optimization using conditional iteration

Legal Events

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