Sub-node control method and device, electronic equipment and medium
By acquiring build task data and selecting appropriate recycling strategies to control the recycling of Jenkins child nodes, the bottleneck problem of child node creation time is solved, and system efficiency and resource utilization are improved.
Patent Information
- Application Number
- CN202211691492.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-27
- Publication Date
- 2025-11-04
- Estimated Expiration
- 2042-12-27
AI Technical Summary
When a large number of Jenkins child nodes are created and there is a lot of environment content, the time required to create child nodes becomes a system bottleneck, affecting system efficiency and causing resource waste.
By acquiring relevant data from the build task, a target recycling strategy is determined based on the data, and a suitable recycling strategy, such as delaying or immediately recycling child nodes, is selected to optimize the utilization efficiency of child nodes.
It improves the efficiency of child node utilization, maximizes the reuse of existing child nodes, alleviates the pressure during peak build periods, and improves system efficiency.
Smart Images

Figure CN116244070B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of computer, and in particular, to a child node control method and device, electronic equipment and medium. BACKGROUND
[0002] Jenkins is a commonly used continuous integration tool, aiming to provide an open and easy-to-use software platform to enable continuous integration of software projects, and can be used to manage distributed builds. Kubernetes is a portable, extensible open source platform for managing containerized workloads and services, which can promote declarative configuration and automation, and provides a framework for running distributed systems elastically. Jenkins and Kubernetes are combined, Jenkins child nodes are run in the Kubernetes environment, and Jenkins child nodes can be quickly managed according to business needs. Jenkins child nodes are used as containers in the Kubernetes environment, and the characteristics of one build and running anywhere of the container are used, so that Jenkins child nodes are temporarily created with the creation of each task, and are recycled with the end of the task. However, when the task amount is large or the environment content of the child node is required, the time of creating the child node becomes a prominent problem of the system, causing a system bottleneck and seriously affecting the working efficiency of the system. SUMMARY
[0003] To solve the above technical problems or at least partially solve the above technical problems, the embodiments of the present application provide a child node control method and device, electronic equipment and medium.
[0004] According to the first aspect of the present application, a child node control method is provided, comprising: obtaining related data of a received build task; determining a target recycling strategy from a candidate recycling strategy according to the related data of the received build task; and recycling a target child node according to the target recycling strategy, the target child node being a child node completing an allocated build task.
[0005] In an optional embodiment, determining a target recycling strategy from a candidate recycling strategy according to the related data of the received build task comprises: determining a task prediction quantity in a target time period according to the related data of the received build task; and determining a target recycling strategy from a candidate recycling strategy according to the task prediction quantity in the target time period.
[0006] In an optional embodiment, determining a task prediction quantity in a target time period according to the related data of the received build task comprises: determining a growth rate of build tasks in a unit time period according to a first quantity of received build tasks and a receiving time; and determining a task prediction quantity in a target time period according to the growth rate.
[0007] In an optional embodiment, determining the target recycling strategy from the candidate recycling strategies according to the task prediction in the target time period comprises: determining whether the task prediction in the target time period is greater than or equal to a first threshold; and in a case where the task prediction in the target time period is greater than or equal to the first threshold, determining that a delay recycling strategy in the candidate recycling strategies is the target recycling strategy corresponding to the current task state.
[0008] In an optional embodiment, the first threshold is determined according to a preset maximum number of sub-nodes.
[0009] In an optional embodiment, the method further comprises: in a case where the delay recycling strategy is taken as the target recycling strategy, counting a second number of construction tasks received in a unit time period; and determining whether to adjust the target recycling strategy according to the second number.
[0010] In an optional embodiment, the determining whether to adjust the target recycling strategy according to the second number comprises: in a case where the second number is greater than or equal to a second threshold, determining not to adjust the target recycling strategy; and in a case where the second number is less than the second threshold, determining that the direct recycling strategy is taken as the target recycling strategy.
[0011] In an optional embodiment, the second threshold is determined according to a preset maximum number of sub-nodes.
[0012] In an optional embodiment, determining the target recycling strategy from the candidate recycling strategies according to the relevant data of the received construction tasks comprises: determining a current task state according to the relevant data of the received construction tasks; and determining the target recycling strategy corresponding to the current task state from the candidate recycling strategies according to the current task state.
[0013] In an optional embodiment, the determining the current task state according to the relevant data of the received construction tasks comprises: determining whether a task surge occurs according to the first number and the receiving time of the received construction tasks; in a case where it is determined that the task surge occurs, determining that the current task state is a backlog state; and in a case where it is determined that the task surge does not occur, determining that the current task state is a space state.
[0014] In an optional embodiment, the determining whether the task surge occurs according to the first number and the receiving time of the received construction tasks comprises: determining whether a number of construction tasks received at the same time is greater than or equal to a third threshold according to the first number and the receiving time of the received construction tasks; and if the number of construction tasks received at the same time is greater than or equal to the third threshold, determining that the task surge occurs.
[0015] In an optional embodiment, the third threshold is determined according to a preset maximum number of sub-nodes.
[0016] In a second aspect, an embodiment of the present application provides a sub-node control apparatus, comprising: a data acquisition module configured to acquire related data of a received construction task; a strategy determination module configured to determine a target recycling strategy from candidate recycling strategies according to the related data of the received construction task; and a processing module configured to recycle a target sub-node according to the target recycling strategy, the target sub-node being a sub-node that completes an assigned construction task.
[0017] In an optional embodiment, the strategy determination module is further configured to: determine a task prediction quantity in a target time period according to the related data of the received construction task; and determine the target recycling strategy from the candidate recycling strategies according to the task prediction quantity in the target time period.
[0018] In an optional embodiment, the strategy determination module is further configured to: determine a growth speed of construction tasks in a unit time period according to a first number of received construction tasks and a receiving time; and determine a task prediction quantity in a target time period according to the growth speed.
[0019] In an optional embodiment, the strategy determination module is further configured to: determine whether the task prediction quantity in the target time period is greater than or equal to a first threshold; and determine a delay recycling strategy in the candidate recycling strategies as the target recycling strategy corresponding to the current task state in a case where the task prediction quantity in the target time period is greater than or equal to the first threshold.
[0020] In an optional embodiment, the strategy determination module is further configured to determine the first threshold according to a preset maximum number of sub-nodes.
[0021] In an optional embodiment, the strategy determination module is further configured to: in a case where the delay recycling strategy is taken as the target recycling strategy, count a second number of received construction tasks in a unit time period; and determine whether to adjust the target recycling strategy according to the second number.
[0022] In an optional embodiment, the strategy determination module is further configured to: in a case where the second number is greater than or equal to a second threshold, determine not to adjust the target recycling strategy; and in a case where the second number is less than the second threshold, determine to take the direct recycling strategy as the target recycling strategy.
[0023] In an optional embodiment, the strategy determination module is further configured to determine the second threshold according to a preset maximum number of sub-nodes.
[0024] In an optional embodiment, the policy determining module is further configured to determine a current task state according to the received data of the build task; and determine a target recycling policy corresponding to the current task state from the candidate recycling policies according to the current task state.
[0025] In an optional embodiment, the policy determining module is further configured to determine whether a task surge occurs according to the first number and the receiving time of the received build task; determine that the current task state is a backlog state if it is determined that the task surge occurs; and determine that the current task state is a space state if it is determined that the task surge does not occur.
[0026] In an optional embodiment, the policy determining module is further configured to determine whether the number of the received build tasks at the same time is greater than or equal to a third threshold according to the first number and the receiving time of the received build task; and determine that the task surge occurs if the number of the received build tasks at the same time is greater than or equal to the third threshold.
[0027] In an optional embodiment, the policy determining module is further configured to determine the third threshold according to the preset maximum number of the sub-nodes.
[0028] In a third aspect, an electronic device is provided, including: one or more processors; and a storage device configured to store one or more programs, when the one or more programs are executed by the one or more processors, the one or more processors implement the sub-node control method of any of the embodiments of the present application.
[0029] In a fourth aspect, a computer readable medium is provided, and the computer readable medium stores a computer program, when the computer program is executed by a processor, the computer program implements the sub-node control method of any of the embodiments of the present application.
[0030] An embodiment of the above application has the following advantages or beneficial effects:
[0031] The sub-node control method of the embodiments of the present application can determine a target recycling policy corresponding to the relevant data of the build task from the candidate recycling policies according to the relevant data of the received build task, and recycle the target sub-node of the completed build task according to the target recycling policy, so that the recycling policy can be selected and adjusted in real time according to different task data, the use efficiency of the sub-node is improved, the system efficiency is improved, the ability of reusing the built sub-node is maximized, the pressure during the build task peak is effectively relieved, and the peak shaving effect is achieved.
[0032] The further effects of the above non-conventional optional mode will be described in the following combined with the specific embodiments. BRIEF DESCRIPTION OF DRAWINGS
[0033] The accompanying drawings are used to better understand the present application, and do not constitute undue limitations on the present application. Among them:
[0034] Figure 1 A flow chart of a sub-node control method of an embodiment of the present application is shown;
[0035] Figure 2 A curve diagram showing the construction task changing over time is shown;
[0036] Figure 3 A flow chart of a sub-node control method of another embodiment of the present application is shown;
[0037] Figure 4 A curve diagram showing the total time of the construction task performed in the case of recycling of the sub-node controlled by the sub-node control method according to the embodiment of the present application is shown;
[0038] Figure 5 A flow chart of a sub-node control method of still another embodiment of the present application is shown;
[0039] Figure 6 A structural schematic diagram of a sub-node control device of an embodiment of the present application is shown;
[0040] Figure 7 A structural schematic diagram of an electronic device of an embodiment of the present application is shown. DETAILED DESCRIPTION
[0041] Exemplary embodiments of the present application are described below with reference to the accompanying drawings, which include various details of the embodiments of the present application to assist in understanding, and should be considered as merely exemplary. Therefore, those of ordinary skill in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present application. Also, descriptions of well-known functions and structures are omitted in the following description for clarity and conciseness.
[0042] Figure 1A flowchart of a subnode control method of an embodiment of the present application is shown. The method can be applied to a Jenkins system, and the subnode is a Jenkins subnode used to execute a build task. The subnode can be created as a new build task is created. In the related art, the subnode is also recycled as the build task is completed. However, when the amount of tasks is large or the environment of the subnode is required to be more complex, the time for creating the subnode becomes a bottleneck of the system. Moreover, continuously creating and recycling the subnode not only affects the working efficiency of the system, but also causes waste of resources. To solve the technical problem, the embodiment of the present application provides a subnode control method. The method controls recycling of the subnode according to different recycling strategies in different task data. Different recycling strategies are selected, for example, in a low task period, the subnode that has completed the build task is immediately recycled, and in a high task period, the subnode that has completed the build task is not immediately recycled, but is delayed to recycle the subnode that has completed the build task, so that the subnode that has completed the build task can be assigned a new build task. Thus, the time for creating the subnode is saved, the use efficiency of the created subnode is improved, the ability of reusing the created subnode is maximized, and the pressure during the build task peak is effectively alleviated. Specifically, as shown in Figure 1 the subnode control method includes:
[0043] Step S101: Obtain related data of a received build task.
[0044] The related data of the received build task can include, but is not limited to, the number of received build tasks and the receiving time.
[0045] In this embodiment, when a build task is received, the receiving time of the build task can be recorded, and the number of received build tasks can be counted. The number of received build tasks can be counted in a unit time period as a counting period. The unit time period can be flexibly set according to the scene requirement, which is not limited in the present application. Thus, the number of counted build tasks and the receiving time can be used to determine the current situation of the received build task, for example, whether the current situation is in a high task period or a low task period. Further, the number of build tasks in a future time period can be predicted according to the related data of the received build task, so as to determine whether the future time period is in a high task period or a low task period.
[0046] Step S102: Determine a target recycling strategy from candidate recycling strategies according to the related data of the received build task.
[0047] The candidate recovery strategy is used to control recovery of the target sub-node that has completed the assigned build task, for example, to control immediate recovery or delayed recovery of the target sub-node that has completed the assigned build task. As a specific example, the candidate recovery strategy can include, but is not limited to, an immediate recovery strategy and a delayed recovery strategy. The immediate recovery strategy is used to instruct immediate recovery of the target sub-node that has completed the assigned build task. The delayed recovery strategy is used to instruct delayed recovery of the target sub-node that has completed the assigned build task.
[0048] In an optional embodiment, a plurality of candidate recovery strategies can be pre-set, and different candidate recovery strategies correspond to different build task conditions, so that different candidate recovery strategies can be selected according to the relevant data of the currently received build task or the number of build tasks predicted in a future time period. As a specific example, if it is determined according to the relevant data of the currently received build task that the current time is a task peak period, the delayed recovery strategy can be selected as the target recovery strategy to delay recovery of the target sub-node that has completed the assigned build task, so that a newly received build task is scheduled to the target sub-node, and the newly received build task is executed by the target sub-node, thereby saving the time for creating a sub-node. If it is determined according to the relevant data of the currently received build task that the current time is a build task low-peak period, the sub-node can be immediately recovered after the sub-node completes the assigned build task, thereby releasing the resources occupied by the sub-node in time. If it is determined according to the relevant data of the currently received build task that the current time is a task low-peak period, but it is predicted according to the relevant data of the currently received build task that the future time period is a task peak period, the delayed recovery strategy can also be selected as the target recovery strategy.
[0049] Step S103: recovering the target sub-node according to the target recovery strategy, the target sub-node being a sub-node that has completed the assigned build task.
[0050] In this step, if the target recovery strategy is the immediate recovery strategy, the sub-node is immediately recovered when the sub-node completes the assigned build task. If the target recovery strategy is the delayed recovery strategy, the sub-node is delayed to be recovered when the sub-node completes the assigned build task.
[0051] The sub-node control method of the embodiment of the application can select a suitable recovery strategy and adjust the recovery strategy in real time according to different task data, thereby improving the use efficiency of the sub-node, maximizing the reuse of the built sub-node, effectively relieving the pressure during the build task peak period, and improving the system efficiency.
[0052] In optional embodiments, in the case of taking the delay recovery strategy as the target recovery strategy, the target child node that completes the assigned build task can be added to a queue, and a newly received build task is scheduled to the target child node in the queue. In other optional embodiments, the scheduling can also be performed according to the identification (or label) of the target child node, that is, after a newly received build task, the identification of the build task is determined by parsing the build task, and then the build task is scheduled to the target child node with the corresponding identification.
[0053] In the process of implementing the child node control method of the embodiments of the application, the inventors find that the number of build tasks has a significant peak period within a certain time, for example Figure 2 To alleviate the pressure of creating child nodes in the peak period of build tasks, the child node control method of the embodiments of the application can predict the peak period of build tasks according to the number of received build tasks, so as to adjust the child node recovery strategy, save the time of creating child nodes, and improve the system efficiency.
[0054] Figure 3 A flowchart of a child node control method of another embodiment of the application is shown in FIG. 8, which includes the following steps: Figure 3
[0055] Step S301: Obtain the related data of the received build task.
[0056] Step S302: Determine the task prediction quantity in a target time period according to the related data of the received build task.
[0057] Step S303: Determine the target recovery strategy from the candidate recovery strategies according to the task prediction quantity in the target time period.
[0058] Step S304: Recover the target child node according to the target recovery strategy, and the target child node is a child node that completes the assigned build task.
[0059] For step S301, in the case of receiving a build task, the receiving time of the build task can be recorded, and the number of received build tasks can be counted. The number of received build tasks can be counted in a unit time period. Therefore, the related data of the received build task includes the number of received build tasks in multiple unit time periods.
[0060] For step S302, the number of build tasks in the future time period is predicted according to the relevant data of the build tasks, so as to determine the trend of the build tasks in the future time period, that is, whether the build tasks in the future time period will increase. Specifically, according to the number of build tasks received in a plurality of unit time periods, the number of build tasks received in a target time period in the future is predicted, and the target time period can include one unit time period or a plurality of unit time periods.
[0061] In an optional embodiment, the number of build tasks received in a plurality of unit time periods can be fitted with a function, and the number of build tasks received in a target time period in the future is predicted according to the function fitted. According to the number and time of the received build tasks, if the number of build tasks received in the same interval time is increasing, it is determined that the trend of the build tasks is increasing, that is, more and more, and the delay recovery strategy can be used as the target recovery strategy.
[0062] In an optional embodiment, the growth rate of the build tasks can also be determined according to the first number and the receiving time of the received build tasks. According to the growth rate, the predicted number of tasks in the target time period is determined. For example, according to the number and the receiving time of the received build tasks, it is determined whether the number of build tasks received in the same interval time is gradually increasing. If the number of build tasks received in the same interval time is gradually increasing, the growth rate of the build tasks in the interval time is determined. According to the growth rate, the number of tasks in the future time period is predicted.
[0063] For step S303, it can be determined whether the predicted number of tasks in the target time period is greater than or equal to the first threshold. If the predicted number of tasks in the target time period is greater than or equal to the first threshold, it is indicated that a peak period of build tasks will come in the target time period, and the target child node for completing the build task needs to be delayed for recovery, so the delay recovery strategy in the candidate recovery strategy is used as the target recovery strategy to save the time for creating the child node. If the predicted number of tasks in the target time period is less than the first threshold, it is indicated that a peak period of build tasks will not come in the target time period, and the target child node for completing the build task does not need to be delayed for recovery, so the direct recovery strategy in the candidate recovery strategy is used as the target recovery strategy.
[0064] In an optional embodiment, the first threshold can be determined according to a preset maximum number of child nodes. The maximum number of child nodes is used to limit the number of created child nodes, which can be flexibly set according to the scene demand and the performance of the physical machine, and the present application does not limit it.
[0065] For step S304, if the target recycling strategy is the delayed recycling strategy, the sub-node is recycled after the sub-node completes the assigned construction task. If the target recycling strategy is the immediate recycling strategy, the sub-node is recycled immediately after the sub-node completes the assigned construction task.
[0066] The sub-node control method according to the embodiment of the application can predict the task prediction in the future target time period according to the received construction task related data, i.e. predict the trend of the received construction task in the future time period, and select the appropriate target recycling strategy according to the trend of the received construction task in the future time period, so as to improve the use efficiency of the sub-node, maximize the reuse of the built sub-node, effectively relieve the pressure during the construction task peak period, and improve the system efficiency. Figure 4 A curve diagram of the total time consumption of the construction task is shown as follows, Figure 4 As shown in the curve diagram, the use of the sub-node control method according to the embodiment of the application to select the target recycling strategy effectively relieves the construction pressure during the peak period, which proves the effectiveness of the control method.
[0067] In the optional embodiment, in the case of using the delayed recycling strategy as the target recycling strategy, the target recycling strategy also needs to be adjusted according to the real-time task condition, i.e. whether the target recycling strategy needs to be adjusted to the immediate recycling strategy according to the real-time task condition. For example, after using the delayed recycling strategy as the target recycling strategy, the change of the received construction task is monitored, and after the peak period of the construction task is monitored to have passed and the number of the received construction task has decreased, the immediate recycling strategy is used as the target recycling strategy to release the resources in time.
[0068] Specifically, whether the target recycling strategy needs to be adjusted to the immediate recycling strategy can be determined according to the following process:
[0069] In the case of using the delayed recycling strategy as the target recycling strategy, the second number of the received construction task in the unit time period is counted;
[0070] According to the second number, whether the target recycling strategy needs to be adjusted is determined. For example, in the case that the second number is greater than or equal to the second threshold value, the target recycling strategy is not adjusted, i.e. the delayed recycling strategy is still used as the target recycling strategy. In the case that the second number is less than the second threshold value, the immediate recycling strategy is used as the target recycling strategy. The second threshold value can be determined according to the preset maximum number of the sub-node, for example, the second threshold value is 20% of the maximum number of the sub-node.
[0071] Figure 5 A flowchart of the sub-node control method according to another embodiment of the application is shown as follows, Figure 5 As shown in the flowchart, the method comprises:
[0072] Step S501: obtaining received build task related data. The received build task related data can include, but is not limited to, the number of received build tasks and the receiving time.
[0073] Step S502: determining the current task state according to the received build task related data.
[0074] Step S503: determining the target recycling strategy corresponding to the current task state from the candidate recycling strategies according to the current task state.
[0075] Step S504: recycling target sub-nodes according to the target recycling strategy, the target sub-nodes being sub-nodes for completing allocated build tasks.
[0076] The steps S501 and S504 can refer to the embodiments shown in Figure 1 The present application is not limited herein.
[0077] For step S502, the current task state can be used to indicate how many current build tasks or the pressure of the system. As a specific example, the task state can include the backlog state or the idle state (i.e. non-backlog state). If the current task state is the backlog state, it means that the number of current build tasks is large, and more sub-nodes need to be created. If the current task state is the idle state, it means that the number of current build tasks is small, and fewer sub-nodes are needed.
[0078] In an optional embodiment, the first number of received build tasks and the receiving time are used to determine whether a task surge occurs; in the case of determining that a task surge occurs, the current task state is determined to be the backlog state; in the case of determining that a task surge does not occur, the current task state is determined to be the idle state. A task surge refers to the reception of a large number of build tasks at the same time or within a short period of time, so whether a task surge occurs can be determined according to the following process: according to the first number of received build tasks and the receiving time, it is determined whether the number of build tasks received at the same time is greater than or equal to a third threshold value; if the number of build tasks received at the same time is greater than or equal to the third threshold value, it is determined that a task surge occurs. The third threshold value can be determined according to the preset maximum number of sub-nodes. As a specific example, the third threshold value can be 80% of the set maximum number of sub-nodes.
[0079] For step S503, in the case of the current task state being the backlog state, the delayed recycling strategy is used as the target recycling strategy, and in the case of the current task state being the idle state, the direct recycling strategy is used as the target recycling strategy.
[0080] In this embodiment, different recycling strategies can be set for different task states to select the appropriate recycling strategy based on the task state, thereby improving the utilization efficiency of child nodes and system efficiency. For example, when the current task state is backlogged, a delayed recycling strategy can be used as the target recycling strategy, thereby saving the time of creating child nodes and improving system efficiency. When the current task state is idle, an immediate recycling strategy can be used as the target recycling strategy, thereby releasing the resources occupied by child nodes.
[0081] In an optional embodiment, it can be combined with Figure 3 Steps S303-S304 shown and Figure 5 The steps S502-S503 shown are used to comprehensively determine the target recycling strategy. For example, if the current task status is determined to be a backlog state, the delayed recycling strategy is used as the target recycling strategy. If the current task status is determined to be an idle state, the task prediction amount for the target time period is determined. If the task prediction amount for the target time period is greater than or equal to a first threshold, the delayed recycling strategy is used as the target recycling strategy. If the task prediction amount for the target time period is less than or equal to the first threshold, the direct recycling strategy is used as the target recycling strategy.
[0082] To make the subnode control method of the embodiments of the present application clearer, the following examples are described. In the embodiments, Jenkins is deployed in a containerized manner to a kubernetes environment, Jenkins-kubernetes plug-ins are installed and relevant docking configurations are performed. The Jenkins system needs to be connected with the kubernetes environment, and in order to be able to conveniently call the kubernetes interface from the inside to create a Jenkins subnode, Jenkins is deployed in a container. In the embodiments, the subnode control method can be performed by the Jenkins-kubernetes plug-in. After the Jenkins system receives a build task, the Jenkins-kubernetes plug-in temporarily creates a Jenkins subnode, the Jenkins schedules the task to the Jenkins subnode, and after the calculation of the subnode is completed, the Jenkins-kubernetes plug-in recycles the subnode. When the build tasks received by the Jenkins accumulate, the Jenkins-kubernetes plug-in delays the recycling of the subnodes of the completed tasks, and the Jenkins subnode is immediately used by the Jenkins scheduling system. In the embodiments, the Jenkins system can receive the build tasks through an interface or an interface mode. When the Jenkins-kubernetes plug-in determines that the current task is in an accumulated state or predicts that the build task will rise according to the number and time of the received build tasks and the maximum number of the configured subnodes, the delayed recycling strategy is used as the target recycling strategy, the created Jenkins subnode is reused, the time for creating the subnode is saved, and the processing of the build task is accelerated. The determination that the current task is in an accumulated state or the prediction that the build task will rise is determined according to the real-time number of tasks and the maximum number of the configured subnodes. If the number of received build tasks gradually increases in the same interval, and the number of build tasks in two cycles (time intervals) will be greater than or equal to the maximum number of subnodes at this speed, the delayed recycling of the Jenkins subnode is triggered. In addition, after the Jenkins subnode processes the task, the Jenkins-kubernetes plug-in makes a judgment. If a large number of build tasks are received at the same time, the number of tasks is more than 80% of the maximum number of configured subnodes, and the delayed recycling of the Jenkins subnode is triggered. Similarly, if the number of tasks is less than 20% of the maximum number of configured subnodes, the Jenkins subnode is immediately recycled.
[0083] Figure 6 The structure diagram of the subnode control device of the embodiments of the present application is shown as Figure 6 The subnode control device comprises:
[0084] The data obtaining module 601 is configured to obtain relevant data of a received construction task.
[0085] The strategy determining module 602 is configured to determine a target recycling strategy from candidate recycling strategies according to the relevant data of the received construction task.
[0086] The processing module 603 is configured to recycle a target sub-node according to the target recycling strategy, the target sub-node being a sub-node that completes an allocated construction task.
[0087] In an optional embodiment, the strategy determining module is further configured to determine a task prediction quantity in a target time period according to the relevant data of the received construction task, and determine the target recycling strategy from the candidate recycling strategies according to the task prediction quantity in the target time period.
[0088] In an optional embodiment, the strategy determining module is further configured to determine a growth speed of construction tasks in a unit time period according to a first quantity of received construction tasks and a receiving time, and determine a predicted quantity of tasks in the target time period according to the growth speed.
[0089] In an optional embodiment, the strategy determining module is further configured to determine whether the task prediction quantity in the target time period is greater than or equal to a first threshold value, and determine a delay recycling strategy in the candidate recycling strategies as the target recycling strategy corresponding to the current task state in a case where the task prediction quantity in the target time period is greater than or equal to the first threshold value.
[0090] In an optional embodiment, the strategy determining module is further configured to determine the first threshold value according to a preset maximum quantity of sub-nodes.
[0091] In an optional embodiment, the strategy determining module is further configured to, in a case where the delay recycling strategy is taken as the target recycling strategy, count a second quantity of received construction tasks in a unit time period, and determine whether to adjust the target recycling strategy according to the second quantity.
[0092] In an optional embodiment, the strategy determining module is further configured to, in a case where the second quantity is greater than or equal to a second threshold value, determine not to adjust the target recycling strategy, and in a case where the second quantity is less than the second threshold value, determine to take the direct recycling strategy as the target recycling strategy.
[0093] In an optional embodiment, the strategy determining module is further configured to determine the second threshold value according to a preset maximum quantity of sub-nodes.
[0094] In an optional embodiment, the policy determining module is further configured to determine a current task state according to the received data of the build task; and determine a target recycling policy corresponding to the current task state from the candidate recycling policies according to the current task state.
[0095] In an optional embodiment, the policy determining module is further configured to determine whether a task surge occurs according to the first number and the receiving time of the received build task; determine that the current task state is a backlog state if it is determined that the task surge occurs; and determine that the current task state is a space state if it is determined that the task surge does not occur.
[0096] In an optional embodiment, the policy determining module is further configured to determine whether the number of the received build tasks at the same time is greater than or equal to a third threshold according to the first number and the receiving time of the received build task; and determine that the task surge occurs if the number of the received build tasks at the same time is greater than or equal to the third threshold.
[0097] In an optional embodiment, the policy determining module is further configured to determine the third threshold according to the preset maximum number of the sub-nodes.
[0098] The sub-node control device provided in the embodiment of the present application can determine a target recycling policy corresponding to the data of the received build task from the candidate recycling policies according to the data of the build task, and recycle the target sub-node of the completed build task according to the target recycling policy, so that the recycling policy can be selected and adjusted in real time according to different task data, the use efficiency of the sub-node is improved, the system efficiency is improved, the ability of reusing the built sub-node is maximized, the pressure during the build task peak is effectively relieved, and the peak shaving effect is achieved.
[0099] The device described above can execute the method provided in the embodiment of the present application, and has the corresponding function modules and beneficial effects of executing the method. The technical details not described in detail in the embodiment can be referred to the method provided in the embodiment of the present application.
[0100] The embodiment of the present application further provides an electronic device, as shown in the figure, comprising a processor 701, a communication interface 702, a memory 703 and a communication bus 704, wherein the processor 701, the communication interface 702 and the memory 703 complete mutual communication through the communication bus 704, Figure 7
[0101] The memory 703 is used for storing a computer program.
[0102] The processor 701 is configured to implement the following steps when executing the program stored in the memory 703: in the case that a shutdown instruction is received, determining a target session state of a target user corresponding to the shutdown instruction according to a session state dynamically stored in a session index table; in the case that the target session state is an ongoing session, determining a role of the target user and a shutdown type corresponding to the target user; and in the case that the role matches the shutdown type, interrupting a current session of the target user.
[0103] The communication bus 704 mentioned in the terminal can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus 704 can be divided into an address bus, a data bus, a control bus, etc. For the convenience of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or only one type of bus.
[0104] The communication interface 702 is configured to communicate between the terminal and other devices.
[0105] The memory 703 can include a Random Access Memory (RAM) and can also include a non-volatile memory, for example, at least one disk memory. Optionally, the memory can also be at least one storage device located away from the aforementioned processor 701.
[0106] The processor 701 mentioned above can be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc.; can also be a Digital Signal Processing (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA) or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component.
[0107] In another embodiment provided by the application, a computer readable medium is also provided, and the computer readable medium stores instructions, when the instructions are run on a computer, the computer is caused to execute the sub-node control method in any of the above-mentioned embodiments.
[0108] In yet another embodiment of the present application, a computer program product containing instructions which, when executed on a computer, cause the computer to carry out the sub-node control method of any of the above-mentioned embodiments is also provided.
[0109] In the above-mentioned embodiments, the implementation can be wholly or partially in software, hardware, firmware or any combination thereof. When implemented in software, the implementation can be in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed by a computer, the computer program instructions cause the computer to carry out the processes or functions described in the embodiments of the present application. The computer can be a general purpose computer, a special purpose computer, a computer network, or other programmable apparatuses. The computer instructions can be stored in a computer readable storage medium or transferred from one computer readable storage medium to another computer readable storage medium, for example, the computer instructions can be transferred from one website, computer, server or data center to another website, computer, server or data center through wired (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (such as infrared, wireless, microwave, etc.) manner. The computer readable storage medium can be any available medium accessible by a computer or a data storage device such as a server, data center, etc. integrated with one or more available media. The available medium can be a magnetic medium (for example, floppy disk, hard disk, magnetic tape), an optical medium (for example, DVD), or a semiconductor medium (for example, solid state disk (SSD)) and the like.
[0110] It should be noted that, in this document, the terms such as first and second are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "contain" or any other variants thereof are intended to cover non-exclusive inclusion, so that the processes, methods, articles or devices including a series of elements not only include those elements, but also include other elements not explicitly listed or inherent to such processes, methods, articles or devices. Without more limitations, the element defined by the statement "including a" does not exclude the presence of other identical elements in the process, method, article or device including the element.
[0111] The various embodiments in the specification are described in a related manner, and the same or similar parts between the various embodiments can be referred to each other. Each embodiment focuses on the difference from other embodiments. In particular, for the system embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the part of the method embodiments.
[0112] The above only describes the preferred embodiments of the present application, and is not used to limit the protection scope of the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.
Claims
1. A child node control method, characterized in that, include: Retrieve relevant data for received build tasks; Based on the relevant data of the received build tasks, determine the target recycling strategy from the candidate recycling strategies; The target child node is reclaimed according to the target reclamation strategy, where the target child node is the child node that has completed the assigned construction task; Based on the relevant data of the received build tasks, a target recycling strategy is determined from the candidate recycling strategies, including: Based on the relevant data of the received construction tasks, determine the predicted task volume within the target time period; Based on the predicted task volume within the target time period, a target recycling strategy is determined from the candidate recycling strategies. Based on the predicted task volume within the target time period, a target recovery strategy is determined from the candidate recovery strategies, including: Determine whether the predicted task quantity within the target time period is greater than or equal to a first threshold. If the predicted number of tasks within the target time period is greater than or equal to the first threshold, the delayed recovery strategy among the candidate recovery strategies is determined as the target recovery strategy corresponding to the current task state.
2. The method according to claim 1, characterized in that, Based on the received data related to the construction tasks, determine the predicted number of tasks within the target time period, including: Determine the growth rate of build tasks within a unit time period based on the initial number of received build tasks and the time of receipt. Based on the growth rate, determine the number of tasks to be predicted within the target time period.
3. The method according to claim 1, characterized in that, The first threshold is determined based on the preset maximum number of child nodes.
4. The method according to claim 1, characterized in that, The method further includes: When the delayed recycling strategy is used as the target recycling strategy, the second number of build tasks received within a unit time period is counted. Based on the second quantity, determine whether to adjust the target recycling strategy.
5. The method according to claim 4, characterized in that, The step of determining whether to adjust the target recovery strategy based on the second quantity includes: If the second quantity is greater than or equal to the second threshold, it is determined that the target recycling strategy will not be adjusted; If the second quantity is less than the second threshold, the direct recycling strategy is determined as the target recycling strategy.
6. The method according to claim 5, characterized in that, The second threshold is determined based on the preset maximum number of child nodes.
7. The method according to any one of claims 1-6, characterized in that, Based on the relevant data of the received build tasks, a target recycling strategy is determined from the candidate recycling strategies, including: Based on the received data related to the build task, determine the current task status; Based on the current task status, determine the target recycling strategy corresponding to the current task status from the candidate recycling strategies.
8. The method according to claim 7, characterized in that, Determining the current task status based on the received data related to the build task includes: Determine whether a task surge has occurred based on the initial number of received build tasks and the time of receipt; If a task surge is detected, the current task status is determined to be a backlog state; If no task surge has occurred, the current task state is determined to be the space state.
9. The method according to claim 8, characterized in that, Determining whether a task surge has occurred based on the first number of received build tasks and the time of receipt includes: Based on the first number of received build tasks and the receiving time, determine whether the number of build tasks received at the same time is greater than or equal to the third threshold. If the number of build tasks received at the same time is greater than or equal to the third threshold, a task surge is determined to have occurred.
10. The method according to claim 9, characterized in that, The third threshold is determined based on the preset maximum number of child nodes.
11. A sub-node control device, characterized in that, include: The data acquisition module is used to acquire relevant data from received build tasks; The strategy determination module is used to determine the target recycling strategy from the candidate recycling strategies based on the relevant data of the received build tasks; The processing module is used to reclaim target child nodes according to the target reclamation strategy, wherein the target child node is a child node that has completed the assigned construction task; The strategy determination module is further configured to: determine the predicted task volume within a target time period based on the relevant data of the received construction tasks; and determine a target recycling strategy from candidate recycling strategies based on the predicted task volume within the target time period. The strategy determination module is further configured to: determine whether the predicted task amount within the target time period is greater than or equal to a first threshold; and if the predicted task amount within the target time period is greater than or equal to the first threshold, determine the delayed recovery strategy among the candidate recovery strategies as the target recovery strategy corresponding to the current task state.
12. An electronic device, characterized in that, include: One or more processors; Storage device for storing one or more programs. When the one or more programs are executed by the one or more processors, the one or more processors implement the method as described in any one of claims 1-10.
13. A computer-readable medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the method as described in any one of claims 1-10.
Citation Information
Patent Citations
Resource management method and device
CN112099937A