CN114625515A - Task management method, device, equipment and storage medium - Google Patents

Task management method, device, equipment and storage medium Download PDF

Info

Publication number
CN114625515A
CN114625515A CN202210334877.9A CN202210334877A CN114625515A CN 114625515 A CN114625515 A CN 114625515A CN 202210334877 A CN202210334877 A CN 202210334877A CN 114625515 A CN114625515 A CN 114625515A
Authority
CN
China
Prior art keywords
task
subtask
target
executed
subtasks
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
CN202210334877.9A
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.)
Suzhou Inspur Intelligent Technology Co Ltd
Original Assignee
Suzhou Inspur Intelligent Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Suzhou Inspur Intelligent Technology Co Ltd filed Critical Suzhou Inspur Intelligent Technology Co Ltd
Priority to CN202210334877.9A priority Critical patent/CN114625515A/en
Publication of CN114625515A publication Critical patent/CN114625515A/en
Priority to PCT/CN2022/141660 priority patent/WO2023185137A1/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/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4812Task transfer initiation or dispatching by interrupt, e.g. masked
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • G06F9/485Task life-cycle, e.g. stopping, restarting, resuming execution
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/50Indexing scheme relating to G06F9/50
    • G06F2209/5017Task decomposition

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The application discloses a task management method, a device, equipment and a storage medium, and relates to the field of task management. The method comprises the following steps: dividing a target execution task to obtain a corresponding number of subtasks, and creating a corresponding parameter object for saving task execution progress for the target execution task; starting a task process to execute the subtasks, and updating the parameter object according to the currently executed subtasks; and if the task process is interrupted, reading the parameter object to determine a target subtask which is being executed when the process is interrupted, and re-executing the target subtask to recover the task process. The problem of long-time task interruption running on kubernets is solved, recovery after the long-time task interruption can be achieved, repeated actions in the task are reduced by dividing the task into a plurality of subtasks for execution, a large amount of time consumed by re-executing the task is saved, and task execution efficiency is improved.

Description

Task management method, device, equipment and storage medium
Technical Field
The present invention relates to the field of task management, and in particular, to a method, an apparatus, a device, and a storage medium for task management.
Background
At present, with the rapid development of kubernets, kubernets are applied more and more in reality. The pod as the minimum management unit of kubernets is composed of a group of containers, when the pod is rebuilt, the group of containers is rebuilt completely, and the process in the corresponding container is turned on again after being turned off, however, a great characteristic of the pod is that the pod can be rebuilt at any time, thereby causing the service running on the pod to be interrupted at any time. Therefore, if an application runs on kubernets in a pod mode, one problem that must be considered is whether the service of the pod is interrupted and whether garbage data is caused if the pod is suddenly rebuilt, and especially in the case of long-time tasks, the execution efficiency of the long-time tasks is reduced. Therefore, how to solve the task management of the task running on the kubernets in the pod mode is a problem which needs to be solved urgently at present.
Disclosure of Invention
In view of the above, an object of the present invention is to provide a method, an apparatus, a device and a medium for task management, which can improve task execution efficiency. The specific scheme is as follows:
in a first aspect, the present application discloses a task management method, including:
dividing a target execution task to obtain a corresponding number of subtasks, and creating a corresponding parameter object for saving a task execution progress for the target execution task;
starting a task process to execute the subtasks, and updating the parameter object according to the currently executed subtasks;
and if the task process is interrupted, reading the parameter object to determine a target subtask which is executed when the process is interrupted, and re-executing the target subtask to recover the task process.
Optionally, after the dividing the target execution task to obtain the corresponding number of subtasks, the method further includes:
and defining each subtask according to the task base class and by referring to the filter annotation, wherein each subtask corresponds to a parameter value after definition.
Optionally, the starting a task process to execute the subtask includes:
starting a task process through a controller of a task manager and reading initial parameters from the parameter object;
filtering the subtasks corresponding to the initial parameters from all the subtasks by using a filter according to the parameter value corresponding to each subtask to serve as a first subtask to be executed, and executing the first subtask to be executed;
and after the first subtask to be executed is executed, filtering out the corresponding subtask from all the subtasks and executing the subtask by using the filter through the controller according to the current parameter value of the parameter object until all the subtasks of the target execution task are executed.
Optionally, the updating the parameter object according to the currently executed subtask includes:
updating the parameter object according to the parameter value corresponding to the currently executed subtask;
correspondingly, the reading the parameter object to determine the target subtask being executed when the process is interrupted includes:
obtaining a target parameter value currently stored by the parameter object by reading the parameter object;
and filtering the subtasks corresponding to the target parameter values from all the subtasks by using a filter according to the parameter values corresponding to each subtask to serve as the target subtask being executed when the process is interrupted.
Optionally, the creating a corresponding parameter object for saving the task execution progress for the target execution task includes:
and creating a parameter object for storing a task identifier, a task name and a task parameter in the task execution process for the target execution task, and storing the parameter object to a storage space in a persistent storage mode.
Optionally, the reading the parameter object to determine the target subtask being executed when the process is interrupted includes:
according to the task identification of the target execution task, determining the parameter object corresponding to the target execution task from the storage space;
and reading the parameter object to determine the target subtask which is executed when the process is interrupted.
Optionally, the dividing the target execution task to obtain a corresponding number of subtasks includes:
and dividing the target execution task according to task idempotency to obtain a corresponding number of subtasks with idempotency.
In a second aspect, the present application discloses a task management device, including:
the segmentation module is used for segmenting the target execution task to obtain a corresponding number of subtasks and creating a corresponding parameter object for storing the task execution progress for the target execution task;
the parameter object updating module is used for starting a task process to execute the subtask and updating the parameter object according to the currently executed subtask;
and the process recovery module is used for reading the parameter object to determine a target subtask which is executed when the process is interrupted if the task process is interrupted, and re-executing the target subtask to recover the task process.
In a third aspect, the present application discloses an electronic device, comprising:
a memory for storing a computer program;
and the processor is used for executing the computer program to realize the task management method.
In a fourth aspect, the present application discloses a computer readable storage medium for storing a computer program; wherein the computer program realizes the aforementioned task management method when executed by a processor.
In the application, a corresponding number of subtasks are obtained by dividing a target execution task, and a corresponding parameter object for saving the task execution progress is created for the target execution task; starting a task process to execute the subtasks, and updating the parameter object according to the currently executed subtasks; and if the task process is interrupted, reading the parameter object to determine a target subtask which is being executed when the process is interrupted, and re-executing the target subtask to recover the task process. Therefore, the target execution task is divided into a plurality of subtasks, the parameter object used for saving the task execution progress is created for the target execution task, the target subtask executed during interruption is determined by inquiring the parameter object after the task is interrupted, and the target task is re-executed from the target subtask, so that the problem of interruption of the long-time task running on kubernets is solved, the recovery after the interruption of the long-time task can be realized, the repeated action in the task is reduced by dividing the task into a plurality of subtasks for execution, a large amount of time consumed by re-executing the task is saved, and the task execution efficiency is improved.
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 embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the provided drawings without creative efforts.
FIG. 1 is a flowchart of a task management method provided herein;
FIG. 2 is a diagram illustrating a specific subtask definition structure provided in the present application;
FIG. 3 is a flowchart illustrating a specific task execution process provided herein;
FIG. 4 is a flowchart illustrating a specific task recovery process provided herein;
FIG. 5 is a schematic structural diagram of a task management device according to the present application;
fig. 6 is a block diagram of an electronic device provided in the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below 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 of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
In the prior art, if an application runs on kubernets in a pod mode, the problems that if a pod is suddenly rebuilt, the service is interrupted, and junk data is caused need to be solved. In order to overcome the technical problem, the application provides a long-time task management method under the kubernets scene, and the task execution efficiency can be improved.
The embodiment of the application discloses a task management method, and as shown in fig. 1, the method may include the following steps:
step S11: and dividing the target execution task to obtain a corresponding number of subtasks, and creating a corresponding parameter object for saving the task execution progress for the target execution task.
In this embodiment, after the target execution task is obtained, the target execution task is first divided to obtain a corresponding number of subtasks, and a corresponding parameter object for saving a task execution progress is created for the target execution task. In this embodiment, the dividing the target execution task to obtain the corresponding number of subtasks may include: and dividing the target execution task according to task idempotency to obtain a corresponding number of subtasks with idempotency. The idempotent task, namely, whether a task is successfully executed once or for multiple times, the same result can be obtained, and the task is the idempotent task; therefore, in order to ensure that a correct result can be obtained no matter how many times the task is interrupted or where the task is interrupted, the target execution task is divided according to task idempotency so as to ensure the accuracy of the task result generated by re-executing the subtasks after the interruption occurs subsequently.
In this embodiment, after the dividing the target execution task to obtain the corresponding number of subtasks, the method may further include: and defining each subtask according to the task base class and by referring to the filter annotation, wherein each subtask corresponds to a parameter value after definition. For example, as shown in fig. 2, by providing a task base class and forming a filter by an annotation and annotation processor, a user implements a task class by himself/herself according to the task base class and referring to the filter annotation, the task class inherits from the task base class, each task class at least includes a set of initial parameters and a series of subtask methods, and each subtask is defined by using the filter annotation. That is to say, the function method for referring to the filter annotation is regarded as a subtask, when referring to the filter, the parameter condition to be satisfied for executing the subtask needs to be declared, and the subsequent subtask updates the parameter object according to the parameter value to ensure that the required parameters can be obtained from the parameter object.
Step S12: and starting a task process to execute the subtasks, and updating the parameter object according to the currently executed subtasks.
In this embodiment, after the task process corresponding to the target execution task is started, the sub-tasks of the target execution task are sequentially executed, and the parameter object corresponding to the target execution task is updated at least once every time one sub-task is executed.
In this embodiment, the starting the task process to execute the subtask may include: starting a task process through a controller of a task manager and reading initial parameters from the parameter object; filtering the subtasks corresponding to the initial parameters from all the subtasks by using a filter according to the parameter value corresponding to each subtask to serve as a first subtask to be executed, and executing the first subtask to be executed; and after the first subtask to be executed is executed, filtering out the corresponding subtask from all the subtasks and executing the subtask by using the filter through the controller according to the current parameter value of the parameter object until all the subtasks of the target execution task are executed. It can be understood that the parameter value corresponding to the subtask is related to the execution flow of the target execution task before the task is divided, an initial value is stored in the parameter object initially, the subtask corresponding to the initial value is the initial subtask of the target execution task, and subsequently, by continuously updating the object parameter, the next subtask to be executed can be determined according to the sequence of the parameter value until all subtasks are executed.
In this embodiment, the updating the parameter object according to the currently executed subtask may include: and updating the parameter object according to the parameter value corresponding to the currently executed subtask. It can be understood that the updating of the parameter object depends on the implementation of each specific subtask, and generally, in each subtask, there is at least one operation of updating the parameter object, and by reading the parameter object, it is necessary to accurately determine the executed subtasks and the unexecuted subtasks; and the parameter object can also be used for saving a mark in the task execution process so as to judge that the executed subtasks are successfully executed and the subtasks which need to be re-executed are not successfully executed in the executed subtasks.
In this embodiment, the creating a corresponding parameter object for saving a task execution progress for the target execution task may include: and creating a parameter object for storing a task Identification (ID), a task name and task participation in the task execution process (namely, updated parameter values of the currently executed subtasks) for the target execution task, and storing the parameter object to a storage space in a persistent storage mode. Namely, the parameter object is used for saving the required participation of the task and recording the progress of the task. Namely, the parameter object can be used to record task ID, task class name corresponding to the task, task entry, mark in the task execution process, etc. so as to determine the execution condition of the subtask according to the task entry. In order to ensure that the task can be correctly recovered by acquiring the entries that the parameter object should have when the task is executed again, the entries cannot only exist in the memory, and need to be stored in a persistent manner, such as a database and a file, to ensure that the task can be normally acquired after the task process is interrupted. Specifically, in this embodiment, the parameter object may be stored in a configmap format, and the format may be an easily-parsed json format; the configmap is a resource in the kubernets platform, and is used for recording a set of text information, and the text may be in any format.
Step S13: and if the task process is interrupted, reading the parameter object to determine a target subtask which is being executed when the process is interrupted, and re-executing the target subtask to recover the task process.
In this embodiment, after the task process is interrupted, the parameter object corresponding to the target execution task is read to determine the target subtask that is being executed when the process is interrupted, and the target subtask is re-executed to recover the task process. Therefore, in the embodiment, the task which needs to be executed for a long time is divided into the subtasks, the target execution task correspondingly maintains one parameter object, in the execution process of the subtasks, the content in the parameter object is updated as required, and after the task is interrupted, the parameter object can be read to judge the progress which is executed last time, and accordingly, which subtasks need to be executed next time is judged. The method is suitable for complex tasks with various steps and long time consumption, and has good universality.
In this embodiment, the reading the parameter object to determine the target subtask being executed when the process is interrupted may include: obtaining a target parameter value currently stored by the parameter object by reading the parameter object; and filtering the subtasks corresponding to the target parameter values from all the subtasks by using a filter according to the parameter values corresponding to each subtask to serve as the target subtask being executed when the process is interrupted. It can be understood that, the filter uses the parameter value obtained from the parameter object as the trigger condition of the subtask, when the filter is quoted, the parameter value is provided to identify which conditions are met and the subtask needs to be triggered, and when the filter can not be matched with any subtask, the target execution task is considered to be executed completely, and the corresponding parameter object can be deleted and the task process can be exited.
In this embodiment, the reading the parameter object to determine the target subtask being executed when the process is interrupted may include: according to the task identification of the target execution task, determining the parameter object corresponding to the target execution task from the storage space; and reading the parameter object to determine the target subtask which is executed when the process is interrupted. It can be understood that, because a plurality of task processes may exist in the system at the same time, that is, a plurality of parameter objects exist, it is necessary to determine the parameter object corresponding to the task after the task is interrupted, and the parameter object is distinguished by the task identifier in this embodiment.
The workflow of this embodiment is described below by way of example, and as shown in fig. 3, the flow of creating a long-time task by a business process using this embodiment is as follows:
1. the business process creates an example of the task class A according to the task base class and the reference filter annotation;
2. the business process calls a controller of the task manager and transmits the task instance A to the past;
3. the controller creates a task process A and generates a task ID;
4. the controller calls k8s-client (client object which connects kubernets and operates its resources), creates parameter object configmap-a, and writes the initial parameter of the task instance into the configmap-a, where the initial parameter a is 1, and in addition, records the task ID and the corresponding task class name;
5. the controller filters out matched subtasks by combining with a filter according to the initial parameter a being 1, the matched subtask is action1 in the example, and the controller calls execution action 1;
6. action1 executes normally and calls k8s-client updates parameter value a 2;
7. action1 execution ends, returns to the controller normally;
8. when the current parameter value a is 2, the controller judges according to the current parameter value a and the filter, and then the next subtask action2 needs to be executed, and the controller calls action 2;
9. action2 executes normally, and calls k8s-client updates parameter value a to 3;
10. action2 execution ends, returns to the controller normally;
11. when the current parameter a is 3, in combination with the filter, the controller finds that no subtask matches this condition, and the controller considers that task a has been executed, and calls k8s-client to delete the parameter object configmap-a.
For example, as shown in fig. 4, based on fig. 3, if it is assumed that action2 is interrupted abnormally due to sudden downtime while action2 is executed, at this time, the parameter has not been updated, a is 2, and the flow of resuming the task after the task process is interrupted abnormally is as follows:
1. when the controller is started, firstly calling k8s-client to traverse the parameter object, finding a configmap-A, and reading a task ID, a corresponding task class name and a parameter value;
2. finding out a corresponding task class according to the task class name, and creating an example of the class;
3. starting a task process;
4. screening out a subtask meeting the condition according to the current parameter value a being 2 by combining with the filter, wherein the subtask meeting the condition is action2 in the example, and then calling and executing action 2;
5. the action2 updates the parameter value a to 3 after normal execution;
6. action2 returns normally;
7. and according to the current parameter value a being 3, in combination with the fact that the filter does not find any subtask meeting the condition, the controller considers that the task is executed completely, calls k8s-client to delete the parameter object, and exits the task process A. In fig. 3 and fig. 4, the apiserver is one of core services of kubernets, and is configured to provide a series of http interfaces, through which resources of kubernets can be queried and operated externally; the task manager is used for being responsible for the life cycle management of the task process; and the controller in the task manager is responsible for the life cycle management of the task and is used for creating a plurality of asynchronous task processes as required, each task process judges the execution progress of the task according to the parameter values and the state values in the corresponding parameter objects, judges subtasks needing to be executed next according to the parameter conditions stated in the filter and triggers the subtasks, and when any subtask can not be matched with the parameter values any more, the task is considered to be finished, and the corresponding task process is exited. As can be seen, the parameter objects are updated in time after the action1 is normally executed, the action1 does not need to be executed again after the task is interrupted, the execution is started from the action2, namely, the task is normally recovered, and some repeated actions are avoided.
As can be seen from the above, in this embodiment, a corresponding number of subtasks are obtained by dividing a target execution task, and a corresponding parameter object for storing a task execution progress is created for the target execution task; starting a task process to execute the subtasks, and updating the parameter object according to the currently executed subtasks; and if the task process is interrupted, reading the parameter object to determine a target subtask which is being executed when the process is interrupted, and re-executing the target subtask to recover the task process. Therefore, the target execution task is divided into a plurality of subtasks, the parameter object used for saving the task execution progress is created for the target execution task, the target subtask executed during interruption is determined by inquiring the parameter object after the task is interrupted, and the target task is re-executed from the target subtask, so that the problem of interruption of the long-time task running on kubernets is solved, the recovery after the interruption of the long-time task can be realized, the repeated action in the task is reduced by dividing the task into a plurality of subtasks for execution, a large amount of time consumed by re-executing the task is saved, and the task execution efficiency is improved.
Correspondingly, an embodiment of the present application further discloses a task management device, as shown in fig. 5, the task management device includes:
the segmentation module 11 is configured to segment the target execution task to obtain a corresponding number of subtasks, and create a corresponding parameter object for storing a task execution progress for the target execution task;
a parameter object updating module 12, configured to start a task process to execute the subtask, and update the parameter object according to the currently executed subtask;
and a process recovery module 13, configured to, if the task process is interrupted, read the parameter object to determine a target subtask that is being executed when the process is interrupted, and re-execute the target subtask to recover the task process.
As can be seen from the above, in this embodiment, a corresponding number of subtasks are obtained by dividing a target execution task, and a corresponding parameter object for storing a task execution progress is created for the target execution task; starting a task process to execute the subtasks, and updating the parameter object according to the currently executed subtasks; and if the task process is interrupted, reading the parameter object to determine a target subtask which is executed when the process is interrupted, and re-executing the target subtask to recover the task process. Therefore, the target execution task is divided into a plurality of subtasks, the parameter object used for saving the task execution progress is created for the target execution task, the target subtask executed during interruption is determined by inquiring the parameter object after the task is interrupted, and the target task is re-executed from the target subtask, so that the problem of interruption of the long-time task running on kubernets is solved, the recovery after the interruption of the long-time task can be realized, the repeated action in the task is reduced by dividing the task into a plurality of subtasks for execution, a large amount of time consumed by re-executing the task is saved, and the task execution efficiency is improved.
In some specific embodiments, the task management device may specifically include:
and the subtask definition unit is used for defining each subtask according to the task base class and by referring to the filter annotation, and each subtask corresponds to a parameter value after being defined.
In some specific embodiments, the parameter object updating module 12 may specifically include:
an initial parameter reading unit, configured to start a task process through a controller of a task manager and read an initial parameter from the parameter object;
the first to-be-executed subtask execution unit is used for filtering the subtask corresponding to the initial parameter from all the subtasks by using a filter according to the parameter value corresponding to each subtask to serve as a first to-be-executed subtask and executing the first to-be-executed subtask;
and the other subtask execution units are used for filtering out corresponding subtasks from all the subtasks and executing the subtasks according to the current parameter value of the parameter object by using the filter through the controller after the first subtask to be executed is executed until all the subtasks of the target execution task are executed.
In some specific embodiments, the parameter object updating module 12 may specifically include:
the parameter object updating unit is used for updating the parameter object according to the parameter value corresponding to the currently executed subtask;
correspondingly, the process recovery module 13 may specifically include:
a target parameter value determining unit, configured to obtain a target parameter value currently stored in the parameter object by reading the parameter object;
and the target subtask determining unit is used for filtering the subtask corresponding to the target parameter value from all the subtasks by using a filter according to the parameter value corresponding to each subtask, and taking the subtask corresponding to the target parameter value as the target subtask which is executed when the process is interrupted.
In some specific embodiments, the segmentation module 11 may be specifically configured to create, for the target execution task, a parameter object for storing a task identifier, a task name, and a task parameter in a task execution process, and store the parameter object to a storage space in a persistent storage manner.
In some specific embodiments, the process recovery module 13 may specifically include:
the parameter object determining unit is used for determining the parameter object corresponding to the target execution task from the storage space according to the task identifier of the target execution task;
and the target subtask determining unit is used for reading the parameter object to determine the target subtask which is executed when the process is interrupted.
In some embodiments, the segmentation module 11 may be specifically configured to segment the target execution task according to task idempotency to obtain a corresponding number of subtasks with idempotency.
Further, the embodiment of the present application also discloses an electronic device, which is shown in fig. 6, and the content in the drawing cannot be considered as any limitation to the application scope.
Fig. 6 is a schematic structural diagram of an electronic device 20 according to an embodiment of the present disclosure. The electronic device 20 may specifically include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input output interface 25, and a communication bus 26. Wherein, the memory 22 is used for storing a computer program, and the computer program is loaded and executed by the processor 21 to implement the relevant steps in the task management method disclosed in any of the foregoing embodiments.
In this embodiment, the power supply 23 is configured to provide a working voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and an external device, and a communication protocol followed by the communication interface is any communication protocol applicable to the technical solution of the present application, and is not specifically limited herein; the input/output interface 25 is configured to obtain external input data or output data to the outside, and a specific interface type thereof may be selected according to specific application requirements, which is not specifically limited herein.
In addition, the storage 22 is used as a carrier for resource storage, and may be a read-only memory, a random access memory, a magnetic disk or an optical disk, etc., and the resources stored thereon include an operating system 221, a computer program 222, data 223 including a training set, etc., and the storage may be a transient storage or a permanent storage.
The operating system 221 is used for managing and controlling each hardware device and the computer program 222 on the electronic device 20, so as to realize the operation and processing of the mass data 223 in the memory 22 by the processor 21, and may be Windows Server, Netware, Unix, Linux, and the like. The computer programs 222 may further include computer programs that can be used to perform other specific tasks in addition to the computer programs that can be used to perform the task management method disclosed by any of the foregoing embodiments and executed by the electronic device 20.
Further, an embodiment of the present application further discloses a computer storage medium, where computer-executable instructions are stored in the computer storage medium, and when the computer-executable instructions are loaded and executed by a processor, the steps of the task management method disclosed in any of the foregoing embodiments are implemented.
The embodiments are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same or similar parts among the embodiments are referred to each other. The device disclosed by the embodiment corresponds to the method disclosed by the embodiment, so that the description is simple, and the relevant points can be referred to the method part for description.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. A software module may reside in Random Access Memory (RAM), memory, Read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
Finally, it should also be noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in the process, method, article, or apparatus that comprises the element.
The task management method, device, equipment and medium provided by the invention are described in detail, and a specific example is applied in the description to explain the principle and the implementation of the invention, and the description of the embodiment is only used to help understanding the method and the core idea of the invention; meanwhile, for a person skilled in the art, according to the idea of the present invention, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present invention.

Claims (10)

1. A method for task management, comprising:
dividing a target execution task to obtain a corresponding number of subtasks, and creating a corresponding parameter object for saving task execution progress for the target execution task;
starting a task process to execute the subtasks, and updating the parameter object according to the currently executed subtasks;
and if the task process is interrupted, reading the parameter object to determine a target subtask which is executed when the process is interrupted, and re-executing the target subtask to recover the task process.
2. The task management method according to claim 1, wherein after the dividing the target execution task into the corresponding number of subtasks, the method further comprises:
and defining each subtask according to the task base class and by referring to the filter annotation, wherein each subtask corresponds to a parameter value after definition.
3. The task management method according to claim 2, wherein the starting of the task process to execute the subtask comprises:
starting a task process through a controller of a task manager and reading initial parameters from the parameter object;
filtering the subtasks corresponding to the initial parameters from all the subtasks by using a filter according to the parameter value corresponding to each subtask to serve as a first subtask to be executed, and executing the first subtask to be executed;
and after the first subtask to be executed is executed, filtering out the corresponding subtask from all the subtasks and executing the subtask by using the filter through the controller according to the current parameter value of the parameter object until all the subtasks of the target execution task are executed.
4. The task management method according to claim 2, wherein the updating the parameter object according to the currently executed subtask comprises:
updating the parameter object according to the parameter value corresponding to the currently executed subtask;
correspondingly, the reading the parameter object to determine the target subtask being executed when the process is interrupted includes:
obtaining a target parameter value currently stored by the parameter object by reading the parameter object;
and filtering the subtasks corresponding to the target parameter values from all the subtasks by using a filter according to the parameter values corresponding to each subtask to serve as the target subtask being executed when the process is interrupted.
5. The task management method according to claim 1, wherein the creating a corresponding parameter object for saving task execution progress for the target execution task includes:
and creating a parameter object for storing a task identifier, a task name and a task parameter in the task execution process for the target execution task, and storing the parameter object to a storage space in a persistent storage mode.
6. The task management method according to claim 5, wherein the reading the parameter object to determine the target subtask being executed when the process is interrupted comprises:
according to the task identification of the target execution task, determining the parameter object corresponding to the target execution task from the storage space;
and reading the parameter object to determine the target subtask which is executed when the process is interrupted.
7. The task management method according to any one of claims 1 to 6, wherein the dividing the target execution task into a corresponding number of subtasks includes:
and dividing the target execution task according to task idempotency to obtain a corresponding number of subtasks with idempotency.
8. A task management apparatus, comprising:
the system comprises a segmentation module, a task execution module and a task execution module, wherein the segmentation module is used for segmenting a target execution task to obtain a corresponding number of subtasks and creating a corresponding parameter object for storing task execution progress for the target execution task;
the parameter object updating module is used for starting a task process to execute the subtask and updating the parameter object according to the currently executed subtask;
and the process recovery module is used for reading the parameter object to determine a target subtask which is executed when the process is interrupted if the task process is interrupted, and re-executing the target subtask to recover the task process.
9. An electronic device, comprising:
a memory for storing a computer program;
a processor for executing the computer program to implement the task management method of any of claims 1 to 7.
10. A computer-readable storage medium for storing a computer program; wherein the computer program when executed by a processor implements a task management method as claimed in any one of claims 1 to 7.
CN202210334877.9A 2022-03-31 2022-03-31 Task management method, device, equipment and storage medium Pending CN114625515A (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN202210334877.9A CN114625515A (en) 2022-03-31 2022-03-31 Task management method, device, equipment and storage medium
PCT/CN2022/141660 WO2023185137A1 (en) 2022-03-31 2022-12-23 Task management method and apparatus, and device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210334877.9A CN114625515A (en) 2022-03-31 2022-03-31 Task management method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN114625515A true CN114625515A (en) 2022-06-14

Family

ID=81905481

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210334877.9A Pending CN114625515A (en) 2022-03-31 2022-03-31 Task management method, device, equipment and storage medium

Country Status (2)

Country Link
CN (1) CN114625515A (en)
WO (1) WO2023185137A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2023185137A1 (en) * 2022-03-31 2023-10-05 苏州浪潮智能科技有限公司 Task management method and apparatus, and device and storage medium

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2010147486A2 (en) * 2009-06-19 2010-12-23 Core Technology Ltd Computer process management
CN109558237A (en) * 2017-09-27 2019-04-02 北京国双科技有限公司 A kind of task status management method and device
CN113076182B (en) * 2021-03-24 2024-03-29 成都海光集成电路设计有限公司 Recovery method and device of computing task, user equipment and storage medium
CN114625515A (en) * 2022-03-31 2022-06-14 苏州浪潮智能科技有限公司 Task management method, device, equipment and storage medium

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2023185137A1 (en) * 2022-03-31 2023-10-05 苏州浪潮智能科技有限公司 Task management method and apparatus, and device and storage medium

Also Published As

Publication number Publication date
WO2023185137A1 (en) 2023-10-05

Similar Documents

Publication Publication Date Title
CN113760476B (en) Task dependency processing method and related device
CN110362418B (en) Abnormal data recovery method and device, server and storage medium
CN113656407B (en) Data topology generation method and device, electronic equipment and storage medium
CN111026568A (en) Data and task relation construction method and device, computer equipment and storage medium
CN112817710A (en) Timed task processing method, timed task processing system, computer equipment and computer storage medium
CN114625515A (en) Task management method, device, equipment and storage medium
CN110868309A (en) Method and device for processing resources in VNFM (virtual network configuration function) and computer storage medium
CN111966466A (en) Container management method, device and medium
CN110365809B (en) Distributed server address configuration system and method
CN109582386B (en) Service starting processing method and device, electronic equipment and readable storage medium
US11216352B2 (en) Method for automatically analyzing bottleneck in real time and an apparatus for performing the method
CN107741885B (en) Transaction and service association method and system based on CS framework
CN114327819B (en) Task management method, device, equipment and storage medium
CN115203260A (en) Abnormal data determination method and device, electronic equipment and storage medium
CN113112023B (en) Inference service management method and device of AIStation inference platform
CN113986495A (en) Task execution method, device, equipment and storage medium
CN111858234A (en) Task execution method, device, equipment and medium
CN112988277A (en) Rule file loading method, device, server and medium
US20230251896A1 (en) Using a nanoservice to inform an external job service of a job status of a microservice
CN112148463B (en) Business process control method and device
CN113655964B (en) Data volume processing method, device, electronic equipment, medium and program product
CN117632443B (en) Method, device, equipment and medium for controlling circulation of business process
CN112019385B (en) Cloud platform component deleting method, device, equipment and storage medium
US8825610B1 (en) System management based on goals relevant to a current state of a managed system
CN116302825A (en) Processing method and device for abnormal container

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