Cluster resource occupancy graph generation method and device, equipment, medium and program product
By drawing a cluster resource occupancy graph and mapping it based on task time and the number of node devices, the problem of incomplete information display in cluster resource monitoring is solved, and intuitive display and convenient analysis of multi-dimensional data are realized.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-29
- Publication Date
- 2026-04-03
AI Technical Summary
In existing technologies, the information display of cluster resource monitoring is not comprehensive enough and is inefficient, making it difficult to intuitively reflect the multi-dimensional relationship between tasks and node devices through a single tool.
By acquiring task data from node devices in the cluster, a resource usage graph is drawn based on the task's start time, end time, and the number of node devices it occupies. This graph includes a mapping of task start time, end time, and the number of node devices. The drawing order is determined according to the task's start time and runtime, and icons associated with the tasks are drawn to achieve an intuitive display of multi-dimensional data.
A single resource utilization graph reflects the multi-dimensional mapping between tasks and node devices, improving the effectiveness and convenience of cluster data display. Users can perform multi-dimensional task data analysis and operation and maintenance optimization decisions based on a single graph.
Smart Images

Figure CN121785877A_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of computer technology, and in particular to a method, apparatus, device, medium and program product for generating a cluster resource occupancy map. Background Technology
[0002] A cluster connects multiple computers or servers via a network, allowing them to share resources and perform tasks collaboratively. This technology can significantly improve computing performance, data processing capabilities, and system reliability. The computers or servers in a cluster are called nodes, and they work together to provide more processing power and greater data redundancy than a single computer.
[0003] In related technologies, electronic devices typically call third-party analysis tools (openTSDB) to achieve real-time monitoring of cluster information, but the comprehensiveness and display efficiency of information displayed on the resource graph still need to be improved. Summary of the Invention
[0004] To overcome the problems existing in related technologies, this disclosure provides a method, apparatus, device, medium and program product for generating a cluster resource occupancy map, which makes the information displayed in the resource occupancy map richer and improves the effectiveness and convenience of cluster data display.
[0005] According to a first aspect of the present disclosure, a method for generating a cluster resource occupancy graph is provided, comprising:
[0006] Obtain task data for each task running on the node devices in the cluster; wherein, the task data includes the start time of the task, the end time of the task, and the number of node devices occupied by the task;
[0007] A resource occupancy graph is drawn based on the start time, end time, and number of node devices occupied by each task; wherein, the resource occupancy graph includes a mapping between the start time, end time, and number of node devices occupied by each task.
[0008] In some embodiments, drawing a resource usage map based on the start time, end time, and number of node devices occupied by each task includes:
[0009] For each task, the runtime is determined based on the task's start and end times.
[0010] The drawing order of each task is determined based on its start time and runtime.
[0011] Based on the start time, runtime, and number of node devices occupied by each task, determine the drawing area of each task on the resource occupancy map;
[0012] In the order in which the tasks are drawn, draw the icons associated with the tasks in the drawing area corresponding to each task in the resource occupancy graph.
[0013] In some embodiments, determining the drawing order of each task based on its start time and runtime includes:
[0014] In response to tasks with different start times, the drawing order of each task is determined to be positively correlated with the start time of the task;
[0015] In response to the existence of tasks with the same start time, the task with a runtime shorter than a preset duration threshold is identified among the tasks with the same start time, and the task with a runtime longer than or equal to the preset duration threshold is drawn.
[0016] In some embodiments, determining the drawing area of each task on the resource occupancy graph based on the start time, runtime, and number of node devices occupied by each task includes:
[0017] In response to the existence of tasks with the same start time, the drawing area of the task with a start time less than a preset duration threshold overlaps with the drawing area of the task with a start time greater than or equal to the preset duration threshold.
[0018] In some embodiments, the resource occupancy graph includes a first coordinate axis and a second coordinate axis perpendicular to the first coordinate axis; the start and end points of the task-associated icon in the first coordinate axis direction are associated with the start and end times of the task, and the start and end points of the task-associated icon in the second coordinate axis direction are associated with the number of node devices occupied by the task.
[0019] In some embodiments, determining the drawing area of each task on the resource occupancy graph based on the start time, runtime, and number of node devices occupied by each task includes:
[0020] For each task, the starting point of the task in the resource occupation graph is determined based on the task's start time and the number of node devices it occupies. The task's runtime is determined as the first drawing length in the first coordinate axis direction, and the number of node devices occupied by the task is determined as the second drawing length in the second coordinate axis direction.
[0021] Based on the drawing starting point, the first drawing length, and the second drawing length corresponding to each task, the drawing area of each task on the resource occupancy map is determined.
[0022] In some embodiments, the drawing starting point includes a first drawing coordinate and a second drawing coordinate;
[0023] Determining the starting point of the resource occupancy graph corresponding to the task based on the task's start time and the number of node devices it occupies includes:
[0024] Based on the task's start time, determine the task's first drawing coordinates in the direction of the first coordinate axis;
[0025] Based on the number of node devices occupied by the task, the second drawing coordinate of the task on the second coordinate axis is determined; wherein the drawing areas of different tasks do not overlap in the direction of the second coordinate axis.
[0026] In some embodiments, determining the second drawing coordinates of the task on the second coordinate axis based on the number of node devices occupied by the task includes:
[0027] Based on the number of node devices occupied by the task, multiple second drawing coordinates of the task on the second coordinate axis are determined, as well as the second drawing length associated with each second drawing coordinate; wherein, the sum of the second drawing lengths associated with all second drawing coordinates is the same as the number of node devices occupied by the task.
[0028] In some embodiments, the method further includes:
[0029] Within a preset time range, the runtime of each task is determined based on the start and end times of each task in the resource occupancy graph within the preset time range.
[0030] The resource usage within the preset time range is determined by summing the products of the runtime of each task within the preset time range and the number of node devices occupied by the task.
[0031] The total amount of resources is determined by multiplying the duration corresponding to the preset time range with the preset total number of node devices in the cluster.
[0032] Based on the ratio of the resource usage to the total resource amount, the resource utilization rate of the cluster within the preset time range is determined.
[0033] According to a second aspect of the present disclosure, an apparatus for generating a cluster resource occupancy map is provided, comprising:
[0034] The acquisition module is used to acquire task data of each task running on the node devices in the cluster; wherein, the task data includes the start time of the task, the end time of the task, and the number of node devices occupied by the task;
[0035] The drawing module is used to draw a resource occupancy map based on the start time, end time, and number of node devices occupied by each task; wherein, the resource occupancy map includes a mapping between the start time, end time, and number of node devices occupied by each task.
[0036] The drawing module is further configured to, for each task, determine the runtime of the task based on the start time and end time of the task; determine the drawing order of each task based on the start time and runtime of each task; determine the drawing area of each task on the resource occupancy map according to the start time, runtime of each task and the number of node devices occupied by each task; and draw the task-related icon in the drawing area corresponding to the task in the resource occupancy map according to the drawing order of each task.
[0037] The drawing module is further configured to, in response to the existence of tasks with different start times, determine that the drawing order of each task is positively correlated with the start time of the task; and in response to the existence of tasks with the same start time, determine that among the tasks with the same start time, the task with a runtime shorter than a preset duration threshold is drawn earlier than the task with a runtime longer than or equal to the preset duration threshold.
[0038] The drawing module is further configured to respond to the existence of tasks with the same start time, wherein the drawing area of the task with a start time less than a preset duration threshold overlaps with the drawing area of the task with a start time greater than or equal to the preset duration threshold.
[0039] In some embodiments, the resource occupancy graph includes a first coordinate axis and a second coordinate axis perpendicular to the first coordinate axis; the start and end points of the task-associated icon in the first coordinate axis direction are associated with the start and end times of the task, and the start and end points of the task-associated icon in the second coordinate axis direction are associated with the number of node devices occupied by the task.
[0040] The drawing module is further configured to, for each task, determine the drawing start point of the task in the resource occupancy graph based on the task's start time and the number of node devices it occupies, determine the task's runtime as the first drawing length in the first coordinate axis direction, and determine the number of node devices occupied by the task as the second drawing length in the second coordinate axis direction; and determine the drawing area of each task in the resource occupancy graph based on the drawing start point, the first drawing length, and the second drawing length corresponding to each task.
[0041] The drawing starting point includes a first drawing coordinate and a second drawing coordinate; the drawing module is further configured to determine the first drawing coordinate of the task in the direction of the first coordinate axis based on the start time of the task; and to determine the second drawing coordinate of the task in the direction of the second coordinate axis based on the number of node devices occupied by the task; wherein the drawing areas of different tasks do not overlap in the direction of the second coordinate axis.
[0042] The drawing module is further configured to determine multiple second drawing coordinates of the task on the second coordinate axis based on the number of node devices occupied by the task, and a second drawing length associated with each second drawing coordinate; wherein the sum of the second drawing lengths associated with all the second drawing coordinates is the same as the number of node devices occupied by the task.
[0043] The device further includes a computing module, configured to: determine the runtime of each task within a preset time range based on the start and end times of each task in the resource occupancy graph; determine the resource usage within the preset time range based on the sum of the products of the runtime of each task within the preset time range and the number of node devices occupied by the task; determine the total resource amount based on the product of the duration corresponding to the preset time range and the preset total number of node devices in the cluster; and determine the resource occupancy rate of the cluster within the preset time range based on the ratio of the resource usage to the total resource amount.
[0044] According to a third aspect of the present disclosure, an electronic device is provided, comprising:
[0045] processor;
[0046] Memory used to store computer programs or instructions;
[0047] The processor executes the computer program or instructions to implement the steps of the method described in the first aspect above.
[0048] According to a fourth aspect of the present disclosure, a non-transitory computer-readable storage medium is provided, the storage medium storing a computer program or instructions that, when executed by a processor, implement the steps of the method described in the first aspect above.
[0049] According to a fifth aspect of the present disclosure, a computer program product is provided, including a computer program or instructions, which, when executed by a processor, implement the steps of the method described in the first aspect above.
[0050] The technical solutions provided by the embodiments of this disclosure may include the following beneficial effects:
[0051] In this embodiment of the disclosure, the electronic device acquires task data of each task running on the node devices in the cluster. Based on the task data of each task, a mapping is drawn that simultaneously reflects the relationship between the task and the task start time, as well as the task running time and the number of node devices occupied by the task. That is, on a single resource occupancy graph, the occupancy of node devices by each task in the cluster is displayed with the task as the smallest unit. It can reflect the first dimension of the mapping between the task start time and the number of nodes occupied by the task, and the second dimension of the mapping between the task running time and the number of nodes occupied. This makes the information displayed in the resource occupancy graph richer, and it is convenient for users to analyze the aforementioned task data in multiple dimensions through a single resource occupancy graph. The resource occupancy graph intuitively reflects the data relationship of the cluster in multiple dimensions, so that the personnel who operate and maintain the cluster and use the cluster can make relevant operation and maintenance optimization or usage decisions directly based on a single graph, thereby improving the effectiveness and convenience of cluster data display.
[0052] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure. Attached Figure Description
[0053] The accompanying drawings, which are incorporated in and form a part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure.
[0054] Figure 1 This is a flowchart illustrating a method for generating a cluster resource occupancy graph according to an exemplary embodiment.
[0055] Figure 2 This is a flowchart illustrating a data acquisition process in an embodiment of this disclosure.
[0056] Figure 3 This is a flowchart illustrating a data processing and drawing process in an embodiment of this disclosure.
[0057] Figure 4 This is a flowchart illustrating a resource utilization rate calculation method according to an embodiment of this disclosure.
[0058] Figure 5 This is a resource usage diagram shown in an embodiment of this disclosure.
[0059] Figure 6 This is a system flowchart illustrating a method for generating a cluster resource occupancy map according to an embodiment of this disclosure.
[0060] Figure 7 This is a block diagram of a cluster resource occupancy graph generation apparatus according to an exemplary embodiment.
[0061] Figure 8 This is a structural block diagram of an electronic device according to an exemplary embodiment. Detailed Implementation
[0062] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numerals in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this disclosure. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this disclosure as detailed in the appended claims.
[0063] In response, this disclosure provides a method for generating a cluster resource occupancy graph. Figure 1 This is a flowchart illustrating a method for generating a cluster resource occupancy graph according to an exemplary embodiment, such as... Figure 1 As shown, the method mainly includes the following steps:
[0064] S101. Obtain task data for each task running on the node devices in the cluster; wherein, the task data includes the start time of the task, the end time of the task, and the number of node devices occupied by the task.
[0065] S102. Draw a resource occupancy graph based on the start time, end time, and number of node devices occupied by each task; wherein, the resource occupancy graph includes a mapping between the start time, end time, and number of node devices occupied by each task.
[0066] The cluster resource occupancy map generation method provided in this disclosure is executed by an electronic device, such as a mobile phone, tablet computer, personal computer, wearable device, or in-vehicle device. In some possible implementations, the cluster resource occupancy map generation method can be implemented by a processor calling computer-readable instructions stored in memory.
[0067] In this embodiment of the disclosure, the cluster can be a World Wide Web cluster, a database cluster, a Graphics Processing Unit (GPU) cluster, a high-performance computing cluster, etc. The cluster consists of multiple computers or servers. A computer or server can be understood as a node device in the cluster. A node device in a cluster can be equipped with one or more processors. Tasks in the cluster can run on one or more node devices. The processors are, for example, a Central Processing Unit (CPU) or a Graphics Processing Unit (GPU). For example, a graphics processing cluster consists of multiple servers, with each node device configured as a server with eight GPUs.
[0068] In this embodiment of the disclosure, there are multiple ways for the electronic device to obtain task data of each task running by the node devices in the cluster. It can be that the electronic device sends a data request to the database that stores the cluster running data, and after obtaining the running data of each node device, determines the task data of each task based on the running data of each node device; or the electronic device can directly receive the task data obtained by the database based on the stored running data.
[0069] It should be noted that a single task can run in parallel on multiple node devices. The running data of the node devices contains a mapping relationship between the node devices and the tasks. In this embodiment of the disclosure, the electronic device can use the running data on multiple node devices to perform statistics and process the task data. The number of node devices running the task can be determined based on the number of different node devices corresponding to the task name in the running data; or it can be based on the multiple start times and end times of multiple node devices running the same task, taking the earliest start time of the task among the multiple node devices as the start time of the task and the latest end time of the task among the multiple node devices as the end time of the task.
[0070] In this embodiment of the disclosure, the database can record the running data of each task running on the node devices in the cluster through a running file. The format of the running file can be csv, xml, etc. The running file contains multiple data columns such as task name (job_name), request body (request_body), node information (pods_info), finish time (finish_time), and operator (operator) for each task running on the node devices.
[0071]
[0072] Table 1
[0073] Figure 2 This is a flowchart illustrating a data acquisition process in an embodiment of this disclosure. Table 1 is a task data table exemplarily shown in an embodiment of this disclosure, corresponding to tasks in a cluster. The task data in Table 1 is based on... Figure 2 The data acquisition process in the cluster obtains statistical data on the operation of various tasks on the node devices. The following is a combination of... Figure 2 Table 1 and its contents describe the process of acquiring task data. Figure 2 As shown, the process of acquiring task data using the data acquisition module L201 by the electronic device includes the following steps:
[0074] S201. Extract data from the task name column of the running file as the task name for each task;
[0075] In this embodiment of the disclosure, the task data may also include the task name. The electronic device can extract the task name of each task based on the data in the task name column of the node device running file, and obtain the task name "0528-16-train7b-datamatching-book0d2-rerun2" as shown in Table 1.
[0076] S202. Extract the value with the key "Number of graphics processing units used" from the request body column, and use it as the number of graphics processing units used for each task;
[0077] In this embodiment of the disclosure, if the request body column of the running file contains a key-value pair of "number of graphics processing units used" ("gpu_limit"), the electronic device can extract the value of "gpu_limit" through regular expression matching as the number of graphics processing units used by each task, resulting in the number of graphics processing units used as shown in Table 1, which is 8.
[0078] S203. Extract the value with the key "Number of Node Devices" from the request body column, and use it as the number of node devices for each task;
[0079] In this embodiment of the disclosure, the request body column of the running file contains key-value pairs for "number of node devices" ("worker_count"). The electronic device can extract the value of "worker_count" through regular expression matching, which is used as the number of node devices for each task, resulting in 16 node devices associated with the task as shown in Table 1.
[0080] S204. Extract objects containing the target field from the node information column;
[0081] In this embodiment of the disclosure, the node information (pods_info) includes multiple objects. Objects containing target fields include node device time-related data, which can be stored in key-value pairs, such as start time (GmtStartTime) and end time (GmtFinishTime). In this embodiment of the disclosure, the electronic device can extract objects with target fields (e.g., "-master-0") using regular expression matching to obtain the time data of the node device's running tasks.
[0082] S205. Determine if the object contains an "end time" key; if yes, proceed to S206; if no, proceed to S207.
[0083] S206. Extract the value corresponding to "End Time";
[0084] S207. Extract values from the termination time column;
[0085] S208. Extract all values with the key "start time";
[0086] In steps S206 and S208, the electronic device can use regular expressions to match and extract the values of "start time" and "end time" respectively, which are used as the start time and end time of the task running by each node device.
[0087] S209. Extract all values with the key "start time";
[0088] In steps S207 and S209, if there is no start time or end time for the task running by each node device, the electronic device can extract a value from the end time (finish_time) column as the end time of the task running by the node device, and extract a value from the start time (GmtCreateTime) column as the start time of the task running by the node device.
[0089] S210. Compare all the above values, take the earliest time as the task start time, and take the latest time as the task end time.
[0090] In this embodiment of the disclosure, the electronic device compares the results, such as the task start time in Table 1 being "2024-05-28T06:10:38Z", and takes the latest time as the task end time, such as the task end time in Table 1 being "2024-05-29T01:44:02Z".
[0091] S211. Extract the field from the operator column as the operator for each task.
[0092] In this embodiment of the disclosure, the electronic device can extract the operator information for each task from the operator column using regular expressions, such as "zhaokang5" for the task in Table 1.
[0093] In step S102, the electronic device can draw a resource occupancy map based on the start time, end time, and number of node devices occupied by each task in several ways. One method is to directly sort the task data according to the order of start times to obtain the drawing order of each task data, draw the corresponding icon of each task according to the drawing order, and generate a resource occupancy map. Another method is to first preprocess the task data to obtain the preprocessed start time and runtime, determine the drawing order based on the preprocessed start time and runtime, draw the corresponding icon of each task, and generate a resource occupancy map.
[0094] In this embodiment of the disclosure, the electronic device can reflect the mapping relationship between the start time, end time and number of node devices occupied by each task through the icons corresponding to each task. The icons are set as two-dimensional graphics, with one side of the icon set as the runtime of the task (the difference between the end time and the start time) and the other side set as the number of node devices occupied by the task. The graphic can be a rectangle, trapezoid, etc.; the number can be the median, average, or maximum value of the node devices within the runtime of the task.
[0095] In this embodiment of the disclosure, the resource occupancy map can be set as a grayscale map or a color map. The gray level of the icon corresponding to each task in the resource occupancy map can be set to be positively correlated with the area of the icon, or the color temperature of the icon corresponding to each task can be set to be positively correlated with the number of node devices corresponding to the task.
[0096] In related technologies, electronic devices call third-party analysis tools to perform simple statistics. For example, they aggregate cluster operation data, merging multiple data points into one to obtain the number of cluster nodes occupied at each time point, generating a graph showing the correspondence between a single time point and the number of occupied nodes. Another example is to bucket the cluster operation data to obtain the number of cluster nodes occupied at each time period, generating a graph showing the correspondence between the number of occupied nodes within each time period. In other words, these technologies do not perform data statistics by task dimension, and the generated data is only the single-dimensional data of the total number of cluster nodes occupied and time. When performing cluster operation and maintenance or use, it is necessary to switch back and forth between multiple statistical graphs to understand the cluster's resource usage from multiple dimensions, which is cumbersome and inefficient.
[0097] In this embodiment of the disclosure, the electronic device acquires task data of each task running on the node devices in the cluster. Based on the task data of each task, a mapping is drawn that simultaneously reflects the relationship between the task and the task start time, as well as the task running time and the number of node devices occupied by the task. That is, on a single resource occupancy graph, the occupancy of node devices by each task in the cluster is displayed with the task as the smallest unit. It can reflect the first dimension of the mapping between the task start time and the number of nodes occupied by the task, and the second dimension of the mapping between the task running time and the number of nodes occupied. This makes the information displayed in the resource occupancy graph richer, and it is convenient for users to analyze the aforementioned task data in multiple dimensions through a single resource occupancy graph. The resource occupancy graph intuitively reflects the data relationship of the cluster in multiple dimensions, so that the personnel who operate and maintain the cluster and use the cluster can make relevant operation and maintenance optimization or usage decisions directly based on a single graph, thereby improving the effectiveness and convenience of cluster data display.
[0098] In some embodiments, drawing a resource usage map based on the start time, end time, and number of node devices occupied by each task includes:
[0099] For each task, the runtime is determined based on the task's start and end times.
[0100] The drawing order of each task is determined based on its start time and runtime.
[0101] Based on the start time, runtime, and number of node devices occupied by each task, determine the drawing area of each task on the resource occupancy map;
[0102] In the order in which the tasks are drawn, draw the icons associated with the tasks in the drawing area corresponding to each task in the resource occupancy graph.
[0103] Figure 3 This is a flowchart illustrating a data processing and drawing process in an embodiment of this disclosure, such as... Figure 3 As shown, the data processing and rendering process of the electronic device after acquiring the task data includes the following steps:
[0104] S301. Import the task data obtained from data collection;
[0105] S302. Perform time zone conversion on some task data;
[0106] It should be noted that the time modes of the tasks running on the cluster may differ due to the different geographical locations of the task applications. In some tasks, the time mode is set to Greenwich Mean Time, which uses the 0 time zone; in other tasks, the time mode may be set to Beijing Time, which uses the East 8 time zone.
[0107] In this embodiment of the disclosure, the electronic device can convert the start and end times of a task to different time zones so that time data can be calculated based on the same time pattern. For example, the electronic device can revert the Beijing time in the task by 8 hours and convert it to Greenwich Mean Time.
[0108] S303. Some task data is abnormal; abnormal task data will not be plotted.
[0109] In this embodiment of the disclosure, the electronic device determines the task's runtime as the difference between the task's end time and start time. It should be noted that, considering the balance of processing efficiency and accuracy of the electronic device, in this embodiment, the electronic device can perform equivalent processing on the start time, end time, and runtime. For example, the start time within the time period from 12:00:01 to 12:59:59 can be equivalent to 12:00; another example is that the runtime within the range of greater than 0 hours and less than 1 hour can be equivalent to 1 hour.
[0110] In this embodiment, the electronic device can perform anomaly detection on the task data before drawing, and can remove abnormal task data. Abnormal data can be abnormal time data or abnormal numbers of node devices occupied by a task. For example, negative numbers may occur for start time, end time, or runtime; or decimal numbers may occur for the number of node devices occupied by a task. In this embodiment, the electronic device identifies abnormal task data as invalid data. Removing abnormal data reduces the likelihood of invalid task data being drawn on the resource occupancy graph, improving the accuracy of the resource occupancy graph display.
[0111] In this embodiment of the disclosure, the electronic device can determine the drawing order of each task based on the start time and runtime of each task in several ways. It can sort the tasks according to the order of their start times and arrange the tasks with the same start time in order of their runtime; or it can sort the tasks according to the order of their start times and arrange the tasks with the same start time and runtime shorter than the preset runtime at the front, as in step S304 below.
[0112] S304. First, sort the task data by start time. Then, for task data with the same start time, put the ones with a running time of one hour first.
[0113] In this embodiment of the disclosure, the electronic device sets the preset runtime to one hour. For each task with the same start time, the task data with a runtime of one hour is placed before the task data with the same start time.
[0114] S305, Task data occupancy detection and split drawing;
[0115] In this embodiment of the disclosure, the electronic device performs occupancy detection. In response to the task data drawing area being occupied, it redetermines the task data drawing area. There are multiple ways to redetermine it, such as redetermining a continuous drawing area or splitting the task drawing area into multiple sub-drawing areas.
[0116] S306, Drawing the border of the task data rectangle.
[0117] In this embodiment of the disclosure, the electronic device can determine the starting point (start time), first drawing length (running time), and second drawing length (number of node devices occupied) of the drawing area of each task on the resource occupation graph according to the start time, running time, and number of node devices occupied by each task, and draw the icons associated with the task according to the determined drawing order; wherein, the border of the icon is determined by the running time and the number of node devices occupied.
[0118] In this embodiment of the disclosure, the electronic device determines the drawing order based on the start time and runtime, and draws the icons associated with the tasks on the resource occupancy graph in the drawing order, displaying the task data with icons. Through the icons, the relationship between the runtime associated with a single task and the number of node devices occupied, as well as the occupancy of a single task in both the time dimension and the device occupancy dimension, can be more intuitively understood, thus improving the intuitiveness of the resource occupancy graph.
[0119] In some embodiments, determining the drawing order of each task based on its start time and runtime includes:
[0120] In response to tasks with different start times, the drawing order of each task is determined to be positively correlated with the start time of the task;
[0121] In response to the existence of tasks with the same start time, the task with a runtime shorter than a preset duration threshold is identified among the tasks with the same start time, and the task with a runtime longer than or equal to the preset duration threshold is drawn.
[0122] In this embodiment of the disclosure, the start times of each task can be the same or different. In response to the existence of tasks with different start times, the electronic device determines that the drawing order of each task is positively correlated with the start time of the task. For example, a task with a start time of 12:00 is placed before a task with a start time of 14:00.
[0123] In this embodiment of the disclosure, in response to the existence of tasks with the same start time, tasks with a runtime shorter than a preset duration threshold are identified, and tasks with a runtime longer than or equal to the preset duration threshold are drawn earlier. Tasks with a runtime shorter than the preset duration threshold can be sorted again by runtime, ensuring the drawing order is positively correlated with runtime. For example, if task 1 and task 2 both start at 12:00, task 1 has a runtime of 1 hour, and task 2 has a runtime of 3 hours, task 1, starting at 12:00, is placed before task 2. The electronic device will first draw task 1 (1 hour) and then draw task 2 (3 hours).
[0124] In this embodiment of the disclosure, the electronic device initially sorts the task data according to the order of their start times, and then arranges the tasks with the same start time that have a runtime shorter than a preset duration threshold first. This makes it easier to draw the task data in the order of their start times, and to draw the tasks with shorter runtimes first within the same start time. This minimizes the number of times and the difficulty of determining the occupancy detection when determining the drawing area, and improves the drawing speed of the resource occupancy map.
[0125] In some embodiments, determining the drawing area of each task on the resource occupancy graph based on the start time, runtime, and number of node devices occupied by each task includes:
[0126] In response to the existence of tasks with the same start time, the drawing area of the task with a start time less than a preset duration threshold overlaps with the drawing area of the task with a start time greater than or equal to the preset duration threshold.
[0127] In this embodiment of the disclosure, in response to the existence of tasks with the same start time, the electronic device overlaps the drawing area of the task with the same start time but less than a preset duration threshold with the drawing area of the task with the same start time but greater than or equal to the preset duration threshold. This can be done by overwriting the drawing area of the task with the same start time but less than the preset duration threshold with the drawing area of the task with the same start time but less than the preset duration threshold; or by merging the drawing area of the task with the same start time but less than the preset duration threshold with the drawing area of the task with the same start time but greater than or equal to the preset duration threshold.
[0128] In this embodiment of the disclosure, the design can be based on a visual precision of 1 hour (a preset duration threshold), allowing the end time of one task and the start time of another task to overlap by one hour. For example, a drawing component can be used to set the last hour of each task to blank, indicating that the last hour can overlap with other tasks. Therefore, for several tasks with the same start time, tasks with a runtime of one hour are placed first, achieving overlapping drawing with tasks that start at the same time and have a runtime longer than one hour. For instance, task 3 has a runtime of 2 hours and occupies 1 node device, while task 4 has a runtime of 1 hour and occupies 1 node device. If task 4 is drawn first, it will occupy the position at the vertical coordinate 1. Since the last hour of each task is set to blank (not occupied), when drawing task 3, it will still occupy the position at the vertical coordinate 1, achieving overlap.
[0129] It should be noted that when drawing resource usage maps for electronic devices, there may be multiple tasks with the same start time but different runtimes. Usually, when analyzing and making decisions about the use of cluster resources, users tend to focus on tasks with longer runtimes. Tasks with shorter runtimes are displayed in a relatively small area on the overall resource usage map and are less relevant to users' analysis and decision-making regarding cluster adjustment plans.
[0130] In this embodiment of the present disclosure, the electronic device will overlap with tasks whose duration is less than a preset duration threshold within the same start time, and tasks whose duration is greater than or equal to the preset duration threshold. This will hide the drawing of tasks whose runtime is less than the preset duration threshold, reduce the interference of tasks with less impact on resource utilization on user decision-making, and allow users to focus on tasks with greater impact on resource utilization, thereby improving the usability of the resource utilization graph.
[0131] In some embodiments, the resource occupancy graph includes a first coordinate axis and a second coordinate axis perpendicular to the first coordinate axis; the start and end points of the task-associated icon in the first coordinate axis direction are associated with the start and end times of the task, and the start and end points of the task-associated icon in the second coordinate axis direction are associated with the number of node devices occupied by the task.
[0132] In this embodiment of the disclosure, for example, the first coordinate axis is the horizontal axis and the second coordinate axis is the vertical axis. The first coordinate axis can be a coordinate axis for associated time, and the second coordinate axis can be a coordinate axis for the number of associated node devices. For example, the starting point of the task-associated icon in the first coordinate axis direction represents the start time of the task, and the ending point in the first coordinate axis direction represents the end time of the task; the length between the starting and ending points of the task-associated icon in the second coordinate axis direction represents the number of node devices occupied by the task. However, it should be noted that in this embodiment of the disclosure, there may be multiple task-associated icons. For example, there may be multiple icons associated with the same task in the second coordinate axis direction, and the sum of the lengths of the multiple icons in the second coordinate axis direction represents the number of node devices occupied by the task. In some embodiments, determining the drawing area of each task on the resource occupancy map based on the start time, runtime, and number of node devices occupied by each task includes:
[0133] For each task, the starting point of the task in the resource occupation graph is determined based on the task's start time and the number of node devices it occupies. The task's runtime is determined as the first drawing length in the first coordinate axis direction, and the number of node devices occupied by the task is determined as the second drawing length in the second coordinate axis direction.
[0134] Based on the drawing starting point, the first drawing length, and the second drawing length corresponding to each task, the drawing area of each task on the resource occupancy map is determined.
[0135] In this embodiment of the disclosure, for each task, the electronic device may take any coordinate point on the second coordinate axis corresponding to the start time as the drawing start point of the task. The drawing start points of multiple tasks with the same start time may be the same or different. The running length of the task is determined as the first drawing length in the direction of the first coordinate axis, and the number of node devices occupied by the task is determined as the second drawing length in the direction of the second coordinate axis.
[0136] In this embodiment of the disclosure, the electronic device determines the drawing area of each task on the resource occupancy map based on the drawing start point, the first drawing length, and the second drawing length. The drawing areas of different tasks may partially overlap in the direction of the first coordinate axis and / or the direction of the second coordinate axis.
[0137] In this embodiment of the disclosure, the electronic device determines the drawing starting point based on the start time, and determines the drawing length of the drawing area on both vertical sides according to the running time of the task and the number of power-saving devices occupied, thus outlining the drawing area of the task. In this way, the drawing area can intuitively reflect the relationship between the running time associated with a single task and the number of node devices occupied. The area size of a single task can comprehensively reflect the overall occupation of the task in the two dimensions of time and device occupation during the operation, further improving the intuitiveness of the resource occupation map.
[0138] In some embodiments, the drawing starting point includes a first drawing coordinate and a second drawing coordinate;
[0139] Determining the starting point of the resource occupancy graph corresponding to the task based on the task's start time and the number of node devices it occupies includes:
[0140] Based on the task's start time, determine the task's first drawing coordinates in the direction of the first coordinate axis;
[0141] Based on the number of node devices occupied by the task, the second drawing coordinate of the task on the second coordinate axis is determined; wherein the drawing areas of different tasks do not overlap in the direction of the second coordinate axis.
[0142] In this embodiment of the disclosure, the electronic device can achieve the method that the drawing areas of different tasks do not overlap in the second coordinate axis direction. This can be achieved by the electronic device detecting the occupancy of the drawing area in the second coordinate axis direction corresponding to the start time of the task. If there is a drawing area of a task that started running before the start time (an occupied drawing area), in some embodiments, the electronic device uses the first drawing coordinate and the second drawing coordinate to set a continuous drawing area and skips the occupied drawing area on the second coordinate axis. In other embodiments, the electronic device uses the first drawing coordinate and the second drawing coordinate to form multiple sub-drawing areas and sets multiple sub-drawing areas to surround the occupied drawing area in the second coordinate axis direction.
[0143] In this embodiment of the disclosure, the electronic device controls the drawing areas of different tasks to prevent them from overlapping in the direction of the second coordinate axis, so as to accurately observe the amount of resources occupied by each task through the resource occupancy map, thereby improving the accuracy of the resource occupancy map display.
[0144] In some embodiments, determining the second drawing coordinates of the task on the second coordinate axis based on the number of node devices occupied by the task includes:
[0145] Based on the number of node devices occupied by the task, multiple second drawing coordinates of the task on the second coordinate axis are determined, as well as the second drawing length associated with each second drawing coordinate; wherein, the sum of the second drawing lengths associated with all second drawing coordinates is the same as the number of node devices occupied by the task.
[0146] In this embodiment of the disclosure, the electronic device can determine multiple second drawing coordinates of the task on the second coordinate axis based on the number of node devices occupied by the task. This can be done by determining multiple second drawing coordinates according to the number of node devices corresponding to the occupied drawing area in the direction of the second coordinate axis.
[0147] For example, the task starts at 12:00 and takes 10 hours to run on 10 node devices. The starting point of the drawing area corresponding to this task can be (12,0). The first drawing length is 10 and the second drawing length is also 10. If there is a drawing area that has been occupied in the direction of the second coordinate axis composed of the two coordinates (12,6) and (12,8), the task can be split into two sub-drawing areas, namely sub-drawing area one composed of (12,0) and (12,5) and sub-drawing area two composed of (12,9) and (12,13).
[0148] In this embodiment of the disclosure, when different tasks of an electronic device overlap in the direction of the second coordinate axis, the potentially overlapping tasks are split along the direction of the second coordinate axis, which represents the number of node devices, into multiple sub-drawing areas. Without affecting the resource occupancy map display of the degree of task occupancy on node devices, the space on the second coordinate axis of the resource occupancy map is saved, making the resource occupancy map display more compact, so that users can see more resource occupancy on the same area of the image, thereby improving the utilization rate of the drawing area of the resource occupancy map.
[0149] In some embodiments, the method further includes:
[0150] Within a preset time range, the runtime of each task is determined based on the start and end times of each task in the resource occupancy graph within the preset time range.
[0151] The resource usage within the preset time range is determined by summing the products of the runtime of each task within the preset time range and the number of node devices occupied by the task.
[0152] The total amount of resources is determined by multiplying the duration corresponding to the preset time range with the preset total number of node devices in the cluster.
[0153] Based on the ratio of the resource usage to the total resource amount, the resource utilization rate of the cluster within the preset time range is determined.
[0154] In this embodiment of the disclosure, the electronic device determines the resource usage within the preset time range based on the sum of the products of the runtime of each task within the preset time range and the number of node devices occupied by the task.
[0155] Figure 4 This is a flowchart illustrating a resource utilization calculation method according to an embodiment of this disclosure, such as... Figure 4 As shown, the processing flow of the cluster occupancy calculation module includes the following steps:
[0156] S401. Calculate the time for each node device to run its task and obtain the total time.
[0157] In this embodiment of the disclosure, the electronic device determines the resource usage of a task within a preset time range based on the sum of the products of the runtime of each task within a preset time range and the number of node devices occupied by the task. It should be noted that the runtime of each task may be included within the preset time range, or it may be partially included within the preset time range.
[0158] In this embodiment of the disclosure, the electronic device determines the runtime of each task within a preset time range based on the start and end times of each task in the resource occupancy graph as follows: If the start time of a task is within the preset time range but the end time is not, the duration corresponding to the start time of the task and the end time of the preset time range is determined as the runtime of the task within the preset time range; if the start time of a task is not within the preset time range but the end time is within the preset time range, the duration corresponding to the start time of the preset time range and the end time of the task is determined as the runtime of the task within the preset time range; if both the start time and the end time of a task are within the preset time range, the runtime of the task is determined as the runtime of the task within the preset time range.
[0159] S402. Calculate the operating and idle time of each node device and obtain the sum;
[0160] In this embodiment of the disclosure, the electronic device determines the total amount of resources based on the product of the duration corresponding to the preset time range and the preset total number of node devices in the cluster, wherein the preset total number of node devices may be the number of node devices in the cluster.
[0161] S403. The ratio of the two data points above is the occupancy rate.
[0162] In this embodiment of the disclosure, the electronic device determines the resource utilization rate of the cluster within the preset time range based on the ratio of resource usage to total resources. In this embodiment, the preset time range is the time range within which the user needs to perform cluster utilization rate statistics; it can be based on days, weeks, or months, to provide the user with resource utilization rate data at different time densities.
[0163] S404, Occupancy Rate Indicator Time Chart Display.
[0164] In this embodiment of the disclosure, the electronic device can display the cluster utilization rate for one or more preset time ranges. When there are multiple preset time ranges, the corresponding time lengths can be the same or different. In this embodiment of the disclosure, the electronic device displays the cluster's resource utilization rate within the preset time range at a predetermined position on the resource utilization map. Figure 5 This is a resource usage diagram shown in an embodiment of the present disclosure, such as... Figure 5 As shown, the horizontal axis (first axis) of the resource usage graph is the time axis, and the vertical axis (second axis) is the number of node devices. A gray rectangle 501 represents the runtime of a task and the number of node devices occupied during the runtime. The cluster resource utilization rate is displayed at the predetermined position 502. The cluster resource utilization rate was 0.728 in May and 0.08 in June.
[0165] In this embodiment of the disclosure, the electronic device calculates the cluster resource occupancy rate within a preset time range based on the resource occupancy map, which makes it easier for users to intuitively perceive the cluster resource occupancy rate in each time period. This can be used for performance analysis, optimization or fault diagnosis, and thus provide better resource planning basis for resource users and suppliers, thereby improving the overall equipment resource utilization rate and reducing resource waste.
[0166] Figure 6 This is a system flowchart illustrating a method for generating a cluster resource occupancy graph according to an embodiment of this disclosure, such as... Figure 6 As shown, the processing flow of the cluster resource occupancy graph generation system includes the following steps:
[0167] S601, Perform data acquisition;
[0168] S602, Perform data processing and plotting;
[0169] S603, Perform occupancy rate calculation.
[0170] In this embodiment of the disclosure, the system for generating the cluster resource occupancy map runs on the aforementioned electronic device and can be a system for statistically analyzing the resource occupancy of cluster-type electronic devices such as GPUs, CPUs, and memory.
[0171] In step S601, the electronic device performs data acquisition, that is, in this embodiment of the disclosure, it obtains the task data of each task running by the node devices in the cluster. The data acquisition results in the task data of each task.
[0172] In step S602, the electronic device performs data processing and drawing. That is, in this embodiment of the present disclosure, a resource occupancy map is drawn based on the start time, end time of each task and the number of node devices occupied by the task. Data processing includes equivalent processing, anomaly elimination, occupancy detection, sorting, etc., of the task data to obtain the drawing order of the task data, and drawing is performed according to the drawing order of the tasks to obtain the resource occupancy map (e.g., GPU time map).
[0173] In step S603, the electronic device performs a resource occupancy rate calculation. That is, in the disclosed embodiment, the resource occupancy rate is calculated using a resource occupancy map within a preset time range.
[0174] In this embodiment of the disclosure, by processing the resource data of the electronic device, an intuitive and effective hardware time diagram is obtained. The time diagram is used to display the usage time, load status or performance of the hardware device, so as to help users or developers understand the working status of the electronic device at different time periods, thereby conducting performance analysis, optimization or troubleshooting. In turn, it can provide better resource planning basis for resource users and suppliers, thereby improving the overall equipment resource utilization rate and reducing resource waste.
[0175] Figure 7 This is a block diagram illustrating a cluster resource occupancy graph generation apparatus according to an exemplary embodiment. For example... Figure 7 As shown, the device 700 mainly includes:
[0176] The acquisition module 701 is used to acquire task data of each task running on the node devices in the cluster; wherein, the task data includes the start time of the task, the end time of the task, and the number of node devices occupied by the task.
[0177] The drawing module 702 is used to draw a resource occupancy map based on the start time, end time, and number of node devices occupied by each task; wherein the resource occupancy map includes a mapping between the start time, end time, and number of node devices occupied by each task.
[0178] The drawing module 702 is further configured to, for each task, determine the runtime of the task based on the start time and end time of the task; determine the drawing order of each task based on the start time and runtime of each task; determine the drawing area of each task on the resource occupancy map according to the start time, runtime of each task and the number of node devices occupied; and draw the task-related icon in the drawing area corresponding to the task in the resource occupancy map according to the drawing order of each task.
[0179] The drawing module 702 is further configured to, in response to the existence of tasks with different start times, determine that the drawing order of each task is positively correlated with the start time of the task; and in response to the existence of tasks with the same start time, determine that among the tasks with the same start time, the task with a runtime shorter than a preset duration threshold is drawn earlier than the task with a runtime longer than or equal to the preset duration threshold.
[0180] The drawing module 702 is further configured to respond to the existence of tasks with the same start time, wherein the drawing area of the task with a start time less than a preset duration threshold overlaps with the drawing area of the task with a start time greater than or equal to the preset duration threshold.
[0181] In some embodiments, the resource occupancy graph includes a first coordinate axis and a second coordinate axis perpendicular to the first coordinate axis; the start and end points of the task-associated icon in the first coordinate axis direction are associated with the start and end times of the task, and the start and end points of the task-associated icon in the second coordinate axis direction are associated with the number of node devices occupied by the task.
[0182] The drawing module 702 is further configured to, for each task, determine the drawing start point of the task in the resource occupancy map based on the task's start time and the number of node devices it occupies, determine the task's runtime as the first drawing length in the first coordinate axis direction, and determine the number of node devices occupied by the task as the second drawing length in the second coordinate axis direction; and determine the drawing area of each task in the resource occupancy map based on the drawing start point, the first drawing length, and the second drawing length corresponding to each task.
[0183] The drawing starting point includes a first drawing coordinate and a second drawing coordinate; the drawing module 702 is further configured to determine the first drawing coordinate of the task in the direction of the first coordinate axis based on the start time of the task; and to determine the second drawing coordinate of the task in the direction of the second coordinate axis based on the number of node devices occupied by the task; wherein the drawing areas of different tasks do not overlap in the direction of the second coordinate axis.
[0184] The drawing module 702 is further configured to determine multiple second drawing coordinates of the task on the second coordinate axis and a second drawing length associated with each second drawing coordinate based on the number of node devices occupied by the task; wherein the sum of the second drawing lengths associated with all the second drawing coordinates is the same as the number of node devices occupied by the task.
[0185] The device further includes a computing module, configured to: determine the runtime of each task within a preset time range based on the start and end times of each task in the resource occupancy graph; determine the resource usage within the preset time range based on the sum of the products of the runtime of each task within the preset time range and the number of node devices occupied by the task; determine the total resource amount based on the product of the duration corresponding to the preset time range and the preset total number of node devices in the cluster; and determine the resource occupancy rate of the cluster within the preset time range based on the ratio of the resource usage to the total resource amount.
[0186] Regarding the apparatus in the above embodiments, the specific manner in which each module performs its operation has been described in detail in the embodiments related to the method, and will not be elaborated upon here.
[0187] Figure 8This is a structural block diagram of an electronic device according to an exemplary embodiment. For example, the electronic device 800 may be a mobile phone, tablet computer, personal computer, wearable device, or vehicle-mounted device, etc.
[0188] Reference Figure 8 The electronic device 800 may include one or more of the following components: processing component 802, memory 804, power supply component 806, multimedia component 808, audio component 810, input / output (I / O) interface 812, sensor component 814, and communication component 816.
[0189] Processing component 802 typically controls the overall operation of electronic device 800, such as operations associated with at least one of display, telephone call, data communication, camera operation, and recording operation. Processing component 802 may include one or more processors 820 to execute instructions to perform all or part of the steps of the methods described above. Furthermore, processing component 802 may include one or more modules to facilitate interaction between processing component 802 and other components. For example, processing component 802 may include a multimedia module to facilitate interaction between multimedia component 808 and processing component 802.
[0190] Memory 804 is configured to store various types of data to support operation on electronic device 800. Examples of such data include at least one of the following: instructions for any application or method operating on electronic device 800, contact data, phonebook data, messages, pictures, and videos. Memory 804 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as Static Random Access Memory (SRAM), Electrically Erasable Programmable Read Only Memory (EEPROM), Erasable Programmable Read-Only Memory (EPROM), Programmable Read Only Memory (PROM), Read-Only Memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk.
[0191] Power supply component 806 provides power to various components of electronic device 800. Power supply component 806 may include at least one of the following: a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to electronic device 800.
[0192] Multimedia component 808 includes a screen that provides an output interface between electronic device 800 and user. In some embodiments, the screen may include a Liquid Crystal Display (LCD) and a Touch Panel (TP). If the screen includes a Touch Panel, the screen may be implemented as a touchscreen to receive input signals from the user. The Touch Panel includes one or more touch sensors to sense touches, swipes, and gestures on the Touch Panel. The touch sensors may sense not only the boundaries of touch or swipe actions but also the duration and pressure associated with the touch or swipe operation. In some embodiments, multimedia component 808 includes a front-facing camera and / or a rear-facing camera. When electronic device 800 is in an operating mode, such as a shooting mode or video mode, the front-facing camera and / or rear-facing camera may receive external multimedia data. Each front-facing camera and rear-facing camera may be a fixed optical lens system or have focal length and optical zoom capabilities.
[0193] Audio component 810 is configured to output and / or input audio signals. For example, audio component 810 includes a microphone (MIC) configured to receive external audio signals when electronic device 800 is in an operating mode, such as call mode, recording mode, and voice recognition mode. The received audio signals may be further stored in memory 804 or transmitted via communication component 816. In some embodiments, audio component 810 also includes a speaker for outputting audio signals.
[0194] I / O interface 812 provides an interface between processing component 802 and peripheral interface modules, such as keyboards, click wheels, and buttons. These buttons may include, but are not limited to, home buttons, volume buttons, power buttons, and lock buttons.
[0195] Sensor assembly 814 includes one or more sensors for providing state assessments of various aspects of electronic device 800. For example, sensor assembly 814 may detect the on / off state of electronic device 800, the relative positioning of components such as the display and keypad of electronic device 800, changes in position of electronic device 800 or one of its components, the presence or absence of user contact with electronic device 800, orientation or acceleration / deceleration of electronic device 800, and temperature changes of electronic device 800. Sensor assembly 814 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. Sensor assembly 814 may also include an optical sensor, such as a complementary metal-oxide-semiconductor (CMOS) or charge-coupled device (CCD) image sensor, for use in imaging applications. In some embodiments, sensor assembly 814 may also include, but is not limited to, at least one of the following: an accelerometer, a gyroscope, a magnetometer, a pressure sensor, and a temperature sensor.
[0196] Communication component 816 is configured to facilitate wired or wireless communication between electronic device 800 and other devices. Electronic device 800 can access wireless networks based on communication standards, such as Wi-Fi, 4G, 5G, or combinations thereof. In one exemplary embodiment, communication component 816 receives broadcast signals or broadcast-related information from an external broadcast management system via a broadcast channel. In one exemplary embodiment, communication component 816 also includes a Near Field Communication (NFC) module to facilitate short-range communication. For example, the NFC module may be implemented based on Radio Frequency Identification (RFID), Infrared Data Association (IrDA), Ultra Wide Band (UWB), Bluetooth (BT), and other technologies.
[0197] In an exemplary embodiment, the electronic device 800 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components.
[0198] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 804 including executable instructions or a computer program, which can be executed by a processor 820 of an electronic device 800 to perform the above-described method. For example, the non-transitory computer-readable storage medium may be a ROM, random access memory (RAM), a compact disc read-only memory (CD-ROM), magnetic tape, floppy disk, and optical data storage device, etc.
[0199] A non-transitory computer-readable storage medium, when the instructions in the storage medium are executed by a processor of an electronic device, enables the electronic device to perform any of the above-described cluster resource occupancy map generation methods of the present disclosure embodiments.
[0200] This disclosure provides a computer program product comprising a computer program or executable instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer program or executable instructions from the computer-readable storage medium and executes the computer program or executable instructions, causing the computer device to perform any of the cluster resource occupancy map generation methods described above in this disclosure.
[0201] Other embodiments of this disclosure will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This disclosure is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this disclosure are indicated by the claims.
[0202] It should be understood that this disclosure is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this disclosure is limited only by the appended claims.
Claims
1. A method for generating a cluster resource occupancy graph, characterized in that, include: Obtain task data for each task running on the node devices in the cluster; wherein, the task data includes the start time of the task, the end time of the task, and the number of node devices occupied by the task; A resource occupancy graph is drawn based on the start time, end time, and number of node devices occupied by each task; wherein, the resource occupancy graph includes a mapping between the start time, end time, and number of node devices occupied by each task.
2. The method according to claim 1, characterized in that, The process of drawing a resource usage map based on the start time, end time, and number of node devices occupied by each task includes: For each task, the runtime is determined based on the task's start and end times. The drawing order of each task is determined based on its start time and runtime. Based on the start time, runtime, and number of node devices occupied by each task, determine the drawing area of each task on the resource occupancy map; In the order in which the tasks are drawn, draw the icons associated with the tasks in the drawing area corresponding to each task in the resource occupancy graph.
3. The method according to claim 2, characterized in that, The process of determining the drawing order of each task based on its start time and runtime includes: In response to tasks with different start times, the drawing order of each task is determined to be positively correlated with the start time of the task; In response to the existence of tasks with the same start time, the task with a runtime shorter than a preset duration threshold is identified among the tasks with the same start time, and the task with a runtime longer than or equal to the preset duration threshold is drawn.
4. The method according to claim 3, characterized in that, The step of determining the drawing area of each task on the resource occupancy map based on the start time, runtime, and number of node devices occupied by each task includes: In response to the existence of tasks with the same start time, the drawing area of the task with a start time less than a preset duration threshold overlaps with the drawing area of the task with a start time greater than or equal to the preset duration threshold.
5. The method according to any one of claims 2-4, characterized in that, The resource occupancy graph includes a first coordinate axis and a second coordinate axis perpendicular to the first coordinate axis; the start and end points of the task-associated icon in the first coordinate axis direction are associated with the start and end times of the task, and the start and end points of the task-associated icon in the second coordinate axis direction are associated with the number of node devices occupied by the task.
6. The method according to claim 5, characterized in that, The step of determining the drawing area of each task on the resource occupancy map based on the start time, runtime, and number of node devices occupied by each task includes: For each task, the starting point of the task in the resource occupation graph is determined based on the task's start time and the number of node devices it occupies. The task's runtime is determined as the first drawing length in the first coordinate axis direction, and the number of node devices occupied by the task is determined as the second drawing length in the second coordinate axis direction. Based on the drawing starting point, the first drawing length, and the second drawing length corresponding to each task, the drawing area of each task on the resource occupancy map is determined.
7. The method according to claim 6, characterized in that, The drawing starting point includes a first drawing coordinate and a second drawing coordinate; Determining the starting point of the resource occupancy graph corresponding to the task based on the task's start time and the number of node devices it occupies includes: Based on the task's start time, determine the task's first drawing coordinates in the direction of the first coordinate axis; Based on the number of node devices occupied by the task, the second drawing coordinate of the task on the second coordinate axis is determined; wherein the drawing areas of different tasks do not overlap in the direction of the second coordinate axis.
8. The method according to claim 7, characterized in that, Determining the second drawing coordinates of the task on the second coordinate axis based on the number of node devices occupied by the task includes: Based on the number of node devices occupied by the task, multiple second drawing coordinates of the task on the second coordinate axis are determined, as well as the second drawing length associated with each second drawing coordinate; wherein, the sum of the second drawing lengths associated with all second drawing coordinates is the same as the number of node devices occupied by the task.
9. The method according to claim 1, characterized in that, The method further includes: Within a preset time range, the runtime of each task is determined based on the start and end times of each task in the resource occupancy graph within the preset time range. The resource usage within the preset time range is determined by summing the products of the runtime of each task within the preset time range and the number of node devices occupied by the task. The total amount of resources is determined by multiplying the duration corresponding to the preset time range with the preset total number of node devices in the cluster. Based on the ratio of the resource usage to the total resource amount, the resource utilization rate of the cluster within the preset time range is determined.
10. A device for generating a cluster resource occupancy map, characterized in that, include: The acquisition module is used to acquire task data of each task running on the node devices in the cluster; wherein, the task data includes the start time of the task, the end time of the task, and the number of node devices occupied by the task; The drawing module is used to draw a resource occupancy map based on the start time, end time, and number of node devices occupied by each task; wherein, the resource occupancy map includes a mapping between the start time, end time, and number of node devices occupied by each task.
11. An electronic device, characterized in that, include: processor; Memory used to store computer programs or instructions; The processor executes the computer program or instructions to implement the steps of the method according to any one of claims 1 to 9.
12. A non-transitory computer-readable storage medium storing a computer program or instructions, characterized in that, When the computer program or instructions in the storage medium are executed by a processor, the steps of the method according to any one of claims 1 to 9 are implemented.
13. A computer program product, comprising a computer program or instructions, characterized in that, When the computer program or instructions are executed by a processor, they implement the steps of the method according to any one of claims 1 to 9.