Device distribution method and apparatus, electronic device, and storage medium
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- INDUSTRIAL AND COMMERCIAL BANK OF CHINA
- Filing Date
- 2023-06-21
- Publication Date
- 2026-07-14
Smart Images

Figure CN116566793B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of information security, and more specifically, to a method, apparatus, and electronic device for distributing equipment. Background Technology
[0002] Ansible (an open-source IT automation tool) has become a widely used operation and maintenance tool in the cloud computing field, but as the cluster size grows, its operational efficiency drawbacks begin to emerge. Most Ansible operation and maintenance scenarios use a single management node architecture.
[0003] A single management node architecture cannot meet efficiency requirements as the cluster grows, leading to a significant increase in the time cost of operation and maintenance. Other acceleration solutions, such as pipelining (an essential part of modern computer processors, referring to the process of breaking down computer instructions into multiple steps) and mitogen, also have their limitations and defects. Pipelining requires the / etc / sudoers configuration on the host machine to be configured according to requirements, while mitogen requires the installation of additional plugins and dependencies, making it impossible to achieve a smooth transition in large-scale cluster scenarios.
[0004] For the technical issues that most Ansible operation and maintenance scenarios use a single management node architecture, which leads to a significant increase in the time cost of operation and maintenance work, no effective solution has yet been proposed.
[0005] Therefore, it is necessary to improve the relevant technology to overcome the aforementioned defects. Summary of the Invention
[0006] This invention provides a device allocation method, apparatus, and electronic device to at least solve the technical problem that most Ansible operation and maintenance scenarios in the prior art use a single management node architecture, which leads to a significant increase in the time cost of operation and maintenance work.
[0007] According to one aspect of the present invention, a device allocation method is provided, comprising: acquiring first data of a management platform and acquiring second data of each device cluster, wherein the first data is used to indicate the number of sub-platforms that can be scheduled in the management platform, and the second data is used to indicate the number of target devices in each device cluster; processing the first data and the second data through a preset algorithm to obtain a processing result; determining a range of the number of target devices to be controlled on the sub-platforms according to the processing result, so as to control the allocation of device clusters under the management platform according to the range of the number of devices.
[0008] In one exemplary embodiment, the method further includes: determining allocation information corresponding to each sub-platform based on the quantity range and the second data, wherein the allocation information includes: the target device cluster allocated to each sub-platform and the quantity of the target device cluster; and performing the allocation operation of the target device cluster on the sub-platform under the management platform using the allocation information.
[0009] In an exemplary embodiment, the allocation information is used to perform a target device cluster allocation operation on a sub-platform under the management platform, including: determining the device cluster to which each target device belongs; when multiple target first devices belong to the same device cluster, adjusting the multiple target first devices to the same sub-platform through the allocation operation; when multiple target second devices belong to different device clusters, adjusting the multiple target devices to the same sub-platform or allocating them to different sub-platforms through the allocation operation.
[0010] In one exemplary embodiment, the method further includes: initiating a target task to the device cluster corresponding to the sub-platform; obtaining task information output by the device cluster after executing the target task from a shared directory, wherein the shared directory is used to receive task information from all sub-platforms, and the task information includes at least: task status and task log; determining allocation feedback based on the task information, wherein the allocation feedback is used to indicate whether it is necessary to reallocate the target device to the sub-platform.
[0011] In an exemplary embodiment, determining allocation feedback based on the task information includes: acquiring the task status according to a preset period; when the task status is a first status, comparing the first duration of executing the target task in the task log with the target duration, and determining allocation feedback based on the comparison result; when the task status is a second status, determining that the allocation feedback indicates a need to reallocate the target device to the sub-platform; and when the task status is a third status, determining that the allocation feedback indicates no need to reallocate the target device to the sub-platform.
[0012] In one exemplary embodiment, determining allocation feedback based on the task information includes: if the first duration is greater than the target duration, determining that the allocation feedback indicates a need to reallocate the target device to the target platform; and if the first duration is less than or equal to the target duration, determining that the allocation feedback indicates a need not to reallocate the target device to the target platform.
[0013] In an exemplary embodiment, the device allocation method further includes: determining a first number of occurrences where the first duration is greater than the target duration, determining a second number of occurrences of the second state, and determining a third number of occurrences of the third state; determining the percentage of the first number and the second number in the total number of all task states; if the percentage of the number is greater than a preset percentage, determining that the target device needs to be reallocated to the target platform; if the percentage of the number is less than or equal to the preset percentage, determining that the target device does not need to be reallocated to the target platform.
[0014] According to another aspect of the present invention, a device allocation apparatus is also provided, comprising: an acquisition module, configured to acquire first data of a management platform and second data of each device cluster, wherein the first data is used to indicate the number of sub-platforms allowed to be scheduled in the management platform, and the second data is used to indicate the number of target devices in each device cluster; a processing module, configured to process the first data and the second data through a preset algorithm to obtain a processing result; and an allocation module, configured to determine a range of the number of target devices to be controlled on the sub-platforms according to the processing result, so as to control the allocation of device clusters under the management platform according to the range of the number of devices.
[0015] In an exemplary embodiment, the above-described apparatus further includes: a first determining module, configured to determine allocation information corresponding to each sub-platform based on the quantity range and the second data, wherein the allocation information includes: the target device cluster allocated to each sub-platform and the quantity of the target device cluster; and to perform the allocation operation of the target device cluster on the sub-platform under the management platform using the allocation information.
[0016] In one exemplary embodiment, the apparatus further includes: a second determining module, configured to determine the device cluster to which each target device belongs; when multiple target first devices belong to the same device cluster, adjust the multiple target first devices to the same sub-platform through the allocation operation; when multiple target second devices belong to different device clusters, adjust the multiple target devices to the same sub-platform or allocate them to different sub-platforms through the allocation operation.
[0017] In one exemplary embodiment, the above apparatus further includes: a task module, configured to initiate a target task to the device cluster corresponding to the sub-platform; obtain task information output by the device cluster after executing the target task from a shared directory, wherein the shared directory is configured to receive task information from all sub-platforms, and the task information includes at least: task status and task log; determine allocation feedback based on the task information, wherein the allocation feedback is configured to indicate whether it is necessary to reallocate the target device to the sub-platform.
[0018] In an exemplary embodiment, the above-described apparatus further includes: a feedback module, configured to acquire the task status according to a preset period; when the task status is a first status, compare the first duration of executing the target task in the task log with the target duration, and determine allocation feedback based on the comparison result; when the task status is a second status, determine that the allocation feedback indicates that the target device needs to be reallocated to the sub-platform; and when the task status is a third status, determine that the allocation feedback indicates that the target device does not need to be reallocated to the sub-platform.
[0019] In an exemplary embodiment, the above-described apparatus further includes: a feedback module, configured to acquire the task status according to a preset period; when the task status is a first status, compare the first duration of executing the target task in the task log with the target duration, and determine allocation feedback based on the comparison result; when the task status is a second status, determine that the allocation feedback indicates that the target device needs to be reallocated to the sub-platform; and when the task status is a third status, determine that the allocation feedback indicates that the target device does not need to be reallocated to the sub-platform.
[0020] In one exemplary embodiment, the allocation module is further configured to, if the first duration is greater than the target duration, determine that the allocation feedback indicates a need to reallocate the target device to the target platform; and if the first duration is less than or equal to the target duration, determine that the allocation feedback indicates a need not to reallocate the target device to the target platform.
[0021] In an exemplary embodiment, the allocation module is further configured to: determine a first number of occurrences where the first duration exceeds the target duration; determine a second number of occurrences of the second state; determine a third number of occurrences of the third state; determine the percentage of the first and second quantities in the total number of all task states; if the percentage of the number is greater than a preset percentage, determine that the target device needs to be reallocated to the target platform; if the percentage of the number is less than or equal to the preset percentage, determine that the target device does not need to be reallocated to the target platform.
[0022] According to another aspect of the present invention, a computer-readable storage medium is also provided, wherein a computer program is stored in the computer-readable storage medium, and the computer program is configured to execute the above-described method for transmitting energy efficiency information when it is run.
[0023] According to another aspect of the present invention, an electronic device is also provided, the electronic device including one or more processors; a memory for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors are configured to run the programs, wherein the programs are configured to execute the above-described method for sending energy efficiency information during runtime.
[0024] In the above process, first data from the management platform and second data from each device cluster are acquired. The first data indicates the number of sub-platforms that can be scheduled in the management platform, and the second data indicates the number of target devices in each device cluster. The first data and the second data are processed by a preset algorithm to obtain a processing result. Based on the processing result, the range of the number of target devices to be controlled by the sub-platform is determined, so as to control the allocation of the device clusters under the management platform according to the range of the number. This solves the problem that most Ansible operation and maintenance scenarios in the prior art use a single management node architecture, which leads to a significant increase in the time cost of operation and maintenance work. Attached Figure Description
[0025] The accompanying drawings, which are included to provide a further understanding of the invention and form part of this application, illustrate exemplary embodiments of the invention and, together with their description, serve to explain the invention and do not constitute an undue limitation thereof. In the drawings:
[0026] Figure 1 This is a flowchart of an optional device allocation method according to an embodiment of the present invention;
[0027] Figure 2 This is a schematic diagram of an optional device allocation method according to an embodiment of the present invention;
[0028] Figure 3 This is a schematic diagram of the structure of an optional device distribution apparatus according to an embodiment of this application;
[0029] Figure 4 This is a schematic diagram of an optional electronic device according to an embodiment of the present invention. Detailed Implementation
[0030] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0031] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0032] This invention can be applied to the program code of various software products, control systems, and clients (including but not limited to mobile clients, PCs, etc.) of financial institutions. Taking software products as an example, by scanning the program code of software products installed on mobile clients, the stable operation of software programs that realize the business content of financial institutions (including but not limited to business functions such as transfer, wealth management, funds, bill payment, account inquiry, advertising, and recommendations) can be guaranteed.
[0033] For ease of description, the following explains some of the nouns or terms used in the embodiments of this application:
[0034] PaaS Management Platform: A software platform used for cluster management and application scheduling.
[0035] Host machine: The target machine for executing maintenance tasks.
[0036] Cluster: A collection of host machines.
[0037] Ansible: An open-source IT automation tool.
[0038] The present invention will be further illustrated below with reference to various embodiments.
[0039] According to an embodiment of the present invention, an embodiment of a device allocation method is provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.
[0040] Figure 1 This is a flowchart of an optional device allocation method according to an embodiment of the present invention, such as... Figure 1 As shown, the method includes the following steps:
[0041] Step S101: Obtain first data from the management platform and second data from each device cluster, wherein the first data is used to indicate the number of sub-platforms that can be scheduled in the management platform, and the second data is used to indicate the number of target devices in each device cluster;
[0042] Step S102: Process the first data and the second data using a preset algorithm to obtain the processing result;
[0043] Step S103: Determine the range of the number of target devices to be controlled by the sub-platform based on the processing result, so as to control the allocation of the device cluster under the management platform according to the range of the number.
[0044] Through the above steps, first data from the management platform and second data from each device cluster are obtained. The first data indicates the number of sub-platforms that can be scheduled in the management platform, and the second data indicates the number of target devices in each device cluster. The first data and the second data are processed by a preset algorithm to obtain a processing result. Based on the processing result, the range of the number of target devices to be controlled by the sub-platform is determined, so as to control the allocation of device clusters under the management platform according to the range of the number. This solves the problem that most Ansible operation and maintenance scenarios in the prior art use a single management node architecture, which leads to a significant increase in the time cost of operation and maintenance work.
[0045] In one exemplary embodiment, the method further includes: determining allocation information corresponding to each sub-platform based on the quantity range and the second data, wherein the allocation information includes: the target device cluster allocated to each sub-platform and the quantity of the target device cluster; and performing the allocation operation of the target device cluster on the sub-platform under the management platform using the allocation information.
[0046] In other words, before allocating target devices to each sub-platform, it is necessary to clarify how many device clusters to allocate to each sub-platform and which device cluster to allocate. That is, the allocation information needs to be clarified, and then the allocation is carried out based on the allocation information.
[0047] In one optional embodiment, there are three device clusters: cluster A, cluster B, and cluster C. There are two sub-platforms: sub-platform a and sub-platform b. When allocating device clusters to sub-platform a, it is necessary to first determine how many clusters to allocate and which clusters they are. For example, the final allocation result might be: two clusters, cluster A and cluster B, are allocated to sub-platform a, and one cluster, cluster C, is allocated to sub-platform b.
[0048] In an exemplary embodiment, the allocation information is used to perform a target device cluster allocation operation on a sub-platform under the management platform, including: determining the device cluster to which each target device belongs; when multiple target first devices belong to the same device cluster, adjusting the multiple target first devices to the same sub-platform through the allocation operation; when multiple target second devices belong to different device clusters, adjusting the multiple target devices to the same sub-platform or allocating them to different sub-platforms through the allocation operation.
[0049] It should be noted that, to facilitate cluster operations, it's necessary to avoid assigning host machines from the same cluster to different management platforms for execution; that is, the cluster should be the smallest unit for executing maintenance tasks. Furthermore, the number of host machines assigned to each management platform should be as consistent as possible, as the execution time of maintenance tasks is directly proportional to the number of host machines. This ensures that the time taken for each management platform to complete the maintenance task does not differ significantly.
[0050] In one exemplary embodiment, the method further includes: initiating a target task to the device cluster corresponding to the sub-platform; obtaining task information output by the device cluster after executing the target task from a shared directory, wherein the shared directory is used to receive task information from all sub-platforms, and the task information includes at least: task status and task log; determining allocation feedback based on the task information, wherein the allocation feedback is used to indicate whether it is necessary to reallocate the target device to the sub-platform.
[0051] In other words, since the sub-platform can read and write to the same shared directory, after the sub-platform initiates a target task to the device cluster, it will send the task information output after task execution to the shared directory. Then, based on the task status and task logs in the task information, it will determine whether it is necessary to reassign the target device to the sub-platform.
[0052] In an exemplary embodiment, determining allocation feedback based on the task information includes: acquiring the task status according to a preset period; when the task status is a first status, comparing the first duration of executing the target task in the task log with the target duration, and determining allocation feedback based on the comparison result; when the task status is a second status, determining that the allocation feedback indicates a need to reallocate the target device to the sub-platform; and when the task status is a third status, determining that the allocation feedback indicates no need to reallocate the target device to the sub-platform.
[0053] In one exemplary embodiment, determining allocation feedback based on the task information includes: if the first duration is greater than the target duration, determining that the allocation feedback indicates a need to reallocate the target device to the target platform; and if the first duration is less than or equal to the target duration, determining that the allocation feedback indicates a need not to reallocate the target device to the target platform.
[0054] Optionally, the first state is in execution, the second state is execution failure, and the third state is execution success.
[0055] Understandably, if the task status is "in execution," the logged execution time is compared with the target time. If it's greater than the target time, the task has timed out, and a notification needs to be sent to the target platform to reallocate the target device. If it's less than the target time, the task hasn't timed out, and it can continue execution, waiting for the next cycle to retrieve the data.
[0056] If the task status is execution failure, it means that there may be a damaged device or an insufficient device to perform the current task. Obviously, it is necessary to reallocate the device to the target platform, so it is necessary to send an allocation feedback that requires reallocating the target device to the target platform.
[0057] If the task status is "execution successful," it means that the current device can complete the current task without needing to reassign it.
[0058] It should be noted that the allocation feedback can be presented as a text report, an indicator light, or a computer-readable command. If the allocation feedback is a text report, relevant technical personnel can decide whether to reallocate based on the content of the text report. If the allocation feedback is a computer-readable command, the computer can directly execute the command based on the allocation feedback.
[0059] In an exemplary embodiment, the device allocation method further includes: determining a first number of occurrences where the first duration is greater than the target duration, determining a second number of occurrences of the second state, and determining a third number of occurrences of the third state; determining the percentage of the first number and the second number in the total number of all task states; if the percentage of the number is greater than a preset percentage, determining that the target device needs to be reallocated to the target platform; if the percentage of the number is less than or equal to the preset percentage, determining that the target device does not need to be reallocated to the target platform.
[0060] In other words, optionally, the first state is "in execution" and the second state is "execution failed". Obviously, tasks that fail to execute and tasks whose execution time is significantly higher than the average level are abnormal task states. If the proportion of abnormal task states is greater than a preset proportion, it is determined that the target device needs to be reallocated to the target platform.
[0061] Obviously, the embodiments described above are merely some embodiments of the present invention, and not all embodiments. To better understand the response method of the above functions, the following description, in conjunction with embodiments, illustrates the process, but is not intended to limit the technical solutions of the embodiments of the present invention. Specifically:
[0062] This application also provides an optional device allocation method, such as... Figure 2 As shown, Figure 2 This is a schematic diagram of an optional device allocation method according to an embodiment of this application, specifically including the following steps:
[0063] It should be noted that the proposed solution is based on a shared directory mounted on the management platform, allowing multiple management platforms to read and write to the same directory.
[0064] Step S201: Read the configuration file, obtain credentials for accessing other management platforms, and count the number of management platforms that can be used for scheduling;
[0065] It should be noted that the configuration file mentioned refers to the configuration file related to performing operation and maintenance tasks; the credentials for accessing other management platforms can be access passwords.
[0066] In one optional embodiment, it can be assumed that all detectable management platforms are management platforms that can be used for scheduling.
[0067] Optionally, the validity period of the management platform can also be verified. If the validity period has not expired at the current time, the management platform is considered to be a usable management platform.
[0068] Step S202: Organize the clusters of operations and maintenance jobs to be performed, and distribute them evenly to the management platform that can be scheduled according to the rules;
[0069] It should be noted that, to facilitate cluster operations, it's necessary to avoid assigning host machines from the same cluster to different management platforms for execution; that is, the cluster should be the smallest unit for executing maintenance tasks. Furthermore, the number of host machines assigned to each management platform should be as consistent as possible, as the execution time of maintenance tasks is directly proportional to the number of host machines. This ensures that the time taken for each management platform to complete the maintenance task does not differ significantly.
[0070] Therefore, the following rules can exist:
[0071] Rule a: A cluster cannot be assigned to two management platforms for execution; that is, a cluster is the smallest unit for executing operation and maintenance jobs.
[0072] Rule b: The number of host machines allocated to the management platform should be as even as possible, because the execution time of operation and maintenance tasks is directly proportional to the number of host machines.
[0073] It should be noted that the number of host machines in each cluster is not consistent; that is, there may be large, medium, and small clusters. Therefore, in the actual allocation process, the total number of host machines is first calculated and divided by the total number of schedulable management platforms to obtain the average number of host machines allocated to each management platform. Then, the clusters are allocated to each management platform in turn until the number of host machines allocated to a single management platform exceeds the average, at which point the allocation begins to the next management platform.
[0074] Step S203: Log in to the available management platforms in sequence, issue the cluster list assigned to the management platform, and initiate background tasks;
[0075] It should be noted that at this time, each management platform will output logs to the shared directory, and at the same time output a flag file of the running status to the shared directory. The running status of the operation and maintenance job on the management platform can be obtained through the flag file, which indicates whether it is executing, executing successfully, or executing unsuccessfully.
[0076] The sequential login can also be a simultaneous login.
[0077] Step S204: Block and check the execution status of each operation and maintenance job at regular intervals. If all operation and maintenance jobs have been completed, collect their logs and analyze the overall results.
[0078] It should be noted that if any maintenance tasks are still running after the preset time has elapsed, they will be marked as timed out and the entire task will be terminated.
[0079] Step S205: Analyze the logs, calculate the execution time of all tasks, mark tasks that failed to execute and tasks whose execution time was significantly higher than the average level, and compile the data for technical personnel to use in subsequent analysis.
[0080] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods of the various embodiments of the present invention. In this embodiment, an energy efficiency information transmitting device is also provided. This device is used to implement the above embodiments and preferred embodiments, and will not be repeated for those already described. As used below, the term "module" can be a combination of software and / or hardware that implements a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.
[0081] The following combination Figure 3 The solution of the present invention will be further described below. Figure 3 This is a schematic diagram of the structure of an optional device distribution apparatus according to an embodiment of this application:
[0082] The acquisition module 32 is used to acquire first data from the management platform and second data from each device cluster, wherein the first data is used to indicate the number of sub-platforms that can be scheduled in the management platform, and the second data is used to indicate the number of target devices in each device cluster;
[0083] Processing module 34 is used to process the first data and the second data using a preset algorithm to obtain a processing result;
[0084] The allocation module 36 is used to determine the range of the number of target devices to be controlled by the sub-platform based on the processing result, so as to control the allocation of the device cluster under the management platform according to the range of the number.
[0085] The aforementioned device acquires first data from the management platform and second data from each device cluster. The first data indicates the number of sub-platforms allowed to be scheduled within the management platform, and the second data indicates the number of target devices in each device cluster. A preset algorithm is used to process the first and second data to obtain a processing result. Based on the processing result, a range of target devices to be controlled on each sub-platform is determined. This range is then used to control the allocation of device clusters within the management platform. This addresses the problem that most Ansible operation and maintenance scenarios in the prior art use a single management node architecture, leading to a significant increase in the time cost of operation and maintenance.
[0086] In an exemplary embodiment, the above-described apparatus further includes: a first determining module, configured to determine allocation information corresponding to each sub-platform based on the quantity range and the second data, wherein the allocation information includes: the target device cluster allocated to each sub-platform and the quantity of the target device cluster; and to perform the allocation operation of the target device cluster on the sub-platform under the management platform using the allocation information.
[0087] In one exemplary embodiment, the apparatus further includes: a second determining module, configured to determine the device cluster to which each target device belongs; when multiple target first devices belong to the same device cluster, adjust the multiple target first devices to the same sub-platform through the allocation operation; when multiple target second devices belong to different device clusters, adjust the multiple target devices to the same sub-platform or allocate them to different sub-platforms through the allocation operation.
[0088] In one exemplary embodiment, the above apparatus further includes: a task module, configured to initiate a target task to the device cluster corresponding to the sub-platform; obtain task information output by the device cluster after executing the target task from a shared directory, wherein the shared directory is configured to receive task information from all sub-platforms, and the task information includes at least: task status and task log; determine allocation feedback based on the task information, wherein the allocation feedback is configured to indicate whether it is necessary to reallocate the target device to the sub-platform.
[0089] In an exemplary embodiment, the above-described apparatus further includes: a first feedback module, configured to acquire the task status according to a preset period; when the task status is a first status, compare the first duration of executing the target task in the task log with the target duration, and determine allocation feedback based on the comparison result; when the task status is a second status, determine that the allocation feedback indicates that the target device needs to be reallocated to the sub-platform; and when the task status is a third status, determine that the allocation feedback indicates that the target device does not need to be reallocated to the sub-platform.
[0090] In an exemplary embodiment, the above-described apparatus further includes: a second feedback module, configured to acquire the task status according to a preset period; when the task status is a first status, compare the first duration of executing the target task in the task log with the target duration, and determine allocation feedback based on the comparison result; when the task status is a second status, determine that the allocation feedback indicates that the target device needs to be reallocated to the sub-platform; and when the task status is a third status, determine that the allocation feedback indicates that the target device does not need to be reallocated to the sub-platform.
[0091] In one exemplary embodiment, the allocation module is further configured to, if the first duration is greater than the target duration, determine that the allocation feedback indicates a need to reallocate the target device to the target platform; and if the first duration is less than or equal to the target duration, determine that the allocation feedback indicates a need not to reallocate the target device to the target platform.
[0092] In an exemplary embodiment, the allocation module is further configured to: determine a first number of occurrences where the first duration exceeds the target duration; determine a second number of occurrences of the second state; determine a third number of occurrences of the third state; determine the percentage of the first and second quantities in the total number of all task states; if the percentage of the number is greater than a preset percentage, determine that the target device needs to be reallocated to the target platform; if the percentage of the number is less than or equal to the preset percentage, determine that the target device does not need to be reallocated to the target platform.
[0093] The distribution device of the device includes a processor and a memory. The aforementioned acquisition modules are all stored in the memory as program units, and the processor executes the aforementioned program units stored in the memory to realize the corresponding functions.
[0094] The processor contains a kernel, which retrieves the corresponding program unit from memory. One or more kernels can be configured, and their parameters can be adjusted to address the challenges posed by the kernel. However, most Ansible operations and maintenance scenarios utilize a single management node architecture, leading to a significant increase in the time and cost of operations and maintenance.
[0095] The memory may include non-permanent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip.
[0096] This invention provides a computer-readable storage medium storing a program that, when executed by a processor, implements a method for allocating the device.
[0097] This invention provides a processor for running a program, wherein the program executes a device allocation method during runtime.
[0098] like Figure 4 As shown, this embodiment of the invention provides an electronic device, which includes a processor, a memory, and a program stored in the memory and executable on the processor. When the processor executes the program, it performs the following steps: acquiring first data from a management platform and acquiring second data from each device cluster, wherein the first data is used to indicate the number of sub-platforms that can be scheduled in the management platform, and the second data is used to indicate the number of target devices in each device cluster; processing the first data and the second data using a preset algorithm to obtain a processing result; determining the range of the number of target devices to be controlled on the sub-platform based on the processing result, so as to control the allocation of device clusters under the management platform according to the range of the number of devices.
[0099] Optionally, allocation information corresponding to each sub-platform is determined based on the quantity range and the second data, wherein the allocation information includes: the target device cluster allocated to each sub-platform and the quantity of the target device cluster; the allocation information is used to perform the allocation operation of the target device cluster on the sub-platform under the management platform.
[0100] Optionally, the allocation information is used to perform a target device cluster allocation operation on the sub-platform under the management platform, including: determining the device cluster to which each target device belongs; if multiple target first devices belong to the same device cluster, adjusting the multiple target first devices to the same sub-platform through the allocation operation; if multiple target second devices belong to different device clusters, adjusting the multiple target devices to the same sub-platform or allocating them to different sub-platforms through the allocation operation.
[0101] Optionally, the method further includes: initiating a target task to the device cluster corresponding to the sub-platform; obtaining task information output by the device cluster after executing the target task from a shared directory, wherein the shared directory is used to receive task information from all sub-platforms, and the task information includes at least: task status and task logs; determining allocation feedback based on the task information, wherein the allocation feedback is used to indicate whether it is necessary to reallocate the target device to the sub-platform.
[0102] Optionally, determining the allocation feedback based on the task information includes: acquiring the task status according to a preset period; when the task status is a first status, comparing the first duration of executing the target task in the task log with the target duration, and determining the allocation feedback based on the comparison result; when the task status is a second status, determining that the allocation feedback indicates a need to reallocate the target device to the sub-platform; and when the task status is a third status, determining that the allocation feedback indicates no need to reallocate the target device to the sub-platform.
[0103] Optionally, determining the allocation feedback based on the task information includes: if the first duration is greater than the target duration, determining that the allocation feedback indicates a need to reallocate the target device to the target platform; if the first duration is less than or equal to the target duration, determining that the allocation feedback indicates a need not to reallocate the target device to the target platform.
[0104] Optionally, the device allocation method further includes: determining a first number of occurrences where the first duration exceeds the target duration, determining a second number of occurrences of the second state, and determining a third number of occurrences of the third state; determining the percentage of the first and second quantities in the total number of all task states; if the percentage of the first quantity is greater than a preset percentage, determining that the target device needs to be reallocated to the target platform; if the percentage of the first quantity is less than or equal to the preset percentage, determining that the target device does not need to be reallocated to the target platform.
[0105] The devices mentioned in this article can be servers, PCs, tablets, mobile phones, etc.
[0106] This application also provides a computer program product, which, when executed on a data processing device, is suitable for executing an initialization program with the following method steps: acquiring first data from a management platform and acquiring second data from each device cluster, wherein the first data is used to indicate the number of sub-platforms allowed to be scheduled in the management platform, and the second data is used to indicate the number of target devices in each device cluster; processing the first data and the second data through a preset algorithm to obtain a processing result; determining a range of the number of target devices to be controlled on the sub-platform based on the processing result, so as to control the allocation of the device clusters under the management platform according to the range of the number.
[0107] Optionally, allocation information corresponding to each sub-platform is determined based on the quantity range and the second data, wherein the allocation information includes: the target device cluster allocated to each sub-platform and the quantity of the target device cluster; the allocation information is used to perform the allocation operation of the target device cluster on the sub-platform under the management platform.
[0108] Optionally, the allocation information is used to perform a target device cluster allocation operation on the sub-platform under the management platform, including: determining the device cluster to which each target device belongs; if multiple target first devices belong to the same device cluster, adjusting the multiple target first devices to the same sub-platform through the allocation operation; if multiple target second devices belong to different device clusters, adjusting the multiple target devices to the same sub-platform or allocating them to different sub-platforms through the allocation operation.
[0109] Optionally, the method further includes: initiating a target task to the device cluster corresponding to the sub-platform; obtaining task information output by the device cluster after executing the target task from a shared directory, wherein the shared directory is used to receive task information from all sub-platforms, and the task information includes at least: task status and task logs; determining allocation feedback based on the task information, wherein the allocation feedback is used to indicate whether it is necessary to reallocate the target device to the sub-platform.
[0110] Optionally, determining the allocation feedback based on the task information includes: acquiring the task status according to a preset period; when the task status is a first status, comparing the first duration of executing the target task in the task log with the target duration, and determining the allocation feedback based on the comparison result; when the task status is a second status, determining that the allocation feedback indicates a need to reallocate the target device to the sub-platform; and when the task status is a third status, determining that the allocation feedback indicates no need to reallocate the target device to the sub-platform.
[0111] Optionally, determining the allocation feedback based on the task information includes: if the first duration is greater than the target duration, determining that the allocation feedback indicates a need to reallocate the target device to the target platform; if the first duration is less than or equal to the target duration, determining that the allocation feedback indicates a need not to reallocate the target device to the target platform.
[0112] Optionally, the device allocation method further includes: determining a first number of occurrences where the first duration exceeds the target duration, determining a second number of occurrences of the second state, and determining a third number of occurrences of the third state; determining the percentage of the first and second quantities in the total number of all task states; if the percentage of the first quantity is greater than a preset percentage, determining that the target device needs to be reallocated to the target platform; if the percentage of the first quantity is less than or equal to the preset percentage, determining that the target device does not need to be reallocated to the target platform.
[0113] The sequence numbers of the above embodiments of the present invention are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.
[0114] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0115] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0116] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0117] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0118] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0119] Memory may include non-persistent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.
[0120] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.
[0121] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.
[0122] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0123] The above are merely embodiments of this application and are not intended to limit the scope of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of the claims of this application.
Claims
1. A method for distributing equipment, characterized in that, include: Acquire first data from the management platform and second data from each device cluster, wherein the first data is used to indicate the number of sub-platforms that can be scheduled in the management platform, and the second data is used to indicate the number of target devices in each device cluster; The first data and the second data are processed by a preset algorithm to obtain the processing result; The number range of the target devices to be controlled by the sub-platform is determined based on the processing result, so as to control the allocation of the device cluster under the management platform according to the number range; The method further includes: initiating a target task to the device cluster corresponding to the sub-platform; obtaining task information output by the device cluster after executing the target task from a shared directory, wherein the shared directory is used to receive task information from all sub-platforms, and the task information includes at least: task status and task logs; determining allocation feedback based on the task information, wherein the allocation feedback is used to indicate whether it is necessary to reallocate the target device to the sub-platform.
2. The method according to claim 1, characterized in that, The method further includes: Based on the quantity range and the second data, the allocation information corresponding to each sub-platform is determined, wherein the allocation information includes: the target device cluster allocated to each sub-platform and the number of the target device clusters; The allocation information is used to perform the allocation operation of the target device cluster on the sub-platform under the management platform.
3. The method according to claim 2, characterized in that, Using the allocation information, the allocation operation of the target device cluster is performed on the sub-platform under the management platform, including: Determine the device cluster to which each target device belongs; In the case where multiple target first devices belong to the same device cluster, the allocation operation will adjust the multiple target first devices to the same sub-platform; In the case where multiple target second devices belong to different device clusters, the allocation operation can be used to adjust the multiple target devices to the same sub-platform or allocate them to different sub-platforms.
4. The method according to claim 1, characterized in that, The allocation feedback is determined based on the task information, including: The task status is obtained according to a preset period; When the task status is in the first state, compare the first duration of the target task execution in the task log with the target duration, and determine the allocation feedback based on the comparison result; When the task status is in the second state, the allocation feedback is determined to indicate that the target device needs to be reallocated to the sub-platform. When the task status is in the third state, the allocation feedback is determined to be that there is no need to reallocate the target device to the sub-platform.
5. The method according to claim 4, characterized in that, The allocation feedback is determined based on the task information, including: If the first duration exceeds the target duration, the allocation feedback indicates that the target device needs to be reallocated to the target platform; If the first duration is less than or equal to the target duration, the allocation feedback is determined to indicate that the target device does not need to be reallocated to the target platform.
6. The method according to claim 4, characterized in that, The method further includes: Determine the first number of occurrences where the first duration exceeds the target duration, determine the second number of occurrences of the second state, and determine the third number of occurrences of the third state; Determine the percentage of the first quantity and the second quantity in the total quantity across all task states; If the stated proportion is greater than the preset proportion, it is determined that the target devices need to be reallocated to the target platform.
7. A dispensing device for an equipment, characterized in that, include: The acquisition module is used to acquire first data from the management platform and second data from each device cluster, wherein the first data is used to indicate the number of sub-platforms that can be scheduled in the management platform, and the second data is used to indicate the number of target devices in each device cluster; The processing module is used to process the first data and the second data using a preset algorithm to obtain the processing result; The allocation module is used to determine the range of the number of target devices to be controlled by the sub-platform based on the processing result, so as to control the allocation of the device cluster under the management platform according to the range of the number. The allocation module is further configured to initiate a target task to the device cluster corresponding to the sub-platform; obtain task information output by the device cluster after executing the target task from a shared directory, wherein the shared directory is used to receive task information from all sub-platforms, and the task information includes at least: task status and task log; determine allocation feedback based on the task information, wherein the allocation feedback is used to indicate whether it is necessary to reallocate the target device to the sub-platform.
8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, wherein the computer program is configured to execute the allocation method of the device according to any one of claims 1 to 6 when it is run.
9. An electronic device, characterized in that, The electronic device includes one or more processors; A memory for storing one or more programs, which, when executed by one or more processors, cause the one or more processors to perform the program, wherein the program is configured to execute the allocation method of the device as described in any one of claims 1 to 6.