Electric power task execution device
By deploying power task execution devices of task managers and local schedulers in the power system, the problem of poor power task execution reliability in distributed environments is solved, multi-task real-time scheduling and resource isolation management are realized, and the power system is improved stability and resource utilization efficiency.
Patent Information
- Application Number
- CN202411527362.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-30
- Publication Date
- 2025-02-18
AI Technical Summary
Existing power tasks are not reliable in distributed environments, making it difficult to realize real-time multitasking and resource isolation management.
A power task execution device is designed, including a task manager and a local scheduler. The task manager is used to determine the target node and allocate power tasks. The local scheduler creates target containers based on resource demand parameters, configures resource usage restrictions, and monitors resource usage rates and task status during execution, and dynamically adjusts resource usage restrictions.
Through real-time scheduling and resource isolation management, the reliable execution of power tasks is achieved, and the stability and resource utilization efficiency of the power system are improved.
Smart Images

Figure CN119476805A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present invention relate to the field of electric power, and in particular to a device for executing electric power tasks. Background Art
[0002] With the advancement of the intelligentization and modernization of power systems, various power tasks in power systems (such as power load forecasting tasks, fault detection tasks, and equipment maintenance tasks) are becoming increasingly complex and huge.
[0003] Understandably, it is critical to enable these power tasks to be reliably performed in the distributed environment in which the power system resides, thereby ensuring the stable operation of the power system.
[0004] However, the reliability of power task execution is currently poor and needs to be addressed urgently. Summary of the invention
[0005] An embodiment of the present invention provides a power task execution device to improve the reliability of power task execution.
[0006] According to one aspect of the present invention, a power task execution device is provided, which is deployed in a power system, the power system includes a plurality of nodes, and the device includes a task manager and a local scheduler respectively deployed on each node: wherein,
[0007] The task manager is used to determine a target node for executing the power task from each node for executing the power task to be executed, assign the power task to the target node, and notify the local scheduler deployed on the target node of the task information of the power task;
[0008] A local scheduler, for creating a target container for the power task according to the resource requirement parameters represented by the received task information, and configuring resource usage restrictions for the target container;
[0009] The local scheduler is further used to deploy the power task to the target container to execute the power task in the target container, and during the execution process, monitor the container resource usage rate of the target container and the task execution status of the power task;
[0010] The local scheduler is also used to adjust the resource usage limit when it is determined that the resource usage limit needs to be adjusted based on the task execution status, the resource usage limit and the container resource usage rate, so as to continue to execute the power task based on the resource usage limit in the target container.
[0011] The power task execution device described in the embodiment of the present invention is deployed in a power system, which includes multiple nodes. The power task execution device includes a task manager and a local scheduler deployed on each node: wherein, through the task manager, for the power task to be executed, the target node for executing the power task can be determined from each node, and the power task is assigned to the target node, and the task information of the power task is notified to the local scheduler deployed on the target node; through the local scheduler, a target container can be created for the power task according to the resource demand parameters represented by the received task information, and resource usage restrictions can be configured for the target container; through the local scheduler, the power task can be deployed to the target container to execute the power task in the target container, and then during the execution process, the container resource usage rate of the target container and the task execution status of the power task are monitored; through the local scheduler, when it is determined that the resource usage restriction needs to be adjusted according to the monitoring results, the resource usage restriction can be adjusted to continue to execute the power task in the target container based on the resource usage restriction. The above technical scheme realizes the reliable execution of power tasks through real-time scheduling of power tasks and resource isolation management.
[0012] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0013] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0014] Figure 1 is a structural block diagram of a power task execution device provided according to an embodiment of the present invention;
[0015] Figure 2 is a structural block diagram of another power task execution device provided according to an embodiment of the present invention;
[0016] Figure 3 is a structural block diagram of another power task execution device provided according to an embodiment of the present invention;
[0017] Figure 4 It is a flowchart of an optional example of another power task execution device provided according to an embodiment of the present invention. DETAILED DESCRIPTION
[0018] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0019] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. The situations of "target", "original", etc. are similar and will not be repeated here. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0020] Before introducing the embodiments of the present invention, the application scenarios of the embodiments of the present invention are first exemplified. For example, the power tasks in the power system have high complexity and real-time requirements. For example, the power load forecasting task needs to be quickly calculated based on the power data collected in real time, so as to adjust the power distribution in time to avoid overload or power waste of the power grid; for another example, the fault detection task needs to respond quickly at the moment of the fault, locate the fault and take corresponding measures to ensure the safe operation of the power grid; and so on. These power tasks all require powerful computing power and real-time task scheduling strategies.
[0021] Moreover, the execution of power tasks requires strict resource isolation and resource management to ensure that the power tasks do not interfere with each other and operate stably. Especially when multiple power tasks are executed concurrently, resource isolation and resource management become particularly important. If resources are not managed properly, it may lead to resource competition between power tasks, which may lead to the failure of power task execution or the collapse of the power system.
[0022] It can be seen that in a distributed environment, it is crucial to efficiently schedule multiple power tasks in real time and realize dynamic isolation and management of resources to ensure the reliable execution of each power task.
[0023] Figure 1This is a structural block diagram of a power task execution device provided by an embodiment of the present invention. This embodiment is applicable to the case of executing power tasks, and is particularly applicable to the case of executing power tasks based on multi-task real-time scheduling and resource isolation management.
[0024] See also Figure 1 The power task execution device described in the embodiment of the present invention can be deployed on a power system, which may include multiple nodes. The power task execution device may include a task manager 10 and a local scheduler 20 respectively deployed on each node: wherein,
[0025] The task manager 10 may be used to determine a target node for executing the power task from among the nodes for executing the power task to be executed, assign the power task to the target node, and notify the local scheduler 20 deployed on the target node of the task information of the power task;
[0026] The local scheduler 20 may be used to create a target container for the power task according to the resource requirement parameters represented by the received task information, and configure resource usage restrictions for the target container;
[0027] The local scheduler 20 may also be used to deploy the power task to the target container to execute the power task in the target container, and during the execution of the power task, monitor the container resource usage of the target container and the task execution status of the power task;
[0028] The local scheduler 20 is further configured to adjust the resource usage limit when it is determined that the resource usage limit needs to be adjusted based on the task execution status and the container resource usage rate, so as to continue to execute the power task based on the resource usage limit in the target container.
[0029] The power system can be understood as a distributed operating system used in the power field. The power system includes multiple nodes, and each node is respectively deployed with a local scheduler 20. The power task can be understood as a task to be performed in the power system, such as a power load forecasting task, a fault detection task, or an equipment maintenance task, etc. This is related to the actual situation and is not specifically limited here.
[0030] For the task manager 10 independent of each node, the task manager 10 can determine the target node for executing the power task from each node and assign the power task to the target node, thereby realizing the global scheduling of each power task and ensuring that each power task is assigned to the most suitable node. Further, for the local scheduler 20 deployed on the target node, the task manager 10 can notify the local scheduler 20 of the task information of the power task, such as notifying the local scheduler 20 through a distributed message queue, so as to use the local scheduler 20 to execute the power task on the target node.
[0031] Specifically, the local scheduler 20 can create a target container for the power task according to the resource demand parameters represented by the received task information, and configure resource usage restrictions for the target container. By creating an independent target container and configuring resource usage restrictions, fine-grained resource isolation is achieved, thereby ensuring the stable operation of each power task. Further, the local scheduler 20 can deploy the power task to the target container to start executing the power task in the target container, and during the execution of the power task, the container resource usage rate of the target container and the task execution status of the power task can be monitored. Further, it can be determined whether the resource usage restrictions need to be adjusted based on the monitoring results obtained (i.e., the container resource usage rate and the task execution status). If so, the resource usage restrictions can be adjusted, so that the power task can continue to be executed in the target container based on the adjusted resource usage restrictions to ensure the smooth execution of the power task.
[0032] The power task execution device described in the embodiment of the present invention is deployed in a power system, which includes multiple nodes. The power task execution device includes a task manager and a local scheduler deployed on each node: wherein, through the task manager, for the power task to be executed, the target node for executing the power task can be determined from each node, and the power task is assigned to the target node, and the task information of the power task is notified to the local scheduler deployed on the target node; through the local scheduler, a target container can be created for the power task according to the resource demand parameters represented by the received task information, and resource usage restrictions can be configured for the target container; through the local scheduler, the power task can be deployed to the target container to execute the power task in the target container, and then during the execution process, the container resource usage rate of the target container and the task execution status of the power task are monitored; through the local scheduler, when it is determined that the resource usage restriction needs to be adjusted according to the monitoring results, the resource usage restriction can be adjusted to continue to execute the power task in the target container based on the resource usage restriction. The above technical scheme realizes the reliable execution of power tasks through real-time scheduling of power tasks and resource isolation management.
[0033] An optional technical solution, the local scheduler is also used to feed back the collected abnormal situation to the task manager when it is determined that the power task execution is abnormal according to the task execution status;
[0034] The task manager is further used to adjust the task scheduling strategy applied when scheduling the power task according to the received abnormal situation, and re-determine the target node to re-schedule the power task according to the task scheduling strategy.
[0035] The above technical solution, through continuous monitoring and feedback mechanism, the task manager can promptly discover and handle abnormal situations that occur during the execution of power tasks, so as to dynamically adjust the task scheduling strategy and reschedule the power tasks based on it, thus ensuring the smooth execution of the power tasks.
[0036] Another optional technical solution, the local scheduler, is also used to notify the task manager of the task execution result of the power task for recording when the power task is completed, and destroy the target container to release the resources occupied by the target container, thereby improving resource utilization efficiency.
[0037] Figure 2 It is a structural block diagram of another power task execution device provided by an embodiment of the present invention. This embodiment is optimized based on the above-mentioned technical solutions. In this embodiment, optionally, the task manager may include a target node determination module, a power task allocation module and a task information notification module; wherein the target node determination module is used to determine the target node for executing the power task from each node for the power task to be executed; the power task allocation module is used to allocate the power task to the target node; the task information notification module is used to notify the task information of the power task to the local scheduler deployed on the target node. Among them, the explanations of the terms that are the same or corresponding to the above-mentioned embodiments are not repeated here.
[0038] For details, see Figure 2 The power task execution device described in this embodiment can be deployed on a power system, which may include multiple nodes. The power task execution device may include a task manager 10 and a local scheduler 20 respectively deployed on each node. The task manager 10 includes a target node determination module 101, a power task allocation module 102 and a task information notification module 103: wherein,
[0039] The target node determination module 101 is used to determine the target node for executing the power task from each node for the power task to be executed;
[0040] The power task allocation module 102 is used to allocate the power task to the target node;
[0041] The task information notification module 103 is used to notify the local scheduler 20 deployed on the target node of the task information of the power task;
[0042] The local scheduler 20 may be used to create a target container for the power task according to the resource requirement parameters represented by the received task information, and configure resource usage restrictions for the target container;
[0043] The local scheduler 20 may also be used to deploy the power task to the target container to execute the power task in the target container, and during the execution of the power task, monitor the container resource usage of the target container and the task execution status of the power task;
[0044] The local scheduler 20 is further configured to adjust the resource usage limit when it is determined that the resource usage limit needs to be adjusted based on the task execution status and the container resource usage rate, so as to continue to execute the power task based on the resource usage limit in the target container.
[0045] The power task execution device described in the embodiment of the present invention realizes accurate determination of the target node through the target node determination module; realizes effective allocation of the power task to the target node through the power task allocation module; realizes effective notification of the task information through the task information notification module. The above modules cooperate with each other to realize effective scheduling of the power task.
[0046] In an optional technical solution, the target node determination module may include a data collection unit, a comprehensive resource usage determination unit and a target node determination unit; wherein,
[0047] A data collection unit, used for collecting the node resource usage rate and the power task queue length of each node among all the nodes;
[0048] A comprehensive resource usage determination unit, used to determine the comprehensive resource usage of the node according to the node resource usage rate and the power task queue length;
[0049] The target node determination unit is used to determine the target node for executing the power task from all the nodes according to the comprehensive resource usage corresponding to all the nodes.
[0050] Among them, for each node in all nodes, the node resource utilization rate of the node can be understood as the utilization rate of the node on at least one resource. On this basis, combined with the application scenarios that may be involved in the embodiments of the present invention, optionally, the at least one resource may include at least one of a central processing unit (CPU), memory, storage and network bandwidth. The power task queue length of the node can be understood as the number of all power tasks assigned to the node. The node resource utilization rate and the power task queue length of each node are collected respectively through the data collection unit.
[0051] Furthermore, for each node among all nodes, the comprehensive resource usage determination unit can be used to determine the comprehensive resource usage of the node based on the node resource usage rate and the power task queue length of the node. On this basis, the comprehensive resource usage of the node can also be determined in combination with the power task queue length of all nodes.
[0052] Furthermore, through the target node determination unit, the target node can be determined from all the nodes according to the comprehensive resource usage corresponding to all the nodes.
[0053] The above technical solution performs global scheduling of power tasks by comprehensively evaluating the comprehensive resource usage of each node, thereby ensuring that each power task is allocated to the most suitable node.
[0054] On this basis, optionally, for node i among all nodes, a comprehensive resource usage determination unit is specifically used to:
[0055] The comprehensive resource usage of node i is determined by the following formula: CRUS i :
[0056]
[0057] Among them, C i represents the CPU usage of node i, M i represents the memory usage of node i, S i represents the storage usage of node i, B i represents the network bandwidth usage of node i, Q i It can represent the power task queue length of node i, Q max represents the largest power task queue length among all the power task queue lengths corresponding to all nodes, w c 、w m 、w s 、w b and q Both represent weights.
[0058] Among them, in this technical solution, optionally, CRUS i It can also be called the comprehensive resource utilization score. It is understandable that w c Indicates the weight of the CPU, w m Represents the weight of memory, w s represents the weight of storage, B i Indicates the weight of the network bandwidth. In this technical solution, optional, w c +w m +w s +w b +w q =1.
[0059] The above technical solution calculates the comprehensive resource utilization score by comprehensively considering the weights of various resources, the length of the power task queue of each node and the node resource utilization rate of various resources, so as to select the node with the lowest comprehensive resource utilization score as the target node. This dynamic selection process ensures that the power task is executed on the node with the most optimized resources, thereby improving the overall scheduling efficiency of the power system.
[0060] Another optional technical solution, the task information notification module, is specifically used to:
[0061] Through the preset distributed message queue, the task information of the power task is notified to the local scheduler deployed on the target node.
[0062] The above technical solution realizes real-time communication between nodes by applying distributed message queues, thereby improving the response speed of the power system.
[0063] On this basis, optionally, the above-mentioned distributed message queue can be implemented using the Apache Kafka distributed stream processing platform, in which the configuration process of the distributed message queue is as follows:
[0064] Configure Zookeeper: Set the parameters of dataDir and clientport in the Zookeeper.properties file;
[0065] Configure Kafka Broker: Configure the server.properties file, in which you set the unique ID of each Broker, the log storage path, and the Zookeeper connection information; copy and modify multiple server.properties files for the required number of Brokers, ensuring that each Broker has an independent broker.id and storage path;
[0066] Start multiple Kafka Brokers: Start multiple Broker instances using different configuration files to form a Kafka cluster.
[0067] Create a Topic: Use Kafka's built-in tools to create a Topic and specify the number of partitions and replication factor.
[0068] Verify Topic configuration: Confirm that Topic is created successfully, and check whether its partition and replica configurations are correct;
[0069] Configure Kafka producer: The task manager configures the connection parameters of the Kafka producer, including the bootstrap.servers of the Kafka cluster, using the default String serialization;
[0070] Send task message: The task manager sends the task message to the specified Topic, which contains the task ID, node ID, and resource requirement parameters;
[0071] Configure Kafka consumers: The local scheduler configures Kafka consumers, sets the consumer group ID and bootstrap.servers, determines the message deserialization method, and ensures that the received message format is correct;
[0072] Consuming task messages: The local scheduler consumes task messages from the specified Topic, parses the task messages and extracts task information to execute power tasks based on it.
[0073] In the above example, Apache Kafka is used as a distributed message queue. This high-performance and scalable distributed message queue can improve the real-time and reliability of the power system, ensure that task information is transmitted quickly and accurately in a distributed environment, and effectively support the operation of large-scale distributed systems.
[0074] Figure 3 It is a structural block diagram of another power task execution device provided by an embodiment of the present invention. This embodiment is optimized based on the above-mentioned technical solutions. In this embodiment, optionally, the local scheduler may include a container creation module and a resource usage restriction configuration module; wherein the container creation module is used to create a target container for the power task according to the resource demand parameters represented by the received task information; the resource usage restriction configuration module is used to configure resource usage restrictions for the target container. Among them, the explanations of the terms that are the same or corresponding to the above-mentioned embodiments are not repeated here.
[0075] For details, see Figure 3 The power task execution device described in this embodiment can be deployed on a power system, which may include multiple nodes. The power task execution device may include a task manager 10 and a local scheduler 20 respectively deployed on each node. The local scheduler 20 may include a container creation module 201 and a resource usage restriction configuration module 202; wherein,
[0076] The task manager 10 is used to determine a target node for executing the power task from each node for executing the power task to be executed, assign the power task to the target node, and notify the task information of the power task to the local scheduler 20 deployed on the target node;
[0077] The container creation module 201 is used to create a target container for the power task according to the resource requirement parameters represented by the received task information;
[0078] A resource usage limit configuration module 202, used to configure resource usage limits for a target container;
[0079] The local scheduler 20 may also be used to deploy the power task to the target container to execute the power task in the target container, and during the execution of the power task, monitor the container resource usage of the target container and the task execution status of the power task;
[0080] The local scheduler 20 is further configured to adjust the resource usage limit when it is determined that the resource usage limit needs to be adjusted based on the task execution status and the container resource usage rate, so as to continue to execute the power task based on the resource usage limit in the target container.
[0081] The power task execution device described in the embodiment of the present invention creates an independent target container for the power task according to the resource demand parameters represented by the received task information through the container creation module; then, the resource usage restriction is configured for the target container through the resource usage restriction configuration module. The above two modules cooperate with each other to achieve effective resource isolation and management.
[0082] In an optional technical solution, the local scheduler may further include a target container template determination module, and the container creation module may include a resource requirement parameter determination unit and a container creation unit; wherein,
[0083] A target container template determination module, which can be used to determine the task type of the power task according to the received task information, and determine a target container template matching the task type from at least one preset container template, wherein the target container template stores container configuration information;
[0084] A resource requirement parameter determination unit, which can be used to determine the resource requirement parameters of the power task during execution according to the received task information;
[0085] The container creation unit may be used to create a target container for a power task according to container configuration information and resource requirement parameters.
[0086] Among them, corresponding preset container templates are preset for different task types respectively. In this way, through the target container template determination module, the task type of the power task can be determined according to the received task information, and then the target container template matching the task type is determined from all the preset container templates obtained in advance, and the target container template stores the container configuration information of the target container to be created.
[0087] Furthermore, through the container creation unit, according to the container configuration information and resource requirement parameters, a target container can be created for the power task, thereby achieving effective creation of the target container.
[0088] The above technical solution, by pre-making corresponding preset container templates for different task types, can quickly create a target container by combining each preset container template and the task type of the power task.
[0089] On this basis, combined with the application scenarios that this technical solution may involve, optionally, the process of creating the target container can be implemented in the following ways:
[0090] Power task classification and priority setting: Power tasks are classified according to their task type and importance, and priorities are set for each task type. This ensures that high-priority power tasks are allocated resources first and executed quickly, while low-priority power tasks are executed when resources are sufficient. Priority setting ensures the real-time execution of key power tasks.
[0091] Container template and parameter setting: Create preset container templates for power tasks of different task types, including container configuration information (such as basic image, file system, and basic resource configuration, etc.), so as to select the corresponding preset container template based on the task type to create the target container;
[0092] Dynamic container configuration: When the target container is created, it is dynamically configured according to the real-time needs of the power task;
[0093] Container lifecycle management: The power system manages the lifecycle of the target container in real time, including creation, startup, suspension, resumption, and destruction; dynamically adjusts the operating status of the target container according to the task status and priority to improve resource utilization efficiency;
[0094] Container startup and configuration: Use the preset container configuration file to start the target container, thereby ensuring resource isolation and environmental security of the target container;
[0095] The resource usage restriction strategy is based on the control group (cgroup) and real-time monitoring module to dynamically adjust the resource usage restrictions of the target container;
[0096] Independent network environment: The target container of each power task has an independent virtual network interface, which is logically isolated from the main system and other target containers. VLAN or VxLAN technology is used to create a virtual network environment in the power system to provide a virtualized network interface for the target container.
[0097] Power task communication mechanism: The communication between target containers is realized through the distributed soft bus of the power system, which can ensure seamless coordination and efficient data transmission between multiple power tasks running in different target containers, while maintaining the security of network isolation and avoiding communication bottlenecks caused by network isolation; the power system uses the Remote Procedure Call Protocol (RPC) protocol to exchange data between different target containers to ensure communication efficiency and real-time performance.
[0098] On this basis, the container creates units, which are specifically used to:
[0099] Obtain a pre-created container pool, wherein the container pool stores at least one basic container, and each basic container is in a dormant state;
[0100] A target container is determined from at least one basic container according to the container configuration information and the resource requirement parameters, and the target container is started by waking up the dormant state of the target container to create a complete target container for the power task.
[0101] The above technical solution realizes the rapid creation of the target container by pre-building a container pool.
[0102] On this basis, combined with the application scenarios that this technical solution may involve, optionally, the process of creating the target container can be implemented in the following ways:
[0103] Pre-created container pool: When the power system is initialized, multiple basic containers are pre-created according to the task type, and these basic containers are in a dormant state.
[0104] Maintain dynamic adjustment of the container pool: Dynamically adjust the size of the container pool based on historical data of power tasks. For example, the size of the container pool can be set based on the maximum value of resources consumed by the power tasks executed by the container pool for the previous n times. When the power system detects that the number of basic containers in the container pool is lower than the preset number threshold, new basic containers are automatically added to the container pool.
[0105] Quick allocation when a task is triggered: When a new power task is triggered, a suitable basic container can be selected from the container pool according to the task type of the power task, and quickly started by waking up the dormant state, thereby improving the response speed of the power task. In addition, dynamic parameters (such as CPU, memory, and network configuration, etc.) can be injected according to resource demand parameters, and the injection of dynamic parameters can be completed through configuration files.
[0106] On this basis, optionally, the dormant state can be quickly awakened and configured to start through an event-driven mechanism. Specifically, a time listener is set for each task type to monitor the task trigger time in real time, and then when the corresponding power task occurs, the time listener immediately triggers the corresponding container startup process.
[0107] For example, assuming that a power task has high real-time and dynamic resource requirements, the specific implementation is as follows:
[0108] Pre-create container pool:
[0109] When the power system is initialized, 10 basic containers are pre-created and are in a dormant state.
[0110] Combining templated startup with hot startup:
[0111] Create a task template library, including high-priority task templates and common task templates.
[0112] When a power task is triggered, a basic container can be selected from the container pool, dynamic parameters (such as network configuration and memory limit, etc.) can be injected according to the task type, and it can be started quickly.
[0113] Hierarchical startup and parallel resource configuration:
[0114] The container base layer preloads the file system and virtual network interface; the real-time layer processes network configuration, resource usage restrictions, and task scheduling in parallel, reducing startup time through multi-threading.
[0115] Event-driven mechanism:
[0116] Set an event listener for the power task. When a task event is triggered, immediately evaluate the task priority and trigger the container to start. High-priority tasks are allocated resources from the container pool first, and the corresponding containers are started quickly.
[0117] Automated lifecycle management:
[0118] The power system monitors the status of containers in real time and automatically pauses or destroys target containers based on task completion. Through intelligent prediction and feedback mechanisms, the scale of the container pool and resource allocation strategy are dynamically adjusted to ensure efficient resource utilization.
[0119] In the above example, the event-driven mechanism is used to ensure that resources can be allocated and containers can be started quickly after the power task is triggered, which greatly reduces the delay in starting the power task and meets the real-time requirements of the power grid.
[0120] Another optional technical solution is that the local scheduler also includes a resource usage restriction adjustment module; wherein,
[0121] A resource usage restriction configuration module, specifically used to configure resource usage restrictions for the target container by using the control group allocated to the target container when the target container is created;
[0122] The resource usage limit adjustment module is used to adjust the resource usage limit by using the control group when it is determined that the resource usage limit needs to be adjusted according to the task execution status and the container resource usage rate, so as to continue to execute the power task based on the resource usage limit in the target container.
[0123] The above technical solution configures and adjusts resource usage restrictions through a control group (cgroup), thereby achieving effective processing of resource usage restrictions.
[0124] On this basis, combined with the application scenarios that this technical solution may involve, optionally, dynamic adjustment of resource usage restrictions can be achieved in the following ways:
[0125] Container resource control group initialization: Each target container is assigned a separate cgroup when it is created to limit its resources such as CPU and memory.
[0126] Dynamic adjustment interface: The power system provides an interface for interacting with cgroups. When the local scheduler determines to adjust container resources, the cgroup parameters can be modified through this interface. For example, when the CPU limit of a target container needs to be increased, the power system can increase the CPU share by adjusting the cpu.shares parameter of the cgroup corresponding to the target container; similarly, when the memory limit needs to be increased, the memory.limit_in_bytes parameter of the corresponding cgroup can be modified.
[0127] After the resource adjustment is completed, the cgroup interface can feed back the adjustment results to the local scheduler, and the local scheduler can re-evaluate the resources to ensure that the adjustment effect meets expectations.
[0128] If the adjustment effect is not ideal (for example, the load is still too high), the power system further performs resource optimization until the resource allocation meets the power task requirements or reaches the maximum resource usage limit set by the power system.
[0129] During the dynamic adjustment process, the power system can also have the ability to recover resources and optimize dispatch.
[0130] Resource recycling: When a power task is completed or the load decreases, the power system can automatically reduce the resource usage limit of the corresponding container and recycle excess resources for use by other high-priority power tasks;
[0131] Scheduling optimization: Based on real-time resource usage and the overall load status of the power system, the power system can perform global scheduling optimization for all containers to ensure efficient use of resources and stable operation of the system.
[0132] In order to better understand the above-mentioned technical solutions as a whole, a specific example is given here for illustrative explanation. For example, the power system is developed on the basis of the Hongmeng system. Figure 4 As shown, the real-time scheduling and resource isolation management method for multiple power tasks in the power Hongmeng system specifically includes the following steps:
[0133] Step 1: The task manager evaluates the comprehensive resource utilization score of each node, and selects the node with the lowest comprehensive resource utilization score as the target node, and assigns the power task to the target node. Here, global scheduling is performed through resource evaluation to ensure that the power task is assigned to the most suitable node.
[0134] Step 2: The task manager notifies the local scheduler on the target node through the distributed message queue. The distributed message queue is used here to realize real-time communication between nodes, thereby improving the response speed of the power system.
[0135] Step 3: After the local scheduler receives the task information, it can use the container engine to create an independent target container based on the resource requirement parameters of the power task, and configure the resource usage restrictions of the target container, thereby achieving fine-grained resource isolation and ensuring the stable operation of each power task.
[0136] Step 4: The local scheduler deploys the power task to the target container and starts execution, continuously monitoring the container resource usage and task execution status in the target container; if an exception occurs during the execution process, the local scheduler will feed back the collected exception results to the task manager so that the task manager can reallocate or adjust the task scheduling strategy based on the feedback exception results. In this way, the power system can promptly detect and handle abnormal situations and dynamically adjust the task scheduling strategy.
[0137] Step 5: After the power task is executed, the local scheduler notifies the task manager to record the task execution result of the power task, and destroys the target container to release the resources occupied by the target container, thereby improving resource utilization efficiency.
[0138] In the above example, the collaborative work of the task manager, distributed message queue, local scheduler, container engine and resource isolation technology ensures that multiple power tasks in the power system can be scheduled in real time and executed efficiently. The dynamic configuration, resource usage restriction and lifecycle management mechanism of the target container ensure the resource isolation and security between power tasks, and adapt to the power system's requirements for real-time and high availability.
[0139] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A power task execution device, characterized in that: Deployed in an electric power system, the electric power system includes a plurality of nodes, the device includes a task manager and a local scheduler respectively deployed on each of the nodes: wherein, The task manager is used to determine, for the power task to be executed, a target node for executing the power task from each of the nodes, assign the power task to the target node, and notify the task information of the power task to a local scheduler deployed on the target node; The local scheduler is used to create a target container for the power task according to the resource requirement parameters represented by the received task information, and configure resource usage restrictions for the target container; The local scheduler is further used to deploy the power task to the target container to execute the power task in the target container, and during the execution process, monitor the container resource usage rate of the target container and the task execution status of the power task; The local scheduler is further configured to adjust the resource usage restriction when it is determined that the resource usage restriction needs to be adjusted based on the task execution status and the container resource usage rate, so as to continue to execute the power task based on the resource usage restriction in the target container.
2. The device according to claim 1, characterized in that The task manager includes a target node determination module, a power task allocation module and a task information notification module; wherein, The target node determination module is used to determine, for a power task to be executed, a target node for executing the power task from among the nodes; The power task allocation module is used to allocate the power task to the target node; The task information notification module is used to notify the local scheduler deployed on the target node of the task information of the power task.
3. The device according to claim 2, characterized in that The target node determination module includes a data collection unit, a comprehensive resource usage determination unit and a target node determination unit; wherein, The data collection unit is used to collect the node resource usage rate and the power task queue length of each of the nodes in all the nodes; The comprehensive resource usage determination unit is used to determine the comprehensive resource usage of the node according to the node resource usage rate and the power task queue length; The target node determination unit is used to determine the target node for executing the power task from all the nodes according to the comprehensive resource usage conditions corresponding to all the nodes respectively.
4. The device according to claim 3, characterized in that For node i among all the nodes, the comprehensive resource usage determination unit is specifically used to: The comprehensive resource usage CRUS of the node i is determined by the following formula: i : Among them, C i represents the CPU usage of the node i, M i represents the memory usage of the node i, S i represents the storage usage of the node i, B i represents the network bandwidth usage of node i, Q i represents the power task queue length of the node i, Q max represents the maximum value of the power task queue length among the power task queue lengths corresponding to all the nodes, w x 、w m 、w s 、w b and q Both represent weights.
5. The device according to claim 2, characterized in that The task information notification module is specifically used to: The task information of the power task is notified to the local scheduler deployed on the target node through a preset distributed message queue.
6. The device according to claim 1, characterized in that The local scheduler includes a container creation module and a resource usage restriction configuration module; wherein, The container creation module is used to create a target container for the power task according to the resource requirement parameters represented by the received task information; The resource usage restriction configuration module is used to configure resource usage restrictions for the target container.
7. The device according to claim 6, characterized in that The local scheduler also includes a target container template determination module, and the container creation module includes a resource requirement parameter determination unit and a container creation unit; wherein, The target container template determination module is used to determine the task type of the power task according to the received task information, and determine a target container template matching the task type from at least one preset container template, wherein the target container template stores container configuration information; The resource requirement parameter determination unit is used to determine the resource requirement parameters of the power task during execution according to the received task information; The container creation unit is used to create a target container for the power task according to the container configuration information and the resource requirement parameters.
8. The device according to claim 7, characterized in that The container creation unit is specifically used for: Acquire a pre-created container pool, wherein the container pool stores at least one basic container, and each of the basic containers is in a dormant state; According to the container configuration information and the resource requirement parameter, a target container is determined from at least one of the basic containers, and the target container is started by waking up the dormant state of the target container, so as to complete the creation of the target container for the power task.
9. The device according to claim 6, characterized in that The local scheduler also includes a resource usage restriction adjustment module; wherein, The resource usage restriction configuration module is specifically used to configure resource usage restrictions for the target container by using the control group allocated to the target container when the target container is created; The resource usage limit adjustment module is used to adjust the resource usage limit using the control group when it is determined that the resource usage limit needs to be adjusted based on the task execution status and the container resource usage rate, so as to continue to execute the power task based on the resource usage limit in the target container.
10. The device according to claim 1, characterized in that: The local scheduler is further configured to feed back the collected abnormal situation to the task manager when it is determined that the power task is abnormally executed according to the task execution status; The task manager is further used to adjust the task scheduling strategy applied when scheduling the power task according to the received abnormal situation, and re-determine the target node to re-schedule the power task according to the task scheduling strategy.