CN109582396B - Task state processing method, device and system and storage medium - Google Patents

Task state processing method, device and system and storage medium Download PDF

Info

Publication number
CN109582396B
CN109582396B CN201710873333.9A CN201710873333A CN109582396B CN 109582396 B CN109582396 B CN 109582396B CN 201710873333 A CN201710873333 A CN 201710873333A CN 109582396 B CN109582396 B CN 109582396B
Authority
CN
China
Prior art keywords
task
state
newly added
state information
updated
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201710873333.9A
Other languages
Chinese (zh)
Other versions
CN109582396A (en
Inventor
李强
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Gridsum Technology Co Ltd
Original Assignee
Beijing Gridsum 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 Beijing Gridsum Technology Co Ltd filed Critical Beijing Gridsum Technology Co Ltd
Priority to CN201710873333.9A priority Critical patent/CN109582396B/en
Publication of CN109582396A publication Critical patent/CN109582396A/en
Application granted granted Critical
Publication of CN109582396B publication Critical patent/CN109582396B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

The invention provides a task state processing method, a device, a system and a storage medium, which are used for pre-configuring parameters of each task, then acquiring incoming parameters of a newly added task, defining the task state of the newly added task as a state to be executed, identifying the relationship between a parent task and a sub task in the incoming parameters of the newly added task, and determining an ancestor task identifier of the newly added task. Therefore, the task state processing method considers the relationship between the subtasks and the parent tasks, and when the subtasks are added, the total number of the subtasks of the parent tasks is automatically updated.

Description

Task state processing method, device and system and storage medium
Technical Field
The present invention relates to the field of data processing technologies, and in particular, to a method, an apparatus, a system, and a storage medium for processing a task state.
Background
With the continuous development of science and technology, network searching is increasingly common, generally, a background server divides a task into a plurality of independent subtasks for execution, the subtasks can be further divided into a plurality of subtasks, asynchronous execution is performed between each subtask, and the divided task is called as a parent task.
It can be seen that the processing logic of each subtask is simpler than that of the parent task, but when there are many subtasks that need to be executed in parallel at the same time, the background server needs to know the execution state and degree of the task, such as the self state of the task, the number and completion of all subtasks owned by the task, the error information of the task that is executed incorrectly, and the state relationship between the parent task and the subtasks, but the current task execution system does not support the above functions.
Therefore, how to provide a task state processing method, device and system, which can provide state information of each task, becomes a major technical problem to be solved by those skilled in the art.
Disclosure of Invention
In view of the above problems, the present invention has been made to provide a solution that overcomes or at least partially solves the above problems:
a task state processing method is provided, wherein parameters of each task are configured in advance, the parameters comprise one or more of task identification, relationship identification of a father task and a son task, task names, task state information, task starting time, task ending time, task storage configuration information, the total number of the son tasks, the failure number of the son tasks, the success number of the son tasks, task type information, task depth, ancestor task identification, task error information and task creator information, and the task state processing method comprises the following steps:
acquiring incoming parameters of the newly added task, wherein the incoming parameters at least comprise relationship identifications of a parent task and a child task;
defining the task state of the newly added task as a state to be executed;
and determining an ancestor task identifier of the newly added task according to the relationship identifier of the parent task and the subtask in the transmitted parameters of the newly added task.
Optionally, the determining, according to the relationship identifier of the parent task and the child task in the incoming parameter of the newly added task, the ancestor task identifier of the newly added task includes:
judging whether the current executed task contains the parent task of the newly added task or not according to the relation identification of the parent task and the sub task in the incoming parameters of the newly added task,
if yes, determining that the ancestor task identifier of the newly added task is the ancestor task identifier of the currently executed parent task, determining that the task depth of the newly added task is the sum of the task depth of the parent task and a first preset value, and determining that the total number of the sub tasks of the parent task is increased by one;
and if not, determining that the ancestor task identifier of the newly added task is the task identifier of the newly added task.
Optionally, the method further includes:
detecting whether a task state updating instruction is received;
if the task state updating instruction is received, extracting a task identifier of the newly added task from the incoming parameters of the newly added task, and determining task state information of the newly added task according to the task identifier of the newly added task;
acquiring task state information of a task to be updated, and changing the task state information of the task to be updated into task state information of the newly added task;
and executing a preset action corresponding to the task state information of the newly added task, wherein the task state information comprises a task completion state, a task failure state, a waiting subtask completion state, a to-be-executed state and an executing state.
Optionally, the executing the preset action corresponding to the task state information of the newly added task includes:
when the task state information of the newly added task is a task completion state or a task failure state,
setting the task ending time of the task to be updated as the current time;
judging whether the task to be updated has a parent task, if so, further judging whether task state information of the task to be updated is a task completion state or a task failure state, if so, acquiring the current state of the task to be updated and judging whether the task state information of the task to be updated is the same as the current state; if not, when the task state information of the newly added task is in a task completion state, determining that the success number of the subtasks in the parent task of the newly added task is increased by one, and when the task state information of the newly added task is in a task failure state, determining that the failure number of the subtasks in the parent task of the newly added task is increased by one.
Optionally, the executing the preset action corresponding to the task state information of the newly added task further includes:
when the task state information of the task to be updated is the same as the current state, further judging whether the execution of the sub task of the parent task of the newly added task is finished, if so, judging whether the parent task of the newly added task has a wrong sub task when the task state information of the task to be updated is a waiting sub task finishing state, if so, determining that the state of the parent task is a task failure state, and if not, determining that the state of the parent task is a task finishing state;
and when the task state information of the task to be updated is different from the current state, determining that the task state information of the task to be updated is in an executing state, and determining that the task state information of the task to be updated is the current state.
Optionally, the executing the preset action corresponding to the task state information of the newly added task further includes:
when the task state information of the newly added task is a waiting subtask completion state,
setting the task ending time of the task to be updated as the current time;
and judging whether all subtasks in the task to be updated are executed, if so, judging whether the subtasks which are failed to be executed exist, if so, determining that the task state information of the task to be updated is a task failure state, and if not, determining that the task state information of the task to be updated is a task completion state.
Optionally, the executing the preset action corresponding to the task state information of the newly added task further includes:
judging whether the task state information of the newly added task is in an executing state, if so, setting the task starting time of the task to be updated as the current time, and if not, judging whether the task state information of the task to be updated is in a task completing state or a task failing state;
when the task state information of the task to be updated is a task completion state or a task failure state, judging whether the task to be updated has a parent task, if so, continuously judging the task state information of the task to be updated, when the task state information of the task to be updated is the task completion state, determining that the success number of the child tasks of the parent task of the newly added task is reduced by one, and when the task state information of the task to be updated is the task failure state, determining that the failure number of the child tasks of the parent task of the newly added task is reduced by one;
and acquiring task state information of the parent task of the newly added task, judging whether the task state information of the parent task of the newly added task is in a task completion state or a task failure state, and if so, determining that the state of the parent task of the newly added task is in a waiting subtask completion state.
A task state processing device, which configures parameters of each task in advance, wherein the parameters comprise one or more of task identifiers, relationship identifiers of a parent task and a child task, task names, task state information, task starting time, task ending time, task storage configuration information, total number of the child tasks, failure number of the child tasks, success number of the child tasks, task type information, task depth, ancestor task identifiers, task error information and task creator information, and the task state processing device comprises:
the system comprises a first acquisition module, a second acquisition module and a third acquisition module, wherein the first acquisition module is used for acquiring incoming parameters of a newly added task, and the incoming parameters at least comprise relationship identifiers of a parent task and a child task;
the defining module is used for defining the task state of the newly added task as a state to be executed;
and the determining module is used for determining an ancestor task identifier of the newly added task according to the relationship identifier of the parent task and the subtask in the transmitted parameters of the newly added task.
A task state processing system, comprising:
a memory for storing a program;
and the processor is used for executing the program, and the program executes any one of the task state processing methods when running.
A storage medium storing a program which, when executed by a processor, implements a task state processing method as described above.
By means of the technical scheme, the invention provides a task state processing method, which comprises the steps of configuring parameter information of each task in advance, then obtaining incoming parameter information of a newly added task, defining the task state of the newly added task as a state to be executed, identifying the relationship between a parent task and a sub task in the incoming parameters of the newly added task, and determining an ancestor task identifier of the newly added task. Specifically, whether the parent task of the newly added task is included in the currently executed task is judged according to the relationship identification of the parent task and the sub-task in the transmitted parameters of the newly added task, if yes, the ancestor task identification of the newly added task is determined to be the ancestor task identification of the currently executed parent task, the task depth of the newly added task is determined to be the sum of the task depth of the parent task and a first preset value, and the total number of the sub-tasks of the parent task is determined to be increased by one. And if not, determining that the ancestor task identifier of the newly added task is the task identifier of the newly added task.
Therefore, the task state processing method provided by the embodiment considers the relationship between the subtask and the parent task, and when the subtask is added, the total number of the subtasks of the parent task is automatically updated.
In addition, when the update task status is complete (success or failure), the task status of the parent task is updated, and when the parent task ends, the status of its child task needs to be determined, and the task status of the parent task is determined according to the completion status of its child task.
The foregoing description is only an overview of the technical solutions of the present invention, and the embodiments of the present invention are described below in order to make the technical means of the present invention more clearly understood and to make the above and other objects, features, and advantages of the present invention more clearly understandable.
Drawings
Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The drawings are only for purposes of illustrating the preferred embodiments and are not to be construed as limiting the invention. Also, like reference numerals are used to refer to like parts throughout the drawings. In the drawings:
fig. 1 is a flowchart illustrating a task state processing method according to an embodiment of the present invention;
FIG. 2 is a schematic flow chart illustrating a task state processing method according to an embodiment of the present invention;
FIG. 3 is a schematic flow chart of a task state processing method according to an embodiment of the present invention;
FIG. 4 is a schematic flow chart illustrating a task state processing method according to an embodiment of the present invention;
FIG. 5 is a schematic flow chart of a task state processing method according to an embodiment of the present invention;
fig. 6 is a schematic structural diagram illustrating a task state processing apparatus according to an embodiment of the present invention.
Detailed Description
Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
An embodiment of the present invention provides a task state processing method, as shown in fig. 1, a parameter of each task is configured in advance, where the parameter includes one or more of a task identifier, a relationship identifier between a parent task and a child task, a task name, task state information, task start time, task end time, task storage configuration information, a total number of child tasks, a failure number of child tasks, a success number of child tasks, task type information, task depth, an ancestor task identifier, task error information, and task creator information.
Illustratively, the parameters of the configuration are shown in table 1 below:
TABLE 1
Figure BDA0001417588080000061
Figure BDA0001417588080000071
The task state processing method comprises the following steps:
and S11, acquiring the incoming parameters of the newly added task.
The incoming parameters may include a relationship identifier of a parent task and a child task, a task name, task storage configuration information, task type information, and task creator information.
And S12, defining the task state of the newly added task as a to-be-executed state.
In this embodiment, the task state includes five states, namely, a task completion state (Complete), a task failure state (failed), a wait subtask completion state (waitingforchildrentofcomplete), a to-be-executed state (waitingtofun), and an executing state (Running), and in this step, the task state of the newly added task is defined as the to-be-executed state.
S13, determining an ancestor task identifier of the newly added task according to the relationship identifier of the parent task and the subtask in the transmitted parameters of the newly added task.
The method includes the steps of determining an ancestor task identifier, specifically, the embodiment provides a method for determining the ancestor task identifier based on the relationship identifier parejobid of the parent task and the child task in the newly added task, and includes the following steps:
judging whether the current executed task in the database contains the parent task of the newly added task or not according to the relation identification of the parent task and the sub task in the incoming parameters of the newly added task,
if yes, determining that the ancestor task identifier of the newly added task is the ancestor task identifier of the currently executed parent task, determining that the task depth of the newly added task is the sum of the task depth of the parent task and a first preset value, and determining that the total number of the sub tasks of the parent task is increased by one;
and if not, determining that the ancestor task identifier of the newly added task is the task identifier of the newly added task.
Specifically, the task depth represents a hierarchical relationship of the task during execution, for example, if a task a has a parent task B, and the parent task B has a parent task C, then the task C is an ancestor task of the task a, and the task depth of the task a is 1, the task depth of the task B is 2, and the task depth of the task C is 3.
Therefore, the task state processing method provided by the embodiment considers the relationship between the subtask and the parent task, and when the subtask is added, the total number of the subtasks of the parent task is automatically updated.
On the basis of the foregoing embodiment, the present embodiment further provides a specific flow when the task status is updated, as shown in fig. 2, including:
s21, detecting whether a task state updating instruction is received;
s22, if the task state updating instruction is received, extracting a task identifier of the newly added task from the incoming parameters of the newly added task, and determining task state information of the newly added task according to the task identifier of the newly added task;
s23, acquiring task state information of a task to be updated, and changing the task state information of the task to be updated into the task state information of the newly added task;
and S24, executing a preset action corresponding to the task state information of the newly added task, wherein the task state information comprises a task completion state, a task failure state, a waiting subtask completion state, a to-be-executed state and an executing state.
Specifically, executing the preset action corresponding to the task state information of the newly added task, as shown in fig. 3, may be implemented by the following steps:
s31, when the task state information of the newly added task is a task completion state or a task failure state, setting the task ending time of the task to be updated as the current time;
s32, judging whether the task to be updated has a parent task, if so, further judging whether the task state information of the task to be updated is a task completion state or a task failure state, if so, acquiring the current state of the task to be updated and judging whether the task state information of the task to be updated is the same as the current state; if not, when the task state information of the newly added task is in a task completion state, determining that the success number of the subtasks in the parent task of the newly added task is increased by one, and when the task state information of the newly added task is in a task failure state, determining that the failure number of the subtasks in the parent task of the newly added task is increased by one.
S33, when the task state information of the task to be updated is the same as the current state, further judging whether the sub task of the parent task of the newly added task is executed and completed, if so, when the task state information of the task to be updated is a state waiting for the completion of the sub task, judging whether the parent task of the newly added task has a wrong sub task, if so, determining that the state of the parent task is a task failure state, and if not, determining that the state of the parent task is a task completion state.
S34, when the task state information of the task to be updated is different from the current state, determining that the task state information of the task to be updated is in an executing state, and determining that the task state information of the task to be updated is in the current state.
Besides, the task state information of the newly added task, which executes the preset action corresponding to the task state information of the newly added task, may also include, as shown in fig. 4:
s41, when the task state information of the newly added task is a waiting subtask completion state, setting the task ending time of the task to be updated as the current time;
s42, judging whether all subtasks in the task to be updated are executed, if so, judging whether the subtasks which are failed to be executed exist, if so, determining that the task state information of the task to be updated is a task failure state, and if not, determining that the task state information of the task to be updated is a task completion state.
It should be noted that, in this embodiment, the executing the preset action corresponding to the task state information of the newly added task may be implemented by the flow illustrated in fig. 5, and includes:
s51, judging whether the task state information of the newly added task is in an executing state, if so, setting the task starting time of the task to be updated as the current time, and if not, judging whether the task state information of the task to be updated is in a task completing state or a task failing state;
s52, when the task state information of the task to be updated is a task completion state or a task failure state, judging whether the task to be updated has a parent task, if so, continuously judging the task state information of the task to be updated, when the task state information of the task to be updated is the task completion state, determining that the success number of the child tasks of the parent task of the newly added task is reduced by one, and when the task state information of the task to be updated is the task failure state, determining that the failure number of the child tasks of the parent task of the newly added task is reduced by one;
s53, acquiring task state information of the parent task of the newly added task, judging whether the task state information of the parent task of the newly added task is in a task completion state or a task failure state, and if so, determining that the state of the parent task of the newly added task is in a waiting subtask completion state.
In addition, on the basis of the foregoing embodiments, corresponding to the foregoing method, an embodiment of the present invention further provides a task state processing apparatus, please refer to fig. 6, which shows a schematic structural diagram of the task state processing apparatus, where parameters of each task are configured in advance, where the parameters include one or more of a task identifier, a relationship identifier between a parent task and a child task, a task name, task state information, a task start time, a task end time, task storage configuration information, a total number of child tasks, a number of failures of child tasks, a number of successes of child tasks, task type information, a task depth, an ancestor task identifier, task error information, and task creator information, and the task state processing apparatus may include:
a first obtaining module 61, configured to obtain an incoming parameter of a newly added task, where the incoming parameter at least includes a relationship identifier between a parent task and a child task;
a defining module 62, configured to define a task state of the newly added task as a state to be executed;
and the determining module 63 is configured to determine an ancestor task identifier of the newly added task according to the relationship identifier of the parent task and the child task in the incoming parameter of the newly added task.
Optionally, the method further includes:
the second acquisition module is used for detecting whether a task state updating instruction is received or not;
a third obtaining module, configured to extract a task identifier of the newly added task from an incoming parameter of the newly added task if the task state update instruction is received, and determine task state information of the newly added task according to the task identifier of the newly added task;
the fourth acquisition module is used for acquiring the task state information of the task to be updated and changing the task state information of the task to be updated into the task state information of the newly added task;
and the execution module is used for executing a preset action corresponding to the task state information of the newly added task, wherein the task state information comprises a task completion state, a task failure state, a waiting subtask completion state, a to-be-executed state and an executing state.
Optionally, the executing module includes:
the first setting unit is used for setting the task ending time of the task to be updated as the current time when the task state information of the newly added task is a task completion state or a task failure state;
the first judging unit is used for judging whether the task to be updated has a parent task or not, if so, further judging whether task state information of the task to be updated is a task completion state or a task failure state or not, if so, acquiring the current state of the task to be updated and judging whether the task state information of the task to be updated is the same as the current state or not; if not, when the task state information of the newly added task is in a task completion state, determining that the success number of the subtasks in the parent task of the newly added task is increased by one, and when the task state information of the newly added task is in a task failure state, determining that the failure number of the subtasks in the parent task of the newly added task is increased by one;
a second judging unit, configured to further judge whether a sub task of a parent task of the newly added task is executed and completed when the task state information of the task to be updated is the same as the current state, if so, judge whether the parent task of the newly added task has a wrong sub task when the task state information of the task to be updated is a waiting sub task completion state, if so, determine that the state of the parent task is a task failure state, and if not, determine that the state of the parent task is a task completion state;
and the determining unit is used for determining that the task state information to be updated is in an executing state and determining that the task state information of the task to be updated is in the current state when the task state information of the task to be updated is different from the current state.
Optionally, the execution module further includes:
a first setting unit for
When the task state information of the newly added task is a waiting subtask completion state, setting the task ending time of the task to be updated as the current time;
and the third judging unit is used for judging whether all subtasks in the task to be updated are executed, if so, judging whether the subtasks which are failed to execute exist, if so, determining that the task state information of the task to be updated is a task failure state, and if not, determining that the task state information of the task to be updated is a task completion state.
Optionally, the executing module further includes:
a fourth judging unit, configured to judge whether task state information of the newly added task is in an executing state, if yes, set task start time of the task to be updated as current time, and if not, judge whether task state information of the task to be updated is in a task completion state or a task failure state;
a fifth judging unit, configured to judge whether the task to be updated has a parent task when the task state information of the task to be updated is a task completion state or a task failure state, and if so, continue to judge the task state information of the task to be updated, determine that the number of successes of the child task of the parent task of the newly added task is decreased by one when the task state information of the task to be updated is the task completion state, and determine that the number of failures of the child task of the parent task of the newly added task is decreased by one when the task state information of the task to be updated is the task failure state;
and the acquisition unit is used for acquiring the task state information of the parent task of the newly added task, judging whether the task state information of the parent task of the newly added task is in a task completion state or a task failure state, and if so, determining that the state of the parent task of the newly added task is in a waiting subtask completion state.
The data monitoring device comprises a processor and a memory, wherein the first acquisition module, the definition module, the determination module, the judgment module, the storage module and the like are stored in the memory as program units, and the processor executes the program units stored in the memory to realize corresponding functions.
The processor comprises a kernel, and the kernel calls the corresponding program unit from the memory. The kernel can set one or more than one, and automatically updates the total number of the subtasks of the parent task by establishing the relationship between the subtasks and the parent task and when the subtasks are added.
The memory may include volatile memory in a computer readable medium, Random Access Memory (RAM) and/or nonvolatile memory such as Read Only Memory (ROM) or flash memory (flash RAM), and the memory includes at least one memory chip.
An embodiment of the present invention provides a storage medium on which a program is stored, the program implementing the task state processing method when executed by a processor.
The embodiment of the invention provides a processor, which is used for running a program, wherein the task state processing method is executed when the program runs.
The embodiment of the invention provides equipment, which comprises a processor, a memory and a program which is stored on the memory and can run on the processor, wherein the processor executes the program and realizes the following steps:
acquiring incoming parameters of the newly added task, wherein the incoming parameters at least comprise relationship identifications of a parent task and a child task;
defining the task state of the newly added task as a state to be executed;
and determining an ancestor task identifier of the newly added task according to the relationship identifier of the parent task and the subtask in the transmitted parameters of the newly added task.
Optionally, the determining, according to the relationship identifier of the parent task and the child task in the incoming parameter of the newly added task, the ancestor task identifier of the newly added task includes:
judging whether the current executed task contains the parent task of the newly added task or not according to the relation identification of the parent task and the sub task in the incoming parameters of the newly added task,
if yes, determining that the ancestor task identifier of the newly added task is the ancestor task identifier of the currently executed parent task, determining that the task depth of the newly added task is the sum of the task depth of the parent task and a first preset value, and determining that the total number of the sub tasks of the parent task is increased by one;
and if not, determining that the ancestor task identifier of the newly added task is the task identifier of the newly added task.
Optionally, the method further includes:
detecting whether a task state updating instruction is received;
if the task state updating instruction is received, extracting a task identifier of the newly added task from the incoming parameters of the newly added task, and determining task state information of the newly added task according to the task identifier of the newly added task;
acquiring task state information of a task to be updated, and changing the task state information of the task to be updated into task state information of the newly added task;
and executing a preset action corresponding to the task state information of the newly added task, wherein the task state information comprises a task completion state, a task failure state, a waiting subtask completion state, a to-be-executed state and an executing state.
Optionally, the executing the preset action corresponding to the task state information of the newly added task includes:
when the task state information of the newly added task is a task completion state or a task failure state,
setting the task ending time of the task to be updated as the current time;
judging whether the task to be updated has a parent task, if so, further judging whether task state information of the task to be updated is a task completion state or a task failure state, if so, acquiring the current state of the task to be updated and judging whether the task state information of the task to be updated is the same as the current state; if not, when the task state information of the newly added task is in a task completion state, determining that the success number of the subtasks in the parent task of the newly added task is increased by one, and when the task state information of the newly added task is in a task failure state, determining that the failure number of the subtasks in the parent task of the newly added task is increased by one.
Optionally, the executing the preset action corresponding to the task state information of the newly added task further includes:
when the task state information of the task to be updated is the same as the current state, further judging whether the execution of the sub task of the parent task of the newly added task is finished, if so, judging whether the parent task of the newly added task has a wrong sub task when the task state information of the task to be updated is a waiting sub task finishing state, if so, determining that the state of the parent task is a task failure state, and if not, determining that the state of the parent task is a task finishing state;
and when the task state information of the task to be updated is different from the current state, determining that the task state information of the task to be updated is in an executing state, and determining that the task state information of the task to be updated is the current state.
Optionally, the executing the preset action corresponding to the task state information of the newly added task further includes:
when the task state information of the newly added task is a waiting subtask completion state,
setting the task ending time of the task to be updated as the current time;
and judging whether all subtasks in the task to be updated are executed, if so, judging whether the subtasks which are failed to be executed exist, if so, determining that the task state information of the task to be updated is a task failure state, and if not, determining that the task state information of the task to be updated is a task completion state.
Optionally, the executing the preset action corresponding to the task state information of the newly added task further includes:
judging whether the task state information of the newly added task is in an executing state, if so, setting the task starting time of the task to be updated as the current time, and if not, judging whether the task state information of the task to be updated is in a task completing state or a task failing state;
when the task state information of the task to be updated is a task completion state or a task failure state, judging whether the task to be updated has a parent task, if so, continuously judging the task state information of the task to be updated, when the task state information of the task to be updated is the task completion state, determining that the success number of the child tasks of the parent task of the newly added task is reduced by one, and when the task state information of the task to be updated is the task failure state, determining that the failure number of the child tasks of the parent task of the newly added task is reduced by one;
and acquiring task state information of the parent task of the newly added task, judging whether the task state information of the parent task of the newly added task is in a task completion state or a task failure state, and if so, determining that the state of the parent task of the newly added task is in a waiting subtask completion state.
The device herein may be a server, a PC, a PAD, a mobile phone, etc.
The present application further provides a computer program product adapted to perform a program for initializing the following method steps when executed on a data processing device:
acquiring incoming parameters of the newly added task, wherein the incoming parameters at least comprise relationship identifications of a parent task and a child task;
defining the task state of the newly added task as a state to be executed;
and determining an ancestor task identifier of the newly added task according to the relationship identifier of the parent task and the subtask in the transmitted parameters of the newly added task.
Optionally, the determining, according to the relationship identifier of the parent task and the child task in the incoming parameter of the newly added task, the ancestor task identifier of the newly added task includes:
judging whether the current executed task contains the parent task of the newly added task or not according to the relation identification of the parent task and the sub task in the incoming parameters of the newly added task,
if yes, determining that the ancestor task identifier of the newly added task is the ancestor task identifier of the currently executed parent task, determining that the task depth of the newly added task is the sum of the task depth of the parent task and a first preset value, and determining that the total number of the sub tasks of the parent task is increased by one;
and if not, determining that the ancestor task identifier of the newly added task is the task identifier of the newly added task.
Optionally, the method further includes:
detecting whether a task state updating instruction is received;
if the task state updating instruction is received, extracting a task identifier of the newly added task from the incoming parameters of the newly added task, and determining task state information of the newly added task according to the task identifier of the newly added task;
acquiring task state information of a task to be updated, and changing the task state information of the task to be updated into task state information of the newly added task;
and executing a preset action corresponding to the task state information of the newly added task, wherein the task state information comprises a task completion state, a task failure state, a waiting subtask completion state, a to-be-executed state and an executing state.
Optionally, the executing the preset action corresponding to the task state information of the newly added task includes:
when the task state information of the newly added task is a task completion state or a task failure state,
setting the task ending time of the task to be updated as the current time;
judging whether the task to be updated has a parent task, if so, further judging whether task state information of the task to be updated is a task completion state or a task failure state, if so, acquiring the current state of the task to be updated and judging whether the task state information of the task to be updated is the same as the current state; if not, when the task state information of the newly added task is in a task completion state, determining that the success number of the subtasks in the parent task of the newly added task is increased by one, and when the task state information of the newly added task is in a task failure state, determining that the failure number of the subtasks in the parent task of the newly added task is increased by one.
Optionally, the executing the preset action corresponding to the task state information of the newly added task further includes:
when the task state information of the task to be updated is the same as the current state, further judging whether the execution of the sub task of the parent task of the newly added task is finished, if so, judging whether the parent task of the newly added task has a wrong sub task when the task state information of the task to be updated is a waiting sub task finishing state, if so, determining that the state of the parent task is a task failure state, and if not, determining that the state of the parent task is a task finishing state;
and when the task state information of the task to be updated is different from the current state, determining that the task state information of the task to be updated is in an executing state, and determining that the task state information of the task to be updated is the current state.
Optionally, the executing the preset action corresponding to the task state information of the newly added task further includes:
when the task state information of the newly added task is a waiting subtask completion state,
setting the task ending time of the task to be updated as the current time;
and judging whether all subtasks in the task to be updated are executed, if so, judging whether the subtasks which are failed to be executed exist, if so, determining that the task state information of the task to be updated is a task failure state, and if not, determining that the task state information of the task to be updated is a task completion state.
Optionally, the executing the preset action corresponding to the task state information of the newly added task further includes:
judging whether the task state information of the newly added task is in an executing state, if so, setting the task starting time of the task to be updated as the current time, and if not, judging whether the task state information of the task to be updated is in a task completing state or a task failing state;
when the task state information of the task to be updated is a task completion state or a task failure state, judging whether the task to be updated has a parent task, if so, continuously judging the task state information of the task to be updated, when the task state information of the task to be updated is the task completion state, determining that the success number of the child tasks of the parent task of the newly added task is reduced by one, and when the task state information of the task to be updated is the task failure state, determining that the failure number of the child tasks of the parent task of the newly added task is reduced by one;
and acquiring task state information of the parent task of the newly added task, judging whether the task state information of the parent task of the newly added task is in a task completion state or a task failure state, and if so, determining that the state of the parent task of the newly added task is in a waiting subtask completion state.
In summary, the present invention provides a task state processing method, which pre-configures parameter information of each task, then obtains incoming parameter information of a newly added task, defines a task state of the newly added task as a to-be-executed state, and determines an ancestor task identifier of the newly added task by using a relationship identifier between a parent task and a child task in the incoming parameter of the newly added task. Specifically, whether the parent task of the newly added task is included in the currently executed task is judged according to the relationship identification of the parent task and the sub-task in the transmitted parameters of the newly added task, if yes, the ancestor task identification of the newly added task is determined to be the ancestor task identification of the currently executed parent task, the task depth of the newly added task is determined to be the sum of the task depth of the parent task and a first preset value, and the total number of the sub-tasks of the parent task is determined to be increased by one. And if not, determining that the ancestor task identifier of the newly added task is the task identifier of the newly added task.
Therefore, the task state processing method provided by the embodiment considers the relationship between the subtask and the parent task, and when the subtask is added, the total number of the subtasks of the parent task is automatically updated.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include forms of volatile memory in a computer readable medium, Random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). The memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
It should also be noted that 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.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The above are merely examples of the present application and are not intended to limit the present application. Various modifications and changes may occur to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.

Claims (9)

1. A task state processing method is characterized in that parameters of each task are configured in advance, the parameters comprise one or more of task identification, relationship identification of a parent task and a subtask, task names, task state information, task starting time, task ending time, task storage configuration information, the total number of subtasks, the failure number of the subtasks, the success number of the subtasks, task type information, task depth, ancestor task identification, task error information and task creator information, and the task state processing method comprises the following steps:
acquiring incoming parameters of the newly added task, wherein the incoming parameters at least comprise relationship identifications of a parent task and a child task;
defining the task state of the newly added task as a state to be executed;
determining an ancestor task identifier of the newly added task according to the relationship identifier of the parent task and the subtask in the incoming parameters of the newly added task;
detecting whether a task state updating instruction is received;
if the task state updating instruction is received, extracting a task identifier of the newly added task from the incoming parameters of the newly added task, and determining task state information of the newly added task according to the task identifier of the newly added task;
acquiring task state information of a task to be updated, and changing the task state information of the task to be updated into task state information of the newly added task;
and executing a preset action corresponding to the task state information of the newly added task, wherein the task state information comprises a task completion state, a task failure state, a waiting subtask completion state, a to-be-executed state and an executing state.
2. The task state processing method according to claim 1, wherein the determining, according to the relationship identifier between the parent task and the child task in the incoming parameter of the newly added task, the ancestor task identifier of the newly added task includes:
judging whether the current executed task contains the parent task of the newly added task or not according to the relation identification of the parent task and the sub task in the incoming parameters of the newly added task,
if yes, determining that the ancestor task identifier of the newly added task is the ancestor task identifier of the currently executed parent task, determining that the task depth of the newly added task is the sum of the task depth of the parent task and a first preset value, and determining that the total number of the sub tasks of the parent task is increased by one;
and if not, determining that the ancestor task identifier of the newly added task is the task identifier of the newly added task.
3. The task state processing method according to claim 1, wherein the executing the preset action corresponding to the task state information of the newly added task includes:
when the task state information of the newly added task is a task completion state or a task failure state, setting the task ending time of the task to be updated as the current time;
judging whether the task to be updated has a parent task, if so, further judging whether task state information of the task to be updated is a task completion state or a task failure state, if so, acquiring the current state of the task to be updated and judging whether the task state information of the task to be updated is the same as the current state; if not, when the task state information of the newly added task is in a task completion state, determining that the success number of the subtasks in the parent task of the newly added task is increased by one, and when the task state information of the newly added task is in a task failure state, determining that the failure number of the subtasks in the parent task of the newly added task is increased by one.
4. The task state processing method according to claim 1, wherein the executing of the preset action corresponding to the task state information of the newly added task further comprises:
when the task state information of the task to be updated is the same as the current state, further judging whether the execution of the sub task of the parent task of the newly added task is finished, if so, judging whether the parent task of the newly added task has a wrong sub task when the task state information of the task to be updated is a waiting sub task finishing state, if so, determining that the state of the parent task is a task failure state, and if not, determining that the state of the parent task is a task finishing state;
and when the task state information of the task to be updated is different from the current state, determining that the task state information of the task to be updated is in an executing state, and determining that the task state information of the task to be updated is the current state.
5. The task state processing method according to claim 1, wherein the executing of the preset action corresponding to the task state information of the newly added task further comprises:
when the task state information of the newly added task is a waiting subtask completion state, setting the task ending time of the task to be updated as the current time;
and judging whether all subtasks in the task to be updated are executed, if so, judging whether the subtasks which are failed to be executed exist, if so, determining that the task state information of the task to be updated is a task failure state, and if not, determining that the task state information of the task to be updated is a task completion state.
6. The task state processing method according to claim 1, wherein the executing of the preset action corresponding to the task state information of the newly added task further comprises:
judging whether the task state information of the newly added task is in an executing state, if so, setting the task starting time of the task to be updated as the current time, and if not, judging whether the task state information of the task to be updated is in a task completing state or a task failing state;
when the task state information of the task to be updated is a task completion state or a task failure state, judging whether the task to be updated has a parent task, if so, continuously judging the task state information of the task to be updated, when the task state information of the task to be updated is the task completion state, determining that the success number of the child tasks of the parent task of the newly added task is reduced by one, and when the task state information of the task to be updated is the task failure state, determining that the failure number of the child tasks of the parent task of the newly added task is reduced by one;
and acquiring task state information of the parent task of the newly added task, judging whether the task state information of the parent task of the newly added task is in a task completion state or a task failure state, and if so, determining that the state of the parent task of the newly added task is in a waiting subtask completion state.
7. A task state processing apparatus, wherein parameters of each task are configured in advance, the parameters include one or more of a task identifier, a relationship identifier between a parent task and a child task, a task name, task state information, task start time, task end time, task storage configuration information, a total number of child tasks, a number of failures of the child tasks, a number of successes of the child tasks, task type information, task depth, an ancestor task identifier, task error information, and task creator information, and the task state processing apparatus includes:
the system comprises a first acquisition module, a second acquisition module and a third acquisition module, wherein the first acquisition module is used for acquiring incoming parameters of a newly added task, and the incoming parameters at least comprise relationship identifiers of a parent task and a child task;
the defining module is used for defining the task state of the newly added task as a state to be executed;
the determining module is used for determining an ancestor task identifier of the newly added task according to the relationship identifier of the parent task and the subtask in the transmitted parameters of the newly added task;
the task state processing device is also used for detecting whether a task state updating instruction is received; if the task state updating instruction is received, extracting a task identifier of the newly added task from the incoming parameters of the newly added task, and determining task state information of the newly added task according to the task identifier of the newly added task; acquiring task state information of a task to be updated, and changing the task state information of the task to be updated into task state information of the newly added task; and executing a preset action corresponding to the task state information of the newly added task, wherein the task state information comprises a task completion state, a task failure state, a waiting subtask completion state, a to-be-executed state and an executing state.
8. A task state processing system, comprising:
a memory for storing a program;
a processor for executing the program, which when executed performs the task state processing method of any of claims 1-7.
9. A storage medium characterized by storing a program which, when executed by a processor, implements the task state processing method according to any one of claims 1 to 7.
CN201710873333.9A 2017-09-25 2017-09-25 Task state processing method, device and system and storage medium Active CN109582396B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710873333.9A CN109582396B (en) 2017-09-25 2017-09-25 Task state processing method, device and system and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710873333.9A CN109582396B (en) 2017-09-25 2017-09-25 Task state processing method, device and system and storage medium

Publications (2)

Publication Number Publication Date
CN109582396A CN109582396A (en) 2019-04-05
CN109582396B true CN109582396B (en) 2022-02-18

Family

ID=65912316

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710873333.9A Active CN109582396B (en) 2017-09-25 2017-09-25 Task state processing method, device and system and storage medium

Country Status (1)

Country Link
CN (1) CN109582396B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111679899B (en) * 2020-06-09 2023-05-23 微医云(杭州)控股有限公司 Task scheduling method, device, platform equipment and storage medium
CN112416451B (en) * 2020-10-15 2022-11-11 福建升腾资讯有限公司 Method, device and medium for automatically converting issue state based on JIRA system

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101464811A (en) * 2008-12-29 2009-06-24 艾默生网络能源有限公司 Multitask monitoring management system
CN102630316A (en) * 2011-12-22 2012-08-08 华为技术有限公司 Processing method and apparatus of concurrent tasks
CN103034554A (en) * 2012-12-30 2013-04-10 焦点科技股份有限公司 ETL (Extraction-Transformation-Loading) dispatching system and method for error-correction restarting and automatic-judgment starting
CN104536814A (en) * 2015-01-16 2015-04-22 北京京东尚科信息技术有限公司 Method and system for processing workflow
CN105511975A (en) * 2015-11-27 2016-04-20 北京奇虎科技有限公司 Exception handling method and device
CN106325989A (en) * 2016-08-17 2017-01-11 东软集团股份有限公司 Task execution method and device
CN107015853A (en) * 2016-10-10 2017-08-04 阿里巴巴集团控股有限公司 The implementation method and device of phased mission system

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090260011A1 (en) * 2008-04-14 2009-10-15 Microsoft Corporation Command line transactions
CN103150620A (en) * 2011-12-07 2013-06-12 徐翔 Project decomposition processing method and system
KR20130115574A (en) * 2012-04-12 2013-10-22 삼성전자주식회사 Method and apparatus for performing a task scheduling in a terminal
CN102999385B (en) * 2012-11-06 2016-05-25 国网山东省电力公司枣庄供电公司 Multiprocessor cooperative processing method in computing equipment
CN104657212B (en) * 2015-02-13 2018-02-16 北京亚信数据有限公司 A kind of method and system of task scheduling
US10338959B2 (en) * 2015-07-13 2019-07-02 Microsoft Technology Licensing, Llc Task state tracking in systems and services
CN106296129A (en) * 2016-08-16 2017-01-04 天脉聚源(北京)传媒科技有限公司 A kind of status indicator method and device

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101464811A (en) * 2008-12-29 2009-06-24 艾默生网络能源有限公司 Multitask monitoring management system
CN102630316A (en) * 2011-12-22 2012-08-08 华为技术有限公司 Processing method and apparatus of concurrent tasks
CN103034554A (en) * 2012-12-30 2013-04-10 焦点科技股份有限公司 ETL (Extraction-Transformation-Loading) dispatching system and method for error-correction restarting and automatic-judgment starting
CN104536814A (en) * 2015-01-16 2015-04-22 北京京东尚科信息技术有限公司 Method and system for processing workflow
CN105511975A (en) * 2015-11-27 2016-04-20 北京奇虎科技有限公司 Exception handling method and device
CN106325989A (en) * 2016-08-17 2017-01-11 东软集团股份有限公司 Task execution method and device
CN107015853A (en) * 2016-10-10 2017-08-04 阿里巴巴集团控股有限公司 The implementation method and device of phased mission system

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
Evaluation of operator competence to identify system state in conditioning automated processes;Yukio Horiguchi;《2009 ICCAS-SICE》;20091113;4166-4171 *
分布式计算框架Antnest的任务调度设计与实现;王同欣;《中国优秀硕士学位论文全文数据库 信息科技辑》;20130715(第07期);I137-133 *

Also Published As

Publication number Publication date
CN109582396A (en) 2019-04-05

Similar Documents

Publication Publication Date Title
KR102354536B1 (en) Hyperledger fabric network creation method, controller and storage medium
US9535754B1 (en) Dynamic provisioning of computing resources
CN110868763B (en) Method, device and system for establishing Bluetooth connection
CN106708587B (en) Parameter configuration method and system
CN109669631B (en) Storage pool planning method, device, equipment and computer readable storage medium
CN105704188A (en) Deployment method and apparatus of applications and services
CN109582396B (en) Task state processing method, device and system and storage medium
CN107179982B (en) Cross-process debugging method and device
EP3413149A1 (en) Field device commissioning system and field device commissioning method
CN110895544B (en) Interface data processing method, device, system and storage medium
CN110837446A (en) Equipment management method and device applied to embedded system, medium and embedded equipment
CN115632944B (en) Node configuration method, device, equipment, readable storage medium and server
CN109683887B (en) Construction method and device supporting multi-scheme user-defined web project
CN111324373B (en) Method and device for sub-coding warehouse on multiple engineering files and computing equipment
CN107291439B (en) Target incremental data construction method and device
CN110020288A (en) A kind of page furbishing method and device
CN111400245B (en) Art resource migration method and device
CN109299125B (en) Database updating method and device
CN112445600A (en) Method and system for issuing offline data processing task
CN109561121B (en) Method and device for monitoring deployment
CN112667463A (en) Application system baseline state monitoring method and device
CN110908876B (en) Method and device for acquiring hardware performance data
CN109600245B (en) Automatic configuration method and device for server
CN110704818A (en) User information modification method and device
CN112559444A (en) SQL (structured query language) file migration method and device, storage medium and 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
CB02 Change of applicant information

Address after: 100080 No. 401, 4th Floor, Haitai Building, 229 North Fourth Ring Road, Haidian District, Beijing

Applicant after: Beijing Guoshuang Technology Co.,Ltd.

Address before: 100086 Beijing city Haidian District Shuangyushu Area No. 76 Zhichun Road cuigongfandian 8 layer A

Applicant before: Beijing Guoshuang Technology Co.,Ltd.

CB02 Change of applicant information
GR01 Patent grant
GR01 Patent grant