CN109684095B - Task processing method and task distribution equipment - Google Patents

Task processing method and task distribution equipment Download PDF

Info

Publication number
CN109684095B
CN109684095B CN201811602354.8A CN201811602354A CN109684095B CN 109684095 B CN109684095 B CN 109684095B CN 201811602354 A CN201811602354 A CN 201811602354A CN 109684095 B CN109684095 B CN 109684095B
Authority
CN
China
Prior art keywords
task
processing
processed
result
processing result
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
CN201811602354.8A
Other languages
Chinese (zh)
Other versions
CN109684095A (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 QIYI Century Science and Technology Co Ltd
Original Assignee
Beijing QIYI Century Science and 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 QIYI Century Science and Technology Co Ltd filed Critical Beijing QIYI Century Science and Technology Co Ltd
Priority to CN201811602354.8A priority Critical patent/CN109684095B/en
Publication of CN109684095A publication Critical patent/CN109684095A/en
Application granted granted Critical
Publication of CN109684095B publication Critical patent/CN109684095B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

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

Landscapes

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

Abstract

The embodiment of the invention discloses a task processing method and task allocation equipment, under the condition of obtaining a first processing result after a first task processing equipment processes a task to be processed, if the first processing result shows that the task to be processed fails, the task to be processed is allocated to other task processing equipment for processing, a second processing result after the task to be processed is obtained by other task processing equipment, if the first processing result is different from the second processing result, the second processing result is determined as the processing result of the task to be processed, and if the first processing result is the same as the second processing result, the first processing result is determined as the processing result of the task to be processed. Therefore, when any task processing device fails to process the task to be processed, the same task to be processed can be processed again through other task processing devices, and the accuracy of the processing result of the task to be processed is improved through multiple processing of the same task to be processed.

Description

Task processing method and task distribution equipment
Technical Field
The present invention belongs to the field of task processing technologies, and in particular, to a task processing method and a task allocation device.
Background
Currently, a task to be processed requested by a user may be distributed to a slave server (which may be regarded as a task processing device) through a master server (which may be regarded as a task distribution device), the slave server processes the task to be processed to obtain a processing result, and then the master server notifies the user of the processing result.
However, when the master server receives the processing result transmitted from any one of the slave servers, the master server directly notifies the user of the processing result, and thus, if the processing result is incorrect, the master server cannot recognize the error.
Disclosure of Invention
In view of the above, the present invention provides a task processing method and a task allocation apparatus, which are used to improve the accuracy of processing results. The technical scheme is as follows:
a task processing method is applied to task allocation equipment and comprises the following steps:
acquiring a first processing result of a first task processing device after processing a task to be processed;
when the first processing result shows that the task to be processed fails, the task to be processed is distributed to other task processing equipment, and the task to be processed is processed again by the other task processing equipment;
obtaining a second processing result of the other task processing devices after processing the task to be processed;
determining any one of the first processing result and the second processing result as the processing result of the task to be processed when the first processing result and the second processing result are the same;
and when the first processing result and the second processing result are different, determining the second processing result as the processing result of the task to be processed.
Optionally, when the first processing result indicates that the task to be processed fails, allocating the task to be processed to other task processing devices includes:
and when the first processing result shows that the task to be processed fails, determining whether the task to be processed fails due to the task processing environment of the first task processing device, and if so, distributing the task to be processed to other task processing devices.
Optionally, the method further includes: acquiring task processing information of the first task processing equipment for processing the task to be processed;
the determining whether the pending task failure was caused by a task processing environment of the first task processing device comprises:
when the processing duration in the task processing information is shorter than a preset duration, determining that the task to be processed fails due to a task processing environment of the first task processing device;
or
When the task processing information contains a preset keyword, determining that the task to be processed fails due to a task processing environment of the first task processing device;
or
Determining whether the task failure rate of the first task processing device recorded in the task allocation device is higher than a preset failure rate or not based on the device identifier of the first task processing device in the task processing information, and if so, determining that the task failure to be processed is caused by the task processing environment of the first task processing device;
alternatively, the first and second electrodes may be,
when the processing time in the task processing information is shorter than a preset time and the task processing information contains a preset keyword, determining that the task to be processed fails due to a task processing environment of the first task processing device;
alternatively, the first and second electrodes may be,
when the processing time in the task processing information is less than a preset time and the task failure rate of the first task processing device recorded in the task allocation device is higher than a preset failure rate, determining that the task failure to be processed is caused by the task processing environment of the first task processing device, wherein the task failure rate of the first task processing device is determined by the task allocation device based on the device identifier of the first task processing device in the task processing information.
Optionally, the method further includes: and when the processing time length is greater than or equal to the preset time length, determining the first processing result as the processing result of the task to be processed.
Optionally, the task allocation device is a master server, the task processing device is a slave server, and the task to be processed is a software project construction task.
A task distribution apparatus, the task distribution apparatus comprising: a first result obtaining unit, a task assigning unit, a second result obtaining unit, a first result determining unit, and a second result determining unit,
the first result obtaining unit is used for obtaining a first processing result after the first task processing device processes the task to be processed;
the task allocation unit is used for allocating the task to be processed to other task processing equipment when the first processing result shows that the task to be processed fails, and processing the task to be processed again by the other task processing equipment;
the second result obtaining unit is configured to obtain a second processing result obtained after the other task processing devices process the task to be processed;
the first result determining unit is configured to determine, when the first processing result and the second processing result are the same, any one of the first processing result and the second processing result as a processing result of the task to be processed;
the second result determining unit is configured to determine the second processing result as the processing result of the to-be-processed task when the first processing result and the second processing result are different.
Optionally, the task allocation unit is specifically configured to: and when the first processing result shows that the task to be processed fails, determining whether the task to be processed fails due to a task processing environment of the first task processing device, and if so, distributing the task to be processed to other task processing devices.
Optionally, the task allocation device further includes: an information obtaining unit, configured to obtain task processing information of the first task processing device for processing the to-be-processed task;
the task allocation unit determines whether the task to be processed fails due to the task processing environment of the first task processing device, and specifically sets: when the processing duration in the task processing information is shorter than a preset duration, determining that the task to be processed fails due to a task processing environment of the first task processing device;
or
When the task processing information contains a preset keyword, determining that the task to be processed fails due to a task processing environment of the first task processing device;
or
Determining whether the task failure rate of the first task processing device recorded in the task allocation device is higher than a preset failure rate or not based on the device identifier of the first task processing device in the task processing information, and if so, determining that the task failure to be processed is caused by the task processing environment of the first task processing device;
alternatively, the first and second electrodes may be,
when the processing time in the task processing information is shorter than a preset time and the task processing information contains a preset keyword, determining that the task to be processed fails due to a task processing environment of the first task processing device;
alternatively, the first and second electrodes may be,
when the processing time in the task processing information is less than a preset time and the task failure rate of the first task processing device recorded in the task allocation device is higher than a preset failure rate, determining that the task failure to be processed is caused by the task processing environment of the first task processing device, wherein the task failure rate of the first task processing device is determined by the task allocation device based on the device identifier of the first task processing device in the task processing information.
Optionally, the task allocation device further includes: and the third result determining unit is used for determining the first processing result as the processing result of the task to be processed when the processing time length is greater than or equal to the preset time length.
Optionally, the task allocation device is a master server, the task processing device is a slave server, and the task to be processed is a software project construction task.
As can be seen from the foregoing technical solutions, in the case that a first processing result obtained after the first task processing device processes the task to be processed is obtained, if the first processing result indicates that the task to be processed fails, the task to be processed is allocated to another task processing device for processing, a second processing result obtained after the task to be processed is obtained by another task processing device, if the first processing result is different from the second processing result, the second processing result is determined as the processing result of the task to be processed, and if the first processing result is the same as the second processing result, the first processing result is determined as the processing result of the task to be processed. Therefore, when any first task processing device fails to process the task to be processed, the same task to be processed can be processed again through other task processing devices, and the accuracy of the processing result of the task to be processed is improved through multiple processing of the same task to be processed.
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 introduced below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to these drawings without creative efforts.
FIG. 1 is a flowchart illustrating a task processing method according to an embodiment of the present invention;
FIG. 2 is a flowchart illustrating another task processing method according to an embodiment of the present invention;
FIG. 3 is a flowchart illustrating another task processing method according to an embodiment of the present invention;
FIG. 4 is a schematic flowchart of a task processing method applied to a master-slave architecture of Jenkins according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of a task allocation device according to an embodiment of the present invention.
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 some, but not all, embodiments of the present invention. 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.
As shown in fig. 1, which is a schematic flowchart of a task processing method disclosed in an embodiment of the present invention, configured to improve accuracy of a processing result of a task to be processed, where the task processing method is applied to a task allocation device, and includes the following steps:
s101: and obtaining a first processing result of the first task processing equipment after processing the task to be processed.
The task to be processed is a task to be processed that is allocated to the first task processing device by the task allocation device when receiving a task to be processed processing request sent by a user device (such as a terminal used by a user), and the task to be processed may be used to test an application program or a code corresponding to a function in the user device to verify whether the code is written correctly. Of course, the present embodiment may also perform other tests or other tasks through the task to be processed, which is not described in this embodiment.
Optionally, the task allocation device may be a master server, the task processing device may be a slave server, and the task to be processed may be a software project construction task. Optionally, the task allocation device and the task processing device of the present invention may be a master node and a slave node in Jenkins, respectively.
Jenkins is an open source software project, is a continuous integration tool developed based on Java, is used for monitoring continuous and repeated work, and aims to provide an open and easy-to-use software platform to enable continuous integration of software. Jenkins are usually deployed in a master-slave mode, wherein a master node is responsible for receiving a software project construction task, distributing the software project construction task to slave nodes, and constructing a software project by the slave nodes. If the slave node fails to process the task (i.e. fails to build the software project), the reason for the failure may be a problem of the software project code itself of the user or a problem of the task processing environment of the slave node, such as the inability to connect to an external network. If the task fails due to the task processing environment problem of the slave node, the method and the system can distribute the software project construction task to another slave node for processing without returning the processing result of the task processing failure to the user, so that the software project construction task can be successfully processed when the task processing environment problem does not exist in the other slave node. Therefore, the invention can return the processing result of 'successful task processing' to the user, and improves the accuracy of the processing result of the task to be processed.
S102: and when the first processing result shows that the task to be processed fails, distributing the task to be processed to other task processing equipment, and processing the task to be processed again by the other task processing equipment.
There may be two reasons for the pending task failing: one is the code itself cause and the other is the task processing environment problem of the first task processing device. The task processing environment may specifically include: both hardware and software environments, wherein a hardware environment may include: network environment and hardware configuration (e.g., memory space, processor performance, etc.), etc.; the software environment may include: an operating system, a software tool library, etc.
No matter which reason causes the task to be processed to fail, the task to be processed can be distributed to other task processing equipment, and the task to be processed is processed again by other task processing equipment, so that the task to be processed can be processed for multiple times. In practical applications, if the code itself causes the to-be-processed task to fail, the same processing result can be obtained no matter which task processing device the to-be-processed task is processed on, so that when the code itself causes the to-be-processed task to fail, the to-be-processed task can be abandoned on other task processing devices for processing again, so as to save device resources of other task processing devices.
In this embodiment, the other task processing device may be one task processing device (e.g., one slave node), or multiple task processing devices (e.g., multiple slave nodes). When the other task processing devices are multiple task processing devices, there are two ways for the multiple task processing devices to process the tasks to be processed:
one way is that: the task allocation device allocates the task to be processed to one of the task processing devices, the task processing device processes the task to be processed and returns the processing result of the task processing device, if the processing result of the task processing device still indicates that the task to be processed fails, the task to be processed is allocated to another task processing device of the task processing devices again, and if the processing result of the task processing device indicates that the task to be processed succeeds, the allocation is stopped. Further, if the processing result of the task processing device is different from the processing result of the previous task processing device in the reason that the reason for the failure of the task to be processed is indicated, the allocation can be stopped, so that the device resources of other task processing devices can be saved.
The other mode is as follows: the task allocation device simultaneously allocates the tasks to be processed to each of the plurality of task processing devices, and the task processing devices respectively perform primary processing on the tasks to be processed.
S103: and obtaining a second processing result after the other task processing devices process the task to be processed.
S104: and when the first processing result and the second processing result are the same, determining any one of the first processing result and the second processing result as the processing result of the task to be processed.
It can be understood that: the first processing result and the second processing result may have the same meaning as: the first processing result and the second processing result indicate that the status (failure or success) of the task to be processed is the same. In other embodiments of the present invention, the first processing result and the second processing result may have the same meaning as follows: the first processing result and the second processing result show that the states (failure or success) of the tasks to be processed are the same, and when the first processing result and the second processing result both show that the tasks to be processed fail, the failure reasons of the first processing result and the second processing result are the same. In this case, if the first processing result indicates that the reason for the to-be-processed task failing is caused by the task processing environment, and the second processing result also indicates that the reason for the to-be-processed task failing is caused by the task processing environment, the first processing result and the second processing result are considered to be the same. If the two processing results are the same, any one of the two processing results may be determined as the processing result of the task to be processed, for example, the first processing result may be determined as the processing result of the task to be processed.
In this embodiment, the status of the to-be-processed task and the failure reason indicated by the first processing result and the second processing result may be determined by the task processing information returned by the first task processing device after processing the to-be-processed task, and details of this embodiment will not be described again.
S105: and when the first processing result and the second processing result are different, determining the second processing result as the processing result of the task to be processed.
It can be understood that: the different meaning of the first processing result and the second processing result may be: the first processing result and the second processing result indicate that the status (failure or success) of the task to be processed is different. In other embodiments of the present invention, the different meaning of the first processing result and the second processing result may also be: and under the condition that the first processing result and the second processing result both indicate that the state of the task to be processed is failure, the failure reasons of the first processing result and the second processing result are different. At this time, if the first processing result indicates that the reason that the to-be-processed task fails is caused by the task processing environment, and the second processing result indicates that the reason that the to-be-processed task fails is caused by the problem of the code itself, the second processing result is determined as the processing result of the to-be-processed task at this time, depending on the difference between the first processing result and the second processing result.
As can be seen from the foregoing technical solutions, in the task processing method provided in the embodiments of the present invention, when a first processing result obtained after a first task processing device processes a to-be-processed task is obtained, if the first processing result indicates that the to-be-processed task fails, the to-be-processed task is allocated to another task processing device for processing, and a second processing result obtained after the other task processing device processes the to-be-processed task is obtained, if the first processing result is different from the second processing result, the second processing result is determined as the processing result of the to-be-processed task, and if the first processing result is the same as the second processing result, the first processing result is determined as the processing result of the to-be-processed task. Therefore, when any first task processing device fails to process the task to be processed, the same task to be processed can be processed again through other task processing devices, and the accuracy of the processing result of the task to be processed is improved through multiple processing of the same task to be processed.
As shown in fig. 2, a flowchart of another task processing method provided in the embodiment of the present invention is shown, where the flowchart of the task processing method includes the following steps:
s201: the task allocation device receives a task to be processed sent by user equipment and allocates the task to be processed to the first task processing device.
S202: and the task allocation equipment receives a first processing result obtained after the first task processing equipment processes the task to be processed.
S203: and the task allocation equipment analyzes the first processing result to judge whether the task to be processed is successful. If the task to be processed is successful, step S208 is entered. If the second to-be-processed task fails, step S204 is performed.
Wherein the first processing result returned by the first task processing device may include: and if the return code indicates that the status of the to-be-processed task is a failure, the first processing result indicates that the to-be-processed task fails, the first task processing device means that the to-be-processed task is processed successfully.
In addition, the task processing information returned by the first task processing device may include, in addition to the first processing result: a code repository corresponding to the task to be processed, success or error information (e.g., an error code), a processing duration of the task to be processed, and an identification of a task processing device that processes the task to be processed (i.e., an identification of the first task processing device). The success or error information is used to indicate a success or error reason, the processing time of the to-be-processed task is a time used by the first task processing device to process the to-be-processed task, and generally, when the processing result is a processing failure, if the processing time of the to-be-processed task is short, it can be considered that the to-be-processed task failure is caused by a task processing environment of the first task processing device (the task cannot be processed due to the task processing environment; when the code has a problem, the task may be executed for a period of time until the task is executed to the problematic code, and the error occurs, so that the task cannot be continuously executed).
The points to be explained here are: the task processing device returns the task processing information when processing one task to be processed, so that the task distribution device can analyze the task processing device based on a plurality of historical task processing information of the task processing device and/or analyze the reason indicating the failure of processing the task in the plurality of historical task processing information.
For example, through analyzing and discovering a plurality of historical task processing information of the same task processing device: if a preset number of pieces of historical task processing information in the plurality of pieces of historical task processing information indicate that the processing task fails, determining that the task processing device is a device with a high failure rate, for example, analyzing and discovering the historical task processing information of the same task processing device: the reasons for the failure of the treatment are: the reasons for lack of xxx tools, no xxx library found, no start-up, etc. can be considered as being caused by the task processing environment, so that the contents can be considered as preset keywords for the failure of the processing task caused by the task processing environment, so as to determine whether the failure of the subsequent processing task is originally caused by the task processing environment through the preset keywords.
S204: the method comprises the steps of judging whether a reason for the failure of the task to be processed is caused by a task processing environment of a first task processing device or not based on task processing information of the task to be processed by the first task processing device. If the reason for the failure of the task to be processed is not caused by the task processing environment of the first task processing device, the process proceeds to step S208. If the reason for the failure of the task to be processed is the task processing environment of the first task processing device, the process proceeds to step S205.
In this embodiment, the manner of determining that the pending task failure is caused by the task processing environment of the first task processing device includes, but is not limited to, the following manners:
the first mode is as follows: and when the processing duration in the task processing information is less than a preset duration, determining that the task to be processed fails due to a task processing environment of the first task processing device.
If the processing time length is less than the preset time length, it indicates that the first task processing device fails to process the initial segment of the task to be processed, and the probability of the code error corresponding to the initial segment of the task to be processed is small, so that the task to be processed is considered to have failed in this case and is caused by the task processing environment of the first task processing device, where the preset time length may be determined according to the actual application, and the present embodiment is not limited.
The second mode is as follows: and when the task processing information contains preset keywords, determining that the task to be processed fails due to the task processing environment of the first task processing equipment.
If the success or error information in the task processing information includes the preset keyword, it is determined that the task processing environment of the first task processing device has failed, and the preset keyword is not limited to the description of the embodiment, and may be set according to an actual application, which is not limited to this embodiment. The preset keyword may be a preset error code or a preset error type identifier, it can be understood that the error code and the error type identifier may represent error types, and some error types are errors caused by the task processing environment.
The third mode is as follows: and determining whether the task failure rate of the first task processing device recorded in the task allocation device is higher than a preset failure rate or not based on a first task processing device identifier in the task processing information, and if so, determining that the task failure to be processed is caused by the task processing environment of the first task processing device.
The predetermined failure rate may be determined according to practical applications, and is not limited in this embodiment. It is of course understood from the above explanation that it can be determined whether the first task processing device is a device whose task failure rate is higher than a preset failure rate (high failure rate) by the history task processing information of the first task processing device. The task allocation device may add, to the first task processing device, a flag indicating that the first task processing device is a device with a high failure rate if the first task processing device is a device with a high failure rate, so that whether the flag is added to the first task processing device in the task allocation device may be found based on the identifier of the first task processing device, and if the flag is added, it may be directly determined that the first processing result of the first task processing device is caused by the task processing environment of the first task processing device when the first processing result of the first task processing device indicates that the task to be processed fails.
Further, if the processing duration in the task processing information is greater than or equal to the preset duration, the present invention may determine the first processing result as the processing result of the task to be processed.
The fourth mode is that: when the processing time in the task processing information is shorter than a preset time and the task processing information contains a preset keyword, determining that the task to be processed fails due to a task processing environment of the first task processing device;
the fourth mode is a combination of the first mode and the second mode, and whether the task to be processed fails due to the task processing environment of the first task processing device is determined through the first mode and the second mode, so that the accuracy is higher.
The fifth mode is as follows: when the processing time in the task processing information is less than a preset time and the task failure rate of the first task processing device recorded in the task allocation device is higher than a preset failure rate, determining that the task failure to be processed is caused by the task processing environment of the first task processing device, wherein the task failure rate of the first task processing device is determined by the task allocation device based on the device identifier of the first task processing device in the task processing information.
The fifth mode is a combination of the first mode and the third mode, and whether the task to be processed fails due to the task processing environment of the first task processing device is determined through the first mode and the third mode, so that the accuracy is higher.
S205: the task allocation device allocates the task to be processed to other task processing devices, the other task processing devices process the task to be processed to obtain a second processing result, and the second processing result is sent to the task allocation device. For the analysis of the second processing result, please refer to the related description in the first processing result, which is not further described in this embodiment.
S206: and the task allocation equipment judges whether the first processing result is the same as the second processing result. If the first processing result is the same as the second processing result, the process proceeds to step S208. If the first processing result is not the same as the second processing result, the process proceeds to step S207. For the description that the first processing result and the second processing result are the same or different, refer to the related description in the previous embodiment, and this embodiment is not described here.
S207: and the task allocation equipment determines the second processing result as the processing result of the task to be processed and sends the processing result to the user equipment.
It should be noted that: the task allocation device may send the first processing result to an administrator device (i.e., a device used by an administrator) so that the administrator maintains the first task processing device corresponding to the first processing result.
S208: and the task allocation equipment determines any one of the first processing result and the second processing result as the processing result of the task to be processed, and sends the processing result to the user equipment.
According to the technical scheme, when the reason for the failure of the task to be processed is caused by the task processing environment of the first task processing device, whether the code corresponding to the task to be processed has a problem can be determined through the re-verification of the task to be processed by other task processing devices, so that the code corresponding to the task to be processed can be verified by other task processing devices under the condition that a certain task processing device has a problem, and the accuracy of the processing result of the task to be processed is improved.
Fig. 3 is a schematic flowchart of another task processing method according to an embodiment of the present invention, where the schematic flowchart of the task processing method includes the following steps:
s301: the task allocation device receives a task to be processed sent by user equipment and allocates the task to be processed to the first task processing device.
S302: and the task allocation equipment receives a first processing result obtained after the first task processing equipment processes the task to be processed.
S303: and the task allocation equipment analyzes the first processing result to judge whether the task to be processed is successful. If the task to be processed is successful, the process proceeds to step S309. If the task to be processed fails, step S304 is entered.
The above steps S301 to S303: this embodiment is not described again, as in steps S201 to S203.
S304: the task allocation device acquires the task processing information of the first task processing device for processing the task to be processed, and judges whether the processing time length in the task processing information is less than a preset time length. If so, the process proceeds to step S307. If not, the process proceeds to step S305. The preset time period is preset, and may be changed according to practical applications, which is not described in this embodiment.
If the processing time length is less than the preset time length, the first task processing device fails to process the initial segment of the task to be processed, and the probability of code errors corresponding to the initial segment of the task to be processed is low, so that the task to be processed can be directly regarded as the failure of the task to be processed and is caused by the task processing environment of the first task processing device, confirmation combined with other information is omitted, and the processing efficiency is improved.
S305: and judging whether the processing time length is less than a second preset time length. If the processing duration is less than the second preset duration, the process goes to step S306. If the processing duration is greater than or equal to the second preset duration, the process proceeds to step S309. The second preset time period is preset, and may be changed according to actual application, which is not described in this embodiment.
The points to be explained here are: when the processing time length is greater than or equal to the second preset time length, it is indicated that the processing time lengths of the task allocation device and the first task processing device may exceed or be close to the time required to return the processing result, at this time, the processing result of the task to be processed needs to be returned to the user equipment, so that it is ensured that the user experience is not affected even when the task to be processed is verified for multiple times.
S306: judging whether the task processing information contains preset keywords and/or whether a preset number of results in the historical task processing information of the first task processing device is found based on the first task processing device identification in the task processing information indicates that the processing task fails, if so, entering step S307; if not, the process proceeds to step S309.
In this embodiment, if the task processing information includes a preset keyword and/or a result of finding that a preset number exists in the historical task processing information of the first task processing device based on the first task processing device identifier in the task processing information indicates that the processing task fails, it indicates that the task failure to be processed is caused by the task processing environment of the first task processing device, at this time, step S307 is performed to perform the processing on the task to be processed again by other task processing devices, if the task processing information does not include the preset keyword and/or a result of finding that a preset number exists in the historical task processing information of the first task processing device based on the first task processing device identifier in the task processing information indicates that the processing task fails, it indicates that the task failure to be processed is not caused by the task processing environment of the first task processing device, at this time, step S309 may be entered to directly feed back the first processing result.
S307: and the task allocation equipment allocates the tasks to be processed to other task processing equipment, the other task processing equipment processes the tasks to be processed to obtain second processing results, and the second processing results are sent to the task allocation equipment.
S308: and the task allocation equipment judges whether the first processing result is the same as the second processing result. If the first processing result is the same as the second processing result, the process proceeds to step S309. If the first processing result is not the same as the second processing result, the process proceeds to step S310.
S309: and the task allocation equipment determines the first processing result as the processing result of the task to be processed and sends the processing result to the user equipment.
It should be noted that: the task allocation device may send the first processing result to an administrator device (i.e., a device used by an administrator) so that the administrator maintains the first task processing device corresponding to the first processing result.
S310: and the task allocation equipment determines the second processing result as the processing result of the task to be processed and sends the processing result to the user equipment.
The above steps S307 to S310: similar to the above steps S205 to S208, this embodiment will not be described again.
According to the technical scheme, whether to allocate the tasks to be processed to other task processing equipment is determined by combining the processing duration in the task processing information, whether the preset keywords are included and whether the result of finding the preset number indicates that the processing tasks fail, so that the accuracy of the processing result can be improved under the condition of improving the processing efficiency, and the user experience cannot be influenced.
The following provides a task processing method applied to a master-slave architecture of Jenkins, and as shown in fig. 4, the method may include:
s001, distributing a software project construction task to a first slave node by a master node;
s002, the master node obtains a first processing result after the first slave node processes the software project construction task;
s003, the master node determines whether the first processing result indicates that the software project construction task fails, and if so, the step S004 is executed; otherwise, executing step S014;
s004, the master node acquires task processing information of the first slave node for processing the software project construction task;
s005, the master node determines whether the processing time of the first slave node for processing the software project construction task is less than the preset time, and if so, the step S006 is executed; otherwise, executing step S014;
s006, the master node determines whether the task processing information contains a preset keyword, if so, the step S008 is executed; otherwise, executing step S007;
s007, determining whether the task failure rate of the first slave node is higher than a preset failure rate by the master node, and if so, executing the step S008; otherwise, executing step S014;
in other embodiments of the present invention, the contents of steps S007 and S006 may be exchanged, that is: step S006 is that the master node determines whether the task failure rate of the first slave node is higher than a preset failure rate, if so, the step S008 is executed; otherwise, step S007 "is performed. Meanwhile, step S007 determines whether the task processing information includes a preset keyword for the master node, and if so, performs step S008; otherwise, step S014 "is performed.
S008, determining that the failure of the software project construction task is caused by a task processing environment of the first slave node by the master node;
s009, the master node distributes the software project construction task to other slave nodes, and the other slave nodes process the software project construction task again;
s010, the master node obtains a second processing result after the other slave nodes process the software project construction task;
s011, determining whether the first processing result and the second processing result are the same by the master node, if so, executing step S012, and if not, executing step S013;
s012, the master determines any one of the first processing result and the second processing result as the processing result of the software project construction task and sends the processing result to user equipment;
and S013, the master node determines the second processing result as the processing result of the software project construction task and sends the processing result to user equipment.
And S014, the master node determines the first processing result as the processing result of the software project construction task and sends the processing result to user equipment.
Corresponding to the task processing method provided by the embodiment of the invention, the invention also provides a task allocation device.
As shown in fig. 5, a task allocation device provided in an embodiment of the present invention may include: a first result obtaining unit 100, a task assigning unit 200, a second result obtaining unit 300, a first result determining unit 400, and a second result determining unit 500,
the first result obtaining unit 100 is configured to obtain a first processing result obtained after the first task processing device processes the to-be-processed task;
optionally, the task allocation device may be a master server, the task processing device may be a slave server, and the task to be processed may be a software project construction task. Optionally, the task allocation device and the task processing device of the present invention may be a master node and a slave node in Jenkins, respectively.
The task allocation unit 200 is configured to, when the first processing result indicates that the to-be-processed task fails, allocate the to-be-processed task to other task processing devices, and process the to-be-processed task again by the other task processing devices;
there may be two reasons for the pending task failing: one is the code itself cause and the other is the task processing environment problem of the first task processing device. The task processing environment may specifically include: both hardware and software environments, wherein a hardware environment may include: network environment and hardware configuration (e.g., memory space, processor performance, etc.), etc.; the software environment may include: an operating system, a software tool library, etc.
The second result obtaining unit 300 is configured to obtain a second processing result obtained after the other task processing devices process the task to be processed;
the first result determining unit 400 is configured to determine, when the first processing result and the second processing result are the same, any one of the first processing result and the second processing result as the processing result of the task to be processed;
it can be understood that: the first processing result and the second processing result may have the same meaning as: the first processing result and the second processing result indicate that the status (failure or success) of the task to be processed is the same. In other embodiments of the present invention, the first processing result and the second processing result may have the same meaning as follows: the first processing result and the second processing result show that the states (failure or success) of the tasks to be processed are the same, and when the first processing result and the second processing result both show that the tasks to be processed fail, the failure reasons of the first processing result and the second processing result are the same.
The second result determining unit 500 is configured to determine the second processing result as the processing result of the to-be-processed task when the first processing result and the second processing result are different.
It can be understood that: the different meaning of the first processing result and the second processing result may be: the first processing result and the second processing result indicate that the status (failure or success) of the task to be processed is different. In other embodiments of the present invention, the different meaning of the first processing result and the second processing result may also be: and under the condition that the first processing result and the second processing result both indicate that the state of the task to be processed is failure, the failure reasons of the first processing result and the second processing result are different.
The task allocation unit 200 may specifically be configured to: and when the first processing result shows that the task to be processed fails, determining whether the task to be processed fails due to a task processing environment of the first task processing device, and if so, distributing the task to be processed to other task processing devices.
Further, the task assigning apparatus shown in fig. 5 may further include: an information obtaining unit, configured to obtain task processing information of the first task processing device for processing the to-be-processed task; on this basis, the task allocation unit 200 determines whether the task to be processed fails due to the task processing environment of the first task processing device, and may specifically set to:
when the processing duration in the task processing information is shorter than a preset duration, determining that the task to be processed fails due to a task processing environment of the first task processing device;
or
When the task processing information contains a preset keyword, determining that the task to be processed fails due to a task processing environment of the first task processing device;
or
Determining whether the task failure rate of the first task processing device recorded in the task allocation device is higher than a preset failure rate or not based on the device identifier of the first task processing device in the task processing information, and if so, determining that the task failure to be processed is caused by the task processing environment of the first task processing device;
alternatively, the first and second electrodes may be,
when the processing time in the task processing information is shorter than a preset time and the task processing information contains a preset keyword, determining that the task to be processed fails due to a task processing environment of the first task processing device;
alternatively, the first and second electrodes may be,
when the processing time in the task processing information is less than a preset time and the task failure rate of the first task processing device recorded in the task allocation device is higher than a preset failure rate, determining that the task failure to be processed is caused by the task processing environment of the first task processing device, wherein the task failure rate of the first task processing device is determined by the task allocation device based on the device identifier of the first task processing device in the task processing information.
The task processing information returned by the first task processing device may include, in addition to the first processing result: a code repository corresponding to the task to be processed, success or error information (e.g., an error code), a processing duration of the task to be processed, and an identification of a task processing device that processes the task to be processed (i.e., an identification of the first task processing device). The success or error information is used to indicate a success or error reason, the processing time of the to-be-processed task is a time used by the first task processing device to process the to-be-processed task, and generally, when the processing result is a processing failure, if the processing time of the to-be-processed task is short, it can be considered that the to-be-processed task failure is caused by a task processing environment of the first task processing device (the task cannot be processed due to the task processing environment; when the code has a problem, the task may be executed for a period of time until the task is executed to the problematic code, and the error occurs, so that the task cannot be continuously executed).
Specifically, if the processing time length is less than the preset time length, it is indicated that the first task processing device fails to process the initial segment of the task to be processed, and the probability of a code error corresponding to the initial segment of the task to be processed is small, so that in this case, the task to be processed is considered to have failed and is caused by the task processing environment of the first task processing device, where the preset time length may be determined according to an actual application, and the present embodiment is not limited.
The preset keyword may be a preset error code or a preset error type identifier, it can be understood that the error code and the error type identifier may represent error types, and some error types are errors caused by the task processing environment.
In other embodiments of the present invention, the task allocation device shown in fig. 5 may further include: and the third result determining unit is used for determining the first processing result as the processing result of the task to be processed when the processing time length is greater than or equal to the preset time length.
In the task allocation device provided in the embodiment of the present invention, when a first processing result obtained after a first task processing device processes a to-be-processed task is obtained, if the first processing result indicates that the to-be-processed task fails, the to-be-processed task is allocated to other task processing devices to be processed, a second processing result obtained after the other task processing devices process the to-be-processed task is obtained, if the first processing result is different from the second processing result, the second processing result is determined as a processing result of the to-be-processed task, and if the first processing result is the same as the second processing result, the first processing result is determined as a processing result of the to-be-processed task. Therefore, when any task processing device fails to process the task to be processed, the same task to be processed can be processed again through other task processing devices, and the accuracy of the processing result of the task to be processed is improved through multiple processing of the same task to be processed.
While, for purposes of simplicity of explanation, the foregoing method embodiments have been described as a series of acts or combination of acts, it will be appreciated by those skilled in the art that the present invention is not limited by the illustrated ordering of acts, as some steps may occur in other orders or concurrently with other steps in accordance with the invention. Further, those skilled in the art should also appreciate that the embodiments described in the specification are preferred embodiments and that the acts and modules referred to are not necessarily required by the invention.
It should be noted that, in the present specification, the embodiments are all described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments may be referred to each other. For the device-like embodiment, since it is basically similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
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 a process, method, article, or apparatus that comprises the element.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
The foregoing is only a preferred embodiment of the present invention, and it should be noted that, for those skilled in the art, various modifications and decorations can be made without departing from the principle of the present invention, and these modifications and decorations should also be regarded as the protection scope of the present invention.

Claims (6)

1. A task processing method is applied to a task allocation device, and comprises the following steps:
acquiring a first processing result of a first task processing device after processing a task to be processed;
when the first processing result shows that the task to be processed fails, determining whether the task to be processed fails due to a task processing environment of the first task processing device, if so, distributing the task to be processed to other task processing devices, and processing the task to be processed again by the other task processing devices;
obtaining a second processing result of the other task processing devices after processing the task to be processed;
determining any one of the first processing result and the second processing result as the processing result of the task to be processed when the first processing result and the second processing result are the same;
when the first processing result and the second processing result are different, determining the second processing result as the processing result of the task to be processed;
the method further comprises the following steps: acquiring task processing information of the first task processing equipment for processing the task to be processed;
the determining whether the pending task failure was caused by a task processing environment of the first task processing device comprises:
when the processing duration in the task processing information is shorter than a preset duration, determining that the task to be processed fails due to a task processing environment of the first task processing device;
or
When the task processing information contains a preset keyword, determining that the task to be processed fails due to a task processing environment of the first task processing device;
or
Determining whether the task failure rate of the first task processing device recorded in the task allocation device is higher than a preset failure rate or not based on the device identifier of the first task processing device in the task processing information, and if so, determining that the task failure to be processed is caused by the task processing environment of the first task processing device;
alternatively, the first and second electrodes may be,
when the processing time in the task processing information is shorter than a preset time and the task processing information contains a preset keyword, determining that the task to be processed fails due to a task processing environment of the first task processing device;
alternatively, the first and second electrodes may be,
when the processing time in the task processing information is less than a preset time and the task failure rate of the first task processing device recorded in the task allocation device is higher than a preset failure rate, determining that the task failure to be processed is caused by the task processing environment of the first task processing device, wherein the task failure rate of the first task processing device is determined by the task allocation device based on the device identifier of the first task processing device in the task processing information.
2. The method of claim 1, further comprising: and when the processing time length is greater than or equal to the preset time length, determining the first processing result as the processing result of the task to be processed.
3. The method according to claim 1, wherein the task distribution device is a master server, the task processing device is a slave server, and the task to be processed is a software project construction task.
4. A task allocation device, characterized in that the task allocation device comprises: a first result obtaining unit, a task assigning unit, a second result obtaining unit, a first result determining unit, and a second result determining unit,
the first result obtaining unit is used for obtaining a first processing result after the first task processing device processes the task to be processed;
the task allocation unit is configured to determine, when the first processing result indicates that the to-be-processed task fails, whether the to-be-processed task fails due to a task processing environment of the first task processing device, if so, allocate the to-be-processed task to another task processing device, and process the to-be-processed task again by the other task processing device;
the second result obtaining unit is configured to obtain a second processing result obtained after the other task processing devices process the task to be processed;
the first result determining unit is configured to determine, when the first processing result and the second processing result are the same, any one of the first processing result and the second processing result as a processing result of the task to be processed;
the second result determining unit is configured to determine the second processing result as the processing result of the to-be-processed task when the first processing result and the second processing result are different;
the task assigning apparatus further includes: an information obtaining unit, configured to obtain task processing information of the first task processing device for processing the to-be-processed task;
the task allocation unit determines whether the task to be processed fails due to the task processing environment of the first task processing device, and specifically sets: when the processing duration in the task processing information is shorter than a preset duration, determining that the task to be processed fails due to a task processing environment of the first task processing device;
or
When the task processing information contains a preset keyword, determining that the task to be processed fails due to a task processing environment of the first task processing device;
or
Determining whether the task failure rate of the first task processing device recorded in the task allocation device is higher than a preset failure rate or not based on the device identifier of the first task processing device in the task processing information, and if so, determining that the task failure to be processed is caused by the task processing environment of the first task processing device;
alternatively, the first and second electrodes may be,
when the processing time in the task processing information is shorter than a preset time and the task processing information contains a preset keyword, determining that the task to be processed fails due to a task processing environment of the first task processing device;
alternatively, the first and second electrodes may be,
when the processing time in the task processing information is less than a preset time and the task failure rate of the first task processing device recorded in the task allocation device is higher than a preset failure rate, determining that the task failure to be processed is caused by the task processing environment of the first task processing device, wherein the task failure rate of the first task processing device is determined by the task allocation device based on the device identifier of the first task processing device in the task processing information.
5. The task distribution apparatus of claim 4, further comprising: and the third result determining unit is used for determining the first processing result as the processing result of the task to be processed when the processing time length is greater than or equal to the preset time length.
6. The task allocation device according to claim 4, wherein the task allocation device is a master server, the task processing device is a slave server, and the task to be processed is a software project construction task.
CN201811602354.8A 2018-12-26 2018-12-26 Task processing method and task distribution equipment Active CN109684095B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811602354.8A CN109684095B (en) 2018-12-26 2018-12-26 Task processing method and task distribution equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811602354.8A CN109684095B (en) 2018-12-26 2018-12-26 Task processing method and task distribution equipment

Publications (2)

Publication Number Publication Date
CN109684095A CN109684095A (en) 2019-04-26
CN109684095B true CN109684095B (en) 2021-03-23

Family

ID=66189760

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811602354.8A Active CN109684095B (en) 2018-12-26 2018-12-26 Task processing method and task distribution equipment

Country Status (1)

Country Link
CN (1) CN109684095B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103902646A (en) * 2013-12-27 2014-07-02 北京天融信软件有限公司 Distributed task managing system and method
CN105893225A (en) * 2015-08-25 2016-08-24 乐视网信息技术(北京)股份有限公司 Automatic error processing method and device
CN107016479A (en) * 2016-01-28 2017-08-04 五八同城信息技术有限公司 Task scheduling and managing method, apparatus and system
US9794160B1 (en) * 2015-01-14 2017-10-17 Amdocs Software Systems Limited System, method, and computer program for testing composite services in a communication network utilizing test data
CN107688496A (en) * 2017-07-24 2018-02-13 上海壹账通金融科技有限公司 Task distribution formula processing method, device, storage medium and server
CN107908487A (en) * 2017-11-08 2018-04-13 中国平安人寿保险股份有限公司 Task control management method, device, equipment and computer-readable recording medium

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8904007B2 (en) * 2011-08-24 2014-12-02 Netapp, Inc. Connection distribution within a connectional parallelism architecture
US9594545B2 (en) * 2013-06-05 2017-03-14 Splunk Inc. System for displaying notification dependencies between component instances
CN104407847B (en) * 2014-10-29 2019-05-07 中国建设银行股份有限公司 A kind of method and device of batch processing
CN104572197B (en) * 2014-12-31 2018-09-04 北京奇虎科技有限公司 A kind for the treatment of method and apparatus of startup item
CN106293952B (en) * 2016-07-11 2019-06-21 河南大学 A kind of task based access control demand and the matched remote sensing method for scheduling task of service ability

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103902646A (en) * 2013-12-27 2014-07-02 北京天融信软件有限公司 Distributed task managing system and method
US9794160B1 (en) * 2015-01-14 2017-10-17 Amdocs Software Systems Limited System, method, and computer program for testing composite services in a communication network utilizing test data
CN105893225A (en) * 2015-08-25 2016-08-24 乐视网信息技术(北京)股份有限公司 Automatic error processing method and device
CN107016479A (en) * 2016-01-28 2017-08-04 五八同城信息技术有限公司 Task scheduling and managing method, apparatus and system
CN107688496A (en) * 2017-07-24 2018-02-13 上海壹账通金融科技有限公司 Task distribution formula processing method, device, storage medium and server
CN107908487A (en) * 2017-11-08 2018-04-13 中国平安人寿保险股份有限公司 Task control management method, device, equipment and computer-readable recording medium

Also Published As

Publication number Publication date
CN109684095A (en) 2019-04-26

Similar Documents

Publication Publication Date Title
WO2017140131A1 (en) Data writing and reading method and apparatus, and cloud storage system
US20150242200A1 (en) Re-configuration in cloud computing environments
EP3291592B1 (en) Monitoring management method and apparatus
CN113037522A (en) Container unit management method and related equipment
CN110995481A (en) Configuration method, server and computer-readable storage medium
CN113835844A (en) Management method and device of container cluster and cloud computing platform
CN111163140A (en) Method, apparatus and computer readable storage medium for resource acquisition and allocation
KR20180061589A (en) Software build system and software build method using the system
US10205545B2 (en) Resource creation method and apparatus
CN109684095B (en) Task processing method and task distribution equipment
CN110347492A (en) Distributed task dispatching method and apparatus based on time parameter method
CN112865993A (en) Method and device for switching slave nodes in distributed master-slave system
CN110708400A (en) Network address allocation method, device, node equipment and storage medium
CN112866062B (en) Distributed pressure test system, method, device, equipment and storage medium
CN111831504A (en) Monitoring method, monitoring apparatus, computer device, and medium
CN110955460B (en) Service process starting method and device, electronic equipment and storage medium
CN113051245A (en) Method, device and system for migrating data
CN111614701A (en) Distributed cluster and container state switching method and device
CN113032188A (en) Method, device, server and storage medium for determining main server
CN112306962B (en) File copying method, device and storage medium in computer cluster system
CN112860422B (en) Method, apparatus and computer program product for job processing
WO2021192318A1 (en) Verification device, verification system, verification method and computer readable medium
EP3346671A1 (en) Service processing method and equipment
CN114327673A (en) Task starting method and device, electronic equipment and storage medium
CN108933803B (en) Front-end equipment, cloud storage server, and streaming data direct storage method and system

Legal Events

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