CN112860419A - Multi-instance task execution method and device, terminal equipment and computer storage medium - Google Patents

Multi-instance task execution method and device, terminal equipment and computer storage medium Download PDF

Info

Publication number
CN112860419A
CN112860419A CN201911182427.7A CN201911182427A CN112860419A CN 112860419 A CN112860419 A CN 112860419A CN 201911182427 A CN201911182427 A CN 201911182427A CN 112860419 A CN112860419 A CN 112860419A
Authority
CN
China
Prior art keywords
instances
instance
batches
batch
task
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201911182427.7A
Other languages
Chinese (zh)
Inventor
余斌
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Alibaba Group Holding Ltd
Original Assignee
Alibaba Group Holding 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 Alibaba Group Holding Ltd filed Critical Alibaba Group Holding Ltd
Priority to CN201911182427.7A priority Critical patent/CN112860419A/en
Publication of CN112860419A publication Critical patent/CN112860419A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • G06F9/5038Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals considering the execution order of a plurality of tasks, e.g. taking priority or time dependency constraints into consideration

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The embodiment of the invention provides a method and a device for executing a multi-instance task, a terminal device and a computer storage medium, wherein the method for executing the multi-instance task comprises the following steps: determining a plurality of instances corresponding to the multi-instance task, and dividing the plurality of instances into at least two batches, wherein each batch comprises at least two instances; executing the multiple instances in batches, and concurrently executing the at least two instances belonging to one batch to execute the multi-instance task. The scheme provided by the embodiment can control the concurrency of the instances by controlling the number of the instances in each batch, and can increase the serial constraint by controlling the execution sequence of each batch, thereby more flexibly controlling the execution of a plurality of instances.

Description

Multi-instance task execution method and device, terminal equipment and computer storage medium
Technical Field
The embodiment of the invention relates to the technical field of data processing, in particular to a method and a device for executing multi-instance tasks, terminal equipment and a computer storage medium.
Background
The workflow engine is widely applied to various business systems, such as an approval system, a countersigning system and the like. In particular, during use, various asynchronous operations may be performed, such as performing business operations approved by multiple persons, performing business operations signed by multiple persons, and so forth.
Generally, the above operations can be implemented by using multi-instance tasks in a workflow engine. Specifically, a multi-instance task may be defined in a workflow, and the workflow engine may be allowed to execute the multi-instance task on a plurality of task objects, thereby generating a plurality of instances corresponding to the multi-instance task, and adding one of a serial constraint and a parallel constraint to the plurality of instances, that is, executing one at a time in an order of the serial constraint until the execution of the plurality of instances is completed, or controlling all the plurality of instances to execute in parallel according to the parallel constraint, where the serial constraint and the parallel constraint cannot exist at the same time.
However, in the execution process, only simple serial constraint or parallel constraint can be performed on multiple instances, and the execution of multiple instances cannot be controlled more flexibly, so that the requirements of users cannot be met.
In view of the above, a technical problem to be solved in the prior art is to provide a new execution method of multi-instance task.
Disclosure of Invention
In view of the above, embodiments of the present invention provide a method, an apparatus, a terminal device, and a computer storage medium for executing a multi-instance task, so as to solve the above problems.
According to a first aspect of the embodiments of the present invention, there is provided a method for executing a multi-instance task, including: determining a plurality of instances corresponding to the multi-instance task, and dividing the plurality of instances into at least two batches, wherein each batch comprises at least two instances; executing the multiple instances in batches, and concurrently executing the at least two instances belonging to one batch to execute the multi-instance task.
According to a second aspect of the embodiments of the present invention, there is provided a multi-instance task execution device, including: the batch dividing module is used for determining a plurality of instances corresponding to the multi-instance task and dividing the plurality of instances into at least two batches, wherein each batch comprises at least two instances; an instance execution module to execute the multiple instances in batches and to concurrently execute the at least two instances belonging to one batch to execute the multi-instance task.
According to a third aspect of the embodiments of the present invention, there is provided a terminal device, including: the system comprises a processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface complete mutual communication through the communication bus; the memory is used for storing at least one executable instruction, and the executable instruction enables the processor to execute the operation corresponding to the execution method of the multi-instance task.
According to a fourth aspect of embodiments of the present invention, there is provided a computer storage medium having stored thereon a computer program which, when executed by a processor, implements the method of executing the multi-instance task as described above.
According to the scheme provided by the embodiment of the invention, a plurality of instances corresponding to the multi-instance task are determined, and the plurality of instances are divided into at least two batches, wherein each batch comprises at least two instances; the multiple instances are executed in batches, the at least two instances belonging to one batch are executed concurrently to execute the multi-instance task, the instances are divided into at least two batches, and the at least two instances in one batch are executed concurrently, so that the concurrent amount of the instances can be controlled by controlling the number of the instances in each batch, parallel constraints are added to the instances by controlling the instances in each batch, and the execution sequence of each batch can be controlled when the multiple instances are executed in batches to add serial constraints to the instances, thereby more flexibly controlling the execution of the multiple instances.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments described in the embodiments of the present invention, and it is also possible for a person skilled in the art to obtain other drawings based on the drawings.
FIG. 1 is a flowchart illustrating steps of a method for executing a multi-instance task according to a first embodiment of the present invention;
FIG. 2a is a flowchart illustrating a method for executing a multi-instance task according to a second embodiment of the present invention;
FIG. 2b is a diagram of elements in a workflow according to a second embodiment of the present invention;
FIG. 2c is a flowchart illustrating a step of dividing batches and executing an example according to a second embodiment of the present invention;
FIG. 3 is a flowchart illustrating steps of a method for executing a multi-instance task according to a third embodiment of the present invention;
FIG. 4 is a block diagram of an apparatus for executing multi-instance tasks according to a fourth embodiment of the present invention;
fig. 5 is a schematic structural diagram of a terminal device according to a fifth embodiment of the present invention.
Detailed Description
In order to make those skilled in the art better understand the technical solutions in the embodiments of the present invention, the technical solutions in the embodiments of the present invention will be described clearly and completely with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all embodiments. All other embodiments obtained by a person skilled in the art based on the embodiments of the present invention shall fall within the scope of the protection of the embodiments of the present invention.
The following further describes specific implementation of the embodiments of the present invention with reference to the drawings.
Example one
Referring to fig. 1, a flowchart illustrating steps of a method for executing a multi-instance task according to a first embodiment of the present invention is shown.
The method for executing the multi-instance task comprises the following steps:
s102, determining a plurality of instances corresponding to the multi-instance task, and dividing the plurality of instances into at least two batches, wherein each batch comprises at least two instances.
The method provided by the embodiment can be applied to any Workflow engine supporting multi-instance tasks, such as ActiveVOS, Activiti, jBPM, Windows Workflow Foundation, and the like.
Specifically, a multi-instance task corresponds to multiple instances. For example, the multi-instance task is to perform operation and maintenance operations on a plurality of clusters or a large number of machines, each cluster or each machine is associated with an instance, and one multi-instance task is associated with a plurality of instances.
After the plurality of instances are determined, the plurality of instances may be divided into at least two batches (batch, and then the plurality of instances are executed according to the batches through the subsequent step S104. in the using process, the execution of the plurality of instances may be flexibly controlled by controlling the number of the divided batches, the number of the instances in each batch, the order of execution of the batches, and the like.
S104, executing the multiple instances in batches, and executing the at least two instances belonging to one batch simultaneously to execute the multi-instance task.
In this embodiment, after the multi-instance task is triggered, a plurality of instances corresponding to the task object of the multi-instance task are executed, so that the multi-instance task is executed. The multi-instance task may be triggered by a user interface, a command line, an event called by an API interface, or may be triggered at regular time, which is not limited in this embodiment.
When multiple instances are executed, the scheme provided by this embodiment is to execute multiple instances in batches, and the specific execution process may be to execute the instances belonging to the same batch each time, and then execute the instances of the next batch after the execution is completed until the execution of the multi-instance task is completed.
In this embodiment, because the instances belonging to the same batch are executed concurrently, the concurrent amount of the instances can be controlled by dividing a plurality of instances into at least two batches and setting the number of the instances in each batch, that is, parallel constraints are added to the instances by dividing the batches; in addition, the execution sequence of each batch can be controlled to control the serial execution sequence of the multiple instances, namely, the serial constraint is added to the instances by controlling the execution sequence of the batches, so that the multiple instances can be controlled more flexibly.
In the scheme provided by the embodiment, a plurality of instances corresponding to the multi-instance task are determined, and the plurality of instances are divided into at least two batches, wherein each batch comprises at least two instances; executing the multiple instances in batches, and concurrently executing the at least two instances belonging to one batch to execute the multi-instance task. By dividing the instances into at least two batches and executing at least two instances in one batch concurrently, the concurrent amount of the instances can be controlled by controlling the number of the instances in each batch, the parallel constraint can be added to the instances by controlling the instances in each batch, and the serial constraint can be added to the instances by controlling the execution sequence of each batch when executing a plurality of instances in batches, so as to more flexibly control the execution of the plurality of instances.
Example two
Referring to fig. 2a, a flowchart illustrating steps of a method for executing a multi-instance task according to a second embodiment of the present invention is shown.
And S202, predefining a multi-instance task.
Specifically, the elements of the multi-instance task may be predefined by setting the elements, for example, defining an activity element, a loopcharateristics element, a multilnstanceboostcharateristics element, and the like shown in fig. 2b, and the method for specifically defining the elements may refer to the prior art, which is not described in detail in this embodiment.
In addition, in this embodiment, the division rule may be defined in advance.
Specifically, a concurrency controller may be disposed in a workflow engine executing the present solution, as shown in fig. 2b, it may be determined that a plurality of instances are divided into at least two batches by the concurrency controller by defining an element BatchGenerator (< < Interface > > BatchGenerator) of the concurrency controller, and a specific division logic of the concurrency controller is defined by defining a stoptomschgenerator Interface, for example, the number of instances in each batch may be defined; how to determine the batch in which the instance is located, etc.
S204, according to the task object of the multi-instance task, determining a plurality of instances corresponding to the multi-instance task, and dividing the plurality of instances into at least two batches.
Specifically, in this embodiment, when determining multiple instances corresponding to the multi-instance task, the specifically determined content may be instance parameters corresponding to the multiple instances. For example, the determined instance parameter instanceCollection may be a List of task lists < List <? Anda table, where the outer list is a parent list and can be used as a task list of a multi-instance task, the inner list is a child list of the parent list, the parent list includes multiple elements, each element is a child list including multiple task instances, the parent list can be used as a task list of the multi-instance task, the child list can be used as a task list of one instance in the multi-instance task, and one child list can also be referred to as a serial group.
Optionally, in this embodiment, when the multiple instances are divided into at least two batches, the instance parameters corresponding to the multiple instances may be traversed to identify the target field in the instance parameters; dividing the plurality of instances into the at least two batches according to the identified target field.
Specifically, traversing the instance parameters corresponding to multiple instances may be traversing the entire List <? > > and identifies List <? And > > so that the plurality of instances are divided into at least two batches according to the identified target field. The target field for partitioning can be set by the user in a user-defined manner, so that the user can control the partitioning process more flexibly, and further control the execution of multiple instances more flexibly.
Specifically, in this embodiment, according to the above steps, a concurrency controller may be disposed in a workflow engine executing the present solution, and when the concurrency controller performs partitioning, multiple instances may be input to a nextbatch interface of the concurrency controller, and the interface may implement a next method similar to an iterator (iterator), so that multiple calls of nextbatch may be implemented, and an instance belonging to one batch returned by the interface may be obtained after each call, if there are i batches of instances, when the interface is called for the ith time, an instance of the ith batch may be returned, and when the interface is called for the (i + 1) th time, the returned content is empty, so that it may be determined that instance partitioning is completed according to the determined returned content.
In addition, in this embodiment, when the instance parameter is traversed by the concurrency controller, the multiple instances are divided for convenience, and a data format of the instance parameter is matched with an input data format of the concurrency controller. The specific data format may be determined by a person skilled in the art through implementation of the concurrency controller, which is not limited in this embodiment.
Further, in this embodiment, the concurrency controller may be implemented by a built-in implementation class of the workflow engine, or by an externally-referenced implementation class. The built-in implementation class of the workflow engine can be determined by the vendor of the workflow engine, and the externally referenced implementation class can be determined by the user himself. The user can define different classes for realizing the concurrency controller according to the requirement of the user, so that the concurrency controller is more flexible to use.
Since at least two instances belonging to one batch are executed concurrently during execution, that is, the concurrency amount during execution of the instances is less than or equal to the number of the instances included in one batch, the maximum number of the instances corresponding to each batch can be set according to the preset concurrency amount of the instances when the batches are divided, so as to control the concurrency amount of the multi-instance task to be less than or equal to the preset concurrency amount. Further, the number of the instances corresponding to at least two batches may be the same, so that the size of the at least two batches obtained by dividing is the same, and when multiple instances are executed according to a batch, the number of the concurrently executed instances corresponding to each batch is the same, so that the concurrence amount of the multi-instance task may be controlled by setting the number of the instances corresponding to the batch.
In addition, when the multiple instances are divided into at least two batches, the division may be specifically performed according to existing constraint conditions between the multiple instances.
If it is determined that at least two instances with parallel constraints are included in the plurality of instances, the at least two instances with parallel constraints may be divided into one batch.
If it is determined that the plurality of instances include at least two instances with the serial constraint, the at least two instances with the serial constraint may be divided into different batches, and the precedence order of the different batches corresponds to the execution order of the at least two instances with the serial constraint. When the multiple instances are executed according to batches, the instances corresponding to the batches can be sequentially executed directly according to the sequence of at least two batches so as to meet the serial constraint condition.
For example, if a plurality of instances are determined to have a serialization constraint between instance a and instance B, the specific serialization constraint is that instance a is executed before instance B. Then, when the dividing is performed, the instance a and the instance B may be divided into different batches, and the batch in which the instance a is located is before the batch in which the instance B is located, that is, the precedence order of the different batches corresponds to the execution order of at least two instances with serial constraints.
S206, executing the multiple instances in batches, and executing the at least two instances belonging to one batch simultaneously to execute the multi-instance task.
In this embodiment, the division of all the batches may be completed first, and then a plurality of instances are executed in batches to execute the multi-instance task; the multiple instance task may also be executed by completing the division of a certain batch, then executing the instance corresponding to the certain batch, and then dividing the next batch, which is not limited in this embodiment.
Specifically, in this embodiment, as shown in fig. 2c, a specific implementation step of dividing the batch in step S204 and executing the instance in step S206 is exemplarily shown, and specifically includes:
and S2061, initializing a parallel controller.
In this embodiment, the process of initializing the concurrency controller may include a process of inputting instance parameters to the concurrency controller.
S2062, by calling the nextbatch interface of the concurrency controller, the nth batch instance returned by the interface is obtained.
S2063, judging whether the example of the nth batch is empty or not.
If not, executing step S2064, and if not, determining that the multiple instances are executed and ending the execution of the multiple instances task.
S2064, at least two examples belonging to the nth batch are executed in parallel.
After the execution of the nth batch instance is completed, the process returns to step S2062, and the nextbatch interface of the concurrency controller is called again to obtain the (n + 1) th batch instance returned by the interface.
Optionally, in this embodiment, the method may further include:
s208, displaying the execution progress of the multiple instances according to the batch so as to display the execution progress of the multi-instance task.
In this embodiment, the user may view the execution state of the workflow through the interactive interface. Specifically, when the multi-instance task is executed, the execution progress of the multiple instances may be shown in batches to show the execution progress of the multi-instance task.
Specifically, it can be shown that: which lot has been executed, which instances in the executed lot have, which lot is executing, which lot is the executing lot, the execution state of the instances corresponding to this lot, which lot has not been executed, etc.
According to the scheme provided by the embodiment, the concurrency of a plurality of instances is controlled by controlling the number of the instances corresponding to at least two batches to be equal, the instances with the serial constraint conditions are divided into different batches, and the sequence of the different batches is ensured to correspond to the execution sequence of the instances corresponding to the serial constraint conditions, so that the serial constraint conditions can be met by controlling the execution sequence of the batches.
EXAMPLE III
Referring to fig. 3, a flowchart illustrating steps of a method for executing a multi-instance task according to a third embodiment of the present invention is shown.
The method for executing the multi-instance task comprises the following steps:
s302, a workflow is defined by a user, and the workflow comprises at least one multi-instance task.
In this embodiment, a workflow refers to a series of mutually connected business activities or tasks that are automatically executed in a computer application environment.
In this embodiment, a user may define a workflow in various ways, for example, the workflow may be defined by using the BPMN standard, may be defined by using a custom XML/JSON, may be defined by using a state diagram or a programming language, and the like.
Taking the example of defining workflows using the BPMN standard, a workflow may be represented as a flow (process), and an event (event), activity (activity), gateway (gateway), sequence flow (sequence flow), and other elements may be included in a flow. Wherein an event (event) is used to characterize an event that occurs in a lifecycle of a workflow.
Activity refers to a task performed in the lifecycle of a workflow. Activities (Activity) in a workflow can be divided into tasks (Task) and Sub-processes (Sub-Process). Task (Task) is a critical atomic level Activity in a Process (Process) and is used to refer to an Activity (Activity) that is performed by a person or computing device. A Sub-Process refers to a Sub-Process nested within a parent Process.
In this embodiment, a multi-instance task (multi-instance activity) in a workflow refers to a task or a sub-process that can be repeatedly executed according to input, the number of times of repetition may be determined by an input dynamic parameter, the dynamic parameter may specifically be the number of input data, and the like, and a task executed each time may correspond to one instance, so that the multi-instance task corresponds to multiple instances.
In this embodiment, when defining the multi-instance task, a rule or the like for dividing a plurality of instances corresponding to the multi-instance task into batches may be defined at the same time.
S304, the user triggers the execution of the workflow.
In this embodiment, the user may perform triggering through the interactive interface, perform triggering through the command line, perform triggering through calling the API interface, and the like, and may also set timing triggering.
It should be noted that the user defining the workflow and the user triggering the execution of the workflow may not be the same user.
For example, the user a may define a workflow for performing operation and maintenance operations on a plurality of clusters, and the number of clusters may be defined as a variable. After the workflow definition is completed, the operation and maintenance personnel B inputs the specific cluster number and triggers the execution of the workflow so as to operate and maintain a plurality of clusters through the workflow.
Of course, the parameters required for workflow operation may not only be the number of clusters, but also include other parameters, which may be input by the operation and maintenance person B.
S306, the workflow engine starts to run the workflow from the starting point of the workflow.
In this embodiment, the workflow engine may execute the multi-instance task in the workflow by the method in the second embodiment, and the operation process of other parts of the workflow may refer to the prior art, which is not described herein again.
And S308, checking the operation state and the execution result of the workflow.
In this embodiment, the user may view the execution state of the workflow through the interactive interface. Specifically, when the multi-instance task is executed, the execution progress of the multiple instances may be shown in batches to show the execution progress of the multi-instance task.
In the scheme provided by the embodiment, a plurality of instances corresponding to the multi-instance task are determined, and the plurality of instances are divided into at least two batches, wherein each batch comprises at least two instances; executing the multiple instances in batches, and concurrently executing the at least two instances belonging to one batch to execute the multi-instance task. By dividing the instances into at least two batches and executing at least two instances in one batch concurrently, the concurrent amount of the instances can be controlled by controlling the number of the instances in each batch, parallel constraints can be added to the instances by controlling the instances in each batch, and the execution sequence of each batch can be controlled when executing a plurality of instances in batches, so that serial constraints can be added to the instances to control the execution of the plurality of instances more flexibly.
The method for executing the multi-instance task in the embodiment of the present application may be executed by any suitable terminal device with data processing capability, including but not limited to: servers, computing engines, mobile terminals (e.g., tablet computers, mobile phones, etc.) and PCs; or can be executed by a plurality of terminal devices in cooperation.
Example four
Referring to fig. 4, a block diagram of an apparatus for executing a multi-instance task according to a fourth embodiment of the present invention is shown.
As shown in FIG. 4, the executing device of the multi-instance task includes a batch dividing module 402 and an instance executing module 404.
A batch dividing module 402, configured to determine multiple instances corresponding to the multi-instance task, and divide the multiple instances into at least two batches, where each batch includes at least two instances; an instance execution module 404, configured to execute the multiple instances in batches, and concurrently execute the at least two instances belonging to one batch to execute the multi-instance task.
In an alternative embodiment, the batch dividing module comprises: the serial batch dividing module is used for dividing at least two examples with serial constraint conditions into different batches, and the sequence of the different batches corresponds to the execution sequence of the at least two examples with serial constraint; the instance execution module includes: and the sequence execution module is used for sequentially executing the corresponding examples of the batches according to the sequence of the at least two batches so as to meet the serial constraint condition.
In an alternative embodiment, the batch dividing module comprises: the target field identification module is used for traversing the instance parameters corresponding to the multiple instances to identify a target field in the instance parameters; and the target field dividing module is used for dividing the plurality of instances into the at least two batches according to the identified target field.
In an optional implementation manner, the target field identification module traverses the instance parameter through the concurrency controller, and correspondingly, the data format of the instance parameter matches with the input data format of the concurrency controller.
In an alternative embodiment, the concurrency controller is implemented by a built-in implementation class of the workflow engine, or by an externally referenced implementation class.
In an alternative embodiment, the apparatus further comprises: and the concurrency setting module is used for setting the maximum number of the instances corresponding to each batch according to the preset concurrency amount of the instances.
In the execution scheme of the multi-instance task provided by the embodiment, a plurality of instances corresponding to the multi-instance task are determined, and the plurality of instances are divided into at least two batches, wherein each batch comprises at least two instances; executing the multiple instances in batches, and concurrently executing the at least two instances belonging to one batch to execute the multi-instance task. By dividing the instances into at least two batches and executing at least two instances in one batch concurrently, the concurrent amount of the instances can be controlled by controlling the number of the instances in each batch, the parallel constraint can be added to the instances by controlling the instances in each batch, and the serial constraint can be added to the instances by controlling the execution sequence of each batch when executing a plurality of instances in batches, so as to more flexibly control the execution of the plurality of instances.
EXAMPLE five
A terminal device, comprising: the system comprises a processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface complete mutual communication through the communication bus; the memory is used for storing at least one executable instruction, and the executable instruction enables the processor to execute the operation corresponding to the execution method of the multi-instance task.
Specifically, referring to fig. 5, a schematic structural diagram of a terminal device according to a fifth embodiment of the present invention is shown, and the specific embodiment of the present invention does not limit the specific implementation of the terminal device.
As shown in fig. 5, the terminal device may include: a processor (processor)502, a Communications Interface 504, a memory 506, and a communication bus 508.
Wherein:
the processor 502, communication interface 504, and memory 506 communicate with one another via a communication bus 508.
A communication interface 504 for communicating with other terminal devices or servers.
The processor 502 is configured to execute the program 510, and may specifically execute relevant steps in the above-described multi-instance task execution method embodiment.
In particular, program 510 may include program code that includes computer operating instructions.
The processor 502 may be a central processing unit CPU, or an Application Specific Integrated Circuit (ASIC), or one or more Integrated circuits configured to implement an embodiment of the present invention; the processor may also be a Programmable Gate Array (FPGA), a graphics processor GPU, an embedded neural network processor NPU, or the like. The terminal device comprises one or more processors, which can be the same type of processor, such as one or more CPUs; or may be different types of processors such as one or more CPUs and one or more ASICs.
And a memory 506 for storing a program 510. The memory 506 may comprise high-speed RAM memory, and may also include non-volatile memory (non-volatile memory), such as at least one disk memory.
The program 510 may specifically be used to cause the processor 502 to perform the following operations: determining a plurality of instances corresponding to the multi-instance task, and dividing the plurality of instances into at least two batches, wherein each batch comprises at least two instances; executing the multiple instances in batches, and concurrently executing the at least two instances belonging to one batch to execute the multi-instance task.
In an optional embodiment, the dividing the plurality of instances into at least two batches comprises: dividing at least two examples with serial constraint conditions into different batches, wherein the sequence of the different batches corresponds to the execution sequence of the at least two examples with serial constraint; the executing the plurality of instances in batches includes: and executing the corresponding examples of the batches in sequence according to the sequence of at least two batches so as to meet the serial constraint condition.
In an optional embodiment, the dividing the plurality of instances into at least two batches comprises: traversing instance parameters corresponding to the multiple instances to identify a target field in the instance parameters; dividing the plurality of instances into the at least two batches according to the identified target field.
In an alternative embodiment, the instance parameter is traversed by the concurrency controller, and correspondingly, the data format of the instance parameter is matched with the input data format of the concurrency controller.
In an alternative embodiment, the concurrency controller is implemented by a built-in implementation class of the workflow engine, or by an externally referenced implementation class.
In an optional embodiment, the method further comprises: and setting the maximum number of the examples corresponding to each batch according to the preset concurrency of the examples.
In an alternative embodiment, the number of instances corresponding to at least two batches is the same.
In an optional embodiment, the method further comprises: and displaying the execution progress of the multiple instances according to batches so as to display the execution progress of the multi-instance task.
For specific implementation of each step in the program 510, reference may be made to corresponding steps and corresponding descriptions in units in the foregoing multi-instance task execution method embodiment, which are not described herein again. It can be clearly understood by those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described devices and modules may refer to the corresponding process descriptions in the foregoing method embodiments, and are not described herein again.
The terminal device of the embodiment determines a plurality of instances corresponding to the multi-instance task, and divides the plurality of instances into at least two batches, wherein each batch comprises at least two instances; the multiple instances are executed in batches, the at least two instances belonging to one batch are executed concurrently to execute the multi-instance task, the instances are divided into at least two batches, and the at least two instances in one batch are executed concurrently, so that the concurrent amount of the instances can be controlled by controlling the number of the instances in each batch, parallel constraints are added to the instances by controlling the instances in each batch, and the execution sequence of each batch can be controlled when the multiple instances are executed in batches to add serial constraints to the instances, thereby more flexibly controlling the execution of the multiple instances.
It should be noted that, according to the implementation requirement, each component/step described in the embodiment of the present invention may be divided into more components/steps, and two or more components/steps or partial operations of the components/steps may also be combined into a new component/step to achieve the purpose of the embodiment of the present invention.
The above-described method according to an embodiment of the present invention may be implemented in hardware, firmware, or as software or computer code storable in a recording medium such as a CD ROM, a RAM, a floppy disk, a hard disk, or a magneto-optical disk, or as computer code originally stored in a remote recording medium or a non-transitory machine-readable medium downloaded through a network and to be stored in a local recording medium, so that the method described herein may be stored in such software processing on a recording medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware such as an ASIC or FPGA. It will be appreciated that the computer, processor, microprocessor controller or programmable hardware includes memory components (e.g., RAM, ROM, flash memory, etc.) that can store or receive software or computer code that, when accessed and executed by the computer, processor or hardware, implements the method of execution of the multi-instance tasks described herein. Further, when a general-purpose computer accesses code for implementing the execution methods of the multi-instance tasks shown herein, execution of the code transforms the general-purpose computer into a special-purpose computer for performing the execution methods of the multi-instance tasks shown herein.
Those of ordinary skill in the art will appreciate that the various illustrative elements and method steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present embodiments.
The above embodiments are only for illustrating the embodiments of the present invention and not for limiting the embodiments of the present invention, and those skilled in the art can make various changes and modifications without departing from the spirit and scope of the embodiments of the present invention, so that all equivalent technical solutions also belong to the scope of the embodiments of the present invention, and the scope of patent protection of the embodiments of the present invention should be defined by the claims.

Claims (16)

1. A method for executing a multi-instance task, comprising:
determining a plurality of instances corresponding to the multi-instance task, and dividing the plurality of instances into at least two batches, wherein each batch comprises at least two instances;
executing the multiple instances in batches, and concurrently executing the at least two instances belonging to one batch to execute the multi-instance task.
2. The method of claim 1, wherein the dividing the plurality of instances into at least two batches comprises:
dividing at least two examples with serial constraint conditions into different batches, wherein the sequence of the different batches corresponds to the execution sequence of the at least two examples with serial constraint;
the executing the plurality of instances in batches includes:
and executing the corresponding examples of the batches in sequence according to the sequence of at least two batches so as to meet the serial constraint condition.
3. The method of claim 1, wherein the dividing the plurality of instances into at least two batches comprises:
traversing instance parameters corresponding to the multiple instances to identify a target field in the instance parameters;
dividing the plurality of instances into the at least two batches according to the identified target field.
4. The method of claim 3, wherein the instance parameter is traversed by a concurrency controller, and correspondingly, a data format of the instance parameter matches an input data format of the concurrency controller.
5. The method of claim 4, wherein the concurrency controller is implemented by a built-in implementation class of the workflow engine or by an externally referenced implementation class.
6. The method of any one of claims 1-5, further comprising: and setting the maximum number of the examples corresponding to each batch according to the preset concurrency of the examples.
7. The method according to any of claims 1-5, wherein the number of said instances for at least two batches is the same.
8. The method of any one of claims 1-5, further comprising: and displaying the execution progress of the multiple instances according to batches so as to display the execution progress of the multi-instance task.
9. An apparatus for executing a multi-instance task, comprising:
the batch dividing module is used for determining a plurality of instances corresponding to the multi-instance task and dividing the plurality of instances into at least two batches, wherein each batch comprises at least two instances;
an instance execution module to execute the multiple instances in batches and to concurrently execute the at least two instances belonging to one batch to execute the multi-instance task.
10. The apparatus of claim 9, wherein the batch partitioning module comprises:
the serial batch dividing module is used for dividing at least two examples with serial constraint conditions into different batches, and the sequence of the different batches corresponds to the execution sequence of the at least two examples with serial constraint;
the instance execution module includes: and the sequence execution module is used for sequentially executing the corresponding examples of the batches according to the sequence of the at least two batches so as to meet the serial constraint condition.
11. The apparatus of claim 9, wherein the batch partitioning module comprises:
the target field identification module is used for traversing the instance parameters corresponding to the multiple instances to identify a target field in the instance parameters;
and the target field dividing module is used for dividing the plurality of instances into the at least two batches according to the identified target field.
12. The apparatus of claim 11, wherein the target field identification module traverses the instance parameter through a concurrency controller, and wherein a data format of the instance parameter matches an input data format of the concurrency controller.
13. The apparatus of claim 12, wherein the concurrency controller is implemented by a built-in implementation class of the workflow engine or by an externally referenced implementation class.
14. The apparatus of any one of claims 9-13, further comprising: and the concurrency setting module is used for setting the maximum number of the instances corresponding to each batch according to the preset concurrency amount of the instances.
15. A terminal device, comprising: the system comprises a processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface complete mutual communication through the communication bus;
the memory is configured to store at least one executable instruction that causes the processor to perform operations corresponding to the method of performing a multi-instance task as recited in any of claims 1-8.
16. A computer storage medium having stored thereon a computer program which, when executed by a processor, carries out a method of multi-instance task execution as claimed in any one of claims 1 to 8.
CN201911182427.7A 2019-11-27 2019-11-27 Multi-instance task execution method and device, terminal equipment and computer storage medium Pending CN112860419A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911182427.7A CN112860419A (en) 2019-11-27 2019-11-27 Multi-instance task execution method and device, terminal equipment and computer storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911182427.7A CN112860419A (en) 2019-11-27 2019-11-27 Multi-instance task execution method and device, terminal equipment and computer storage medium

Publications (1)

Publication Number Publication Date
CN112860419A true CN112860419A (en) 2021-05-28

Family

ID=75985637

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911182427.7A Pending CN112860419A (en) 2019-11-27 2019-11-27 Multi-instance task execution method and device, terminal equipment and computer storage medium

Country Status (1)

Country Link
CN (1) CN112860419A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113485606A (en) * 2021-06-28 2021-10-08 北京金堤征信服务有限公司 Method and device for realizing multi-list joint rolling

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090281777A1 (en) * 2007-12-21 2009-11-12 Stefan Baeuerle Workflow Modeling With Flexible Blocks
US20130007753A1 (en) * 2011-06-28 2013-01-03 Microsoft Corporation Elastic scaling for cloud-hosted batch applications
CN107862425A (en) * 2017-08-29 2018-03-30 平安普惠企业管理有限公司 Air control collecting method, equipment, system and readable storage medium storing program for executing
CN108628675A (en) * 2018-05-14 2018-10-09 五八有限公司 A kind of data processing method, device, equipment and computer readable storage medium

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090281777A1 (en) * 2007-12-21 2009-11-12 Stefan Baeuerle Workflow Modeling With Flexible Blocks
US20130007753A1 (en) * 2011-06-28 2013-01-03 Microsoft Corporation Elastic scaling for cloud-hosted batch applications
CN107862425A (en) * 2017-08-29 2018-03-30 平安普惠企业管理有限公司 Air control collecting method, equipment, system and readable storage medium storing program for executing
CN108628675A (en) * 2018-05-14 2018-10-09 五八有限公司 A kind of data processing method, device, equipment and computer readable storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
吴泓辰;李国菁;: "业务过程成批处理配置优化方法", 计算机集成制造***, no. 04, 15 April 2019 (2019-04-15) *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113485606A (en) * 2021-06-28 2021-10-08 北京金堤征信服务有限公司 Method and device for realizing multi-list joint rolling

Similar Documents

Publication Publication Date Title
CN109901881B (en) Plug-in loading method and device of application program, computer equipment and storage medium
CN108449313B (en) Electronic device, Internet service system risk early warning method and storage medium
CN112035110B (en) Parameter adjusting method, device, client and storage medium
CN110162344B (en) Isolation current limiting method and device, computer equipment and readable storage medium
CN111782304A (en) Logic control method and device for paging loading data, computer equipment and medium
CN113110867A (en) RPA robot management method, device, server and storage medium
CN113094125B (en) Business process processing method, device, server and storage medium
CN112860419A (en) Multi-instance task execution method and device, terminal equipment and computer storage medium
CN111294377A (en) Network request sending method of dependency relationship, terminal device and storage medium
CN112799768A (en) Method and device for realizing horse race lamp and electronic equipment
CN113434221B (en) Software automation operation method, device, system and server equipment
CN115269431A (en) Interface testing method and device, electronic equipment and storage medium
CN115344370A (en) Task scheduling method, device, equipment and storage medium
CN113012258B (en) Method, device, electronic equipment and readable medium for generating multi-section line graph
CN114037496A (en) State machine-based order state management method, device, equipment and medium
CN114816184A (en) Display method, device, equipment and storage medium of operation control
CN110704203B (en) Interruptible remote procedure calling method and interruptible remote procedure calling device
CN112905270A (en) Workflow implementation method, device, platform, electronic equipment and storage medium
CN109150993B (en) Method for obtaining network request tangent plane, terminal device and storage medium
CN112799791A (en) Method and device for calling distributed lock, electronic equipment and storage medium
CN113535187B (en) Service online method, service updating method and service providing method
CN116089267A (en) Test interface generation method, device, equipment and storage medium
CN115174557B (en) Log downloading scheduling method, device and medium
CN115222041B (en) Graph generation method and device for model training, electronic equipment and storage medium
CN112527526A (en) Information processing method and device and computer equipment

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