Task scheduling method, device and equipment and computer storage medium
By determining the task type and selecting appropriate data center and server strategies during task scheduling, the problem of unreasonable server selection in existing technologies is solved, thereby improving the efficiency and resource utilization of video data analysis tasks.
Patent Information
- Application Number
- CN202511759857.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-27
- Publication Date
- 2026-02-27
AI Technical Summary
Existing technologies fail to consider the differences in resource consumption among different types of tasks when selecting servers to perform video data analysis tasks, resulting in unreasonable server selection and affecting task execution efficiency and computing resource allocation.
By acquiring data information from task requests, the task type is determined, and appropriate data center selection and server selection strategies are chosen based on the task type, including single-event intranet priority strategy, multi-event resource priority strategy, multi-file priority strategy, and specified data center strategy, to ensure the reasonable selection of target servers.
It improves the execution efficiency of video data analysis tasks, reduces the cost of video resource transmission, and ensures the reasonable allocation of transmission performance and computing resources.
Smart Images

Figure CN121585684A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of task scheduling technology, and in particular to a task scheduling method, apparatus, device, and computer storage medium. Background Technology
[0002] With the development of cloud storage technology, edge data centers can now be deployed in various regions to facilitate the reception of data transmitted from different areas. Data storage typically employs a proximity-based upload method; therefore, data collected by different devices can be stored in the cloud storage of the nearest edge data center. This data can include video data.
[0003] Video data can be analyzed using artificial intelligence techniques to execute downstream business processes. This analysis involves task scheduling strategies, including determining the servers within the data center to perform the video data analysis tasks. The selected servers significantly impact the efficiency of subsequent video data acquisition; therefore, how to choose the right server for video data analysis is a pressing issue.
[0004] Based on this, this application provides a task scheduling method. Summary of the Invention
[0005] This application provides a task scheduling method, apparatus, device, and storage medium that can accurately identify servers that help improve the efficiency of video data acquisition.
[0006] In a first aspect, embodiments of this application provide a task scheduling method, the method being applied to a task scheduling center, the method comprising: Obtain a task request, which includes a target time range and a video data analysis task; Based on the target time range, the data information of the video data to be analyzed in the video data analysis task is determined through the video data query interface. The data information includes at least one of the following: the number of videos within the target time range, the video size of each video to be analyzed, the storage room, the events reported by the video acquisition device, and the cloud storage location. Based on the data information, the task type of the video data analysis task is determined, wherein the task type is configured by at least one of the following: number of videos, video size, storage room, events reported by video acquisition devices, and cloud storage location. Based on the task type and the data information, a target data center selection strategy is determined from a plurality of preset data center selection strategies, and a target data center is determined based on the target data center selection strategy. The target data center selection strategy includes at least one of a single-event intranet priority strategy, a multi-event resource priority strategy, a multi-file priority strategy, and a specified data center strategy. Select the target server in the target data center according to the pre-configured server selection strategy; The video data analysis task is scheduled to the target server so that the target server can analyze the video data to be analyzed.
[0007] In one feasible implementation, the task type includes any one of the following: a single alarm type, a first time range type, a second time range type, and a fixed type; Wherein, the second time range corresponding to the second time range type is greater than the first time range corresponding to the first time range type; The single alarm type indicates that the video data to be analyzed includes a single video to be analyzed. The first time range type indicates that the target time range corresponding to the video to be analyzed is the first time range; The second time range type indicates that the target time range corresponding to the video data to be analyzed is the second time range; The fixed type indicates that the video acquisition device reported an event that the video to be analyzed contains a target object, and / or the event reported by the video acquisition device is a high-computing-resource-consuming event.
[0008] In one feasible implementation, based on the task type and the data information, a target data center selection strategy is determined from a set of preset data center selection strategies, and a target data center is determined according to the target data center selection strategy. Specifically, this includes: When the task type is the single alarm type, the target data center selection strategy is determined to be the single event intranet priority strategy. The target data center is determined based on the single event intranet priority strategy and the storage data center of the video to be analyzed. When the task type is the first time range type, the target data center selection strategy is determined to be the multi-event resource priority strategy. The target data center is determined based on the multi-event resource priority strategy, the number of videos, the size of the videos, and the storage data center. When the task type is the second time range type, the target data center selection strategy is determined to be the multi-file priority strategy. According to the multi-file priority strategy, the second time range is divided into several non-overlapping first time ranges. The initial data center where the cloud storage location of the video to be analyzed is located within the first time range is determined. Among the multiple initial data centers, the target data center is determined. When the task type is the fixed type, the target data center selection strategy is determined to be the specified data center strategy. According to the specified data center strategy, the data center with preset physical resources is determined as the target data center.
[0009] In one feasible implementation, selecting a target server in the target data center according to a pre-configured server selection strategy specifically includes: For each server in the target data center, determine the server's machine load based on the machine load information reported by that server; The server's task load is determined based on the number of tasks of each task type currently being executed by the server and the corresponding task weight. For each server in each target data center, the load weight of the server is determined based on the server's machine load and task load. The multiple load weights are sorted to obtain the sorting result; From the sorting results, the minimum load weight is determined; The server with the lowest load weight is selected as the target server.
[0010] In one feasible implementation, the method further includes: Based on the video data analysis task, the number of tasks of each task type currently being executed by the target server is re-determined. Based on the re-determined number of tasks of each task type currently being executed by the target server and the corresponding task weights, the load weight of the target server is updated; or When the task results reported by the target server are received, the load weight of the target server is updated according to the task type and number of tasks executed in the task results; If the target server fails to report machine load information and / or task results within a preset time, the load weight of the target server will be removed from the sorting results.
[0011] In one feasible implementation, the task request further includes a specified execution time for the video data analysis task; Before determining the data information of the video to be analyzed in the video data analysis task based on the target time range through the video data query interface, the method further includes: When the execution time of the video data analysis task is determined for the first time, and the task request includes a specified execution time of the video data analysis task, the execution time of the video data analysis task is determined and recorded according to the specified execution time and the pre-configured duration in the configuration information corresponding to the task type of the video data to be analyzed. When the execution time of the video data analysis task is determined for the first time, and the task request does not include the specified execution time of the video data analysis task, the execution time of the video data analysis task is determined and recorded according to the current time and the pre-configured duration in the configuration information corresponding to the task type of the video data to be analyzed. Based on the task execution time, the video data analysis task is added to a preset delay queue, the preset delay queue including the identification information of the video data analysis task; Based on the target time range, the data information of the video data to be analyzed is determined through a video data query interface, specifically including: When the task execution time is reached, the data information of the video data to be analyzed is determined through the video data query interface according to the target time range.
[0012] In one feasible implementation, the method further includes: Receive the task results reported by the target server; When the task result indicates that the video data analysis task has failed, the failure type of the video data analysis task is determined based on the error code in the task result. When the failure type is a retryable type, determine whether the video data analysis task supports retrying based on the configuration information corresponding to the task type of the video data analysis task. If the video data analysis task supports retries and has not reached the configured retry limit, then according to the preset retry mechanism, the task execution time of the video data analysis task is re-determined, and according to the task execution time, the video data analysis task is added to the preset delay queue, and the recorded task execution time and number of retries of the video data analysis task are updated.
[0013] In one feasible implementation, the execution time of the video data analysis task is re-determined according to a preset retry mechanism, specifically including: If the task result includes a preset retry time, then the preset retry time is determined as the task execution time of the video data analysis task, and the preset retry time is the time when the server storing the video data to be analyzed sends it to the target server; If the task result does not include a preset retry time, the task execution time of the video data analysis task is determined based on the current time and the delay duration in the configuration information corresponding to the task type of the video data to be analyzed.
[0014] Secondly, embodiments of this application also provide a task scheduling device, which is applied to a task scheduling center, and the device includes: The request acquisition module is used to acquire task requests, which include target time range and video data analysis tasks. The data information acquisition module is used to determine the data information of the video data to be analyzed in the video data analysis task according to the target time range through the video data query interface. The data information includes at least one of the following: the number of videos in the target time range, the video size of each video to be analyzed in the video data to be analyzed, the storage room, the events reported by the video acquisition device, and the cloud storage location. The task type determination module is used to determine the task type of the video data analysis task based on the data information, wherein the task type is configured by at least one of the following: number of videos, video size, storage room, events reported by video acquisition devices, and cloud storage location. The target data center selection module is used to determine a target data center selection strategy from a plurality of preset data center selection strategies based on the task type and the data information, and to determine the target data center based on the target data center selection strategy. The target data center selection strategy includes at least one of the following: single-event intranet priority strategy, multi-event resource priority strategy, multi-file priority strategy, and specified data center strategy. The target server determination module is used to select a target server in the target data center according to a pre-configured server selection strategy. The task scheduling module is used to schedule the video data analysis task to the target server so that the target server can analyze the video data to be analyzed.
[0015] Thirdly, embodiments of this application also provide an electronic device, which includes: a processor and a memory storing computer program instructions; the processor reads and executes the computer program instructions to implement any of the above-described task scheduling methods.
[0016] Fourthly, embodiments of this application also provide a computer-readable storage medium storing computer program instructions, which, when executed by a processor, implement any of the above-described task scheduling methods.
[0017] The task scheduling method, apparatus, device, and storage medium provided in this application embodiment acquire task requests covering a target time range. Through a video data query interface, it determines the quantity, size, storage location, and data information from events reported by each video acquisition device within the target time range, including the number of videos to be analyzed. Based on the task type and data information, a target data center selection strategy is determined from multiple preset data center selection strategies. The target data center selection strategy includes at least one of a single-event intranet priority strategy, a multi-event resource priority strategy, a multi-file priority strategy, and a specified data center strategy. A target server is selected from the target data center according to a pre-configured server selection strategy. The video data analysis task is scheduled to the target server so that the target server can analyze the video data to be analyzed. This application pre-configures different data center selection strategies using various data information, making the selected data centers more reasonable, and thus making the selected target servers more reasonable, thereby reducing video resource transmission costs and ensuring transmission performance. Attached Figure Description
[0018] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments of this application will be briefly introduced below. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0019] Figure 1 A flowchart illustrating a task scheduling method provided in an embodiment of this application; Figure 2 This is a schematic diagram of configuration information provided in an embodiment of this application; Figure 3 This application provides a flowchart illustrating the process of determining a task type. Figure 4 This application provides a schematic diagram of a task forwarding process as an embodiment of the present application. Figure 5 This is a schematic diagram of another task scheduling process provided in an embodiment of this application; Figure 6 This is a schematic diagram of the structure of a task scheduling device provided in an embodiment of this application; Figure 7 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0020] The features and exemplary embodiments of various aspects of this application will be described in detail below. To make the objectives, technical solutions, and advantages of this application clearer, the application will be further described in detail below with reference to the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only intended to explain this application and not to limit it. For those skilled in the art, this application can be implemented without some of these specific details. The following description of the embodiments is merely to provide a better understanding of this application by illustrating examples.
[0021] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising..." does not exclude the presence of additional identical elements in the process, method, article, or apparatus that includes said element.
[0022] The acquisition, storage, use, and processing of data in this application embodiment all comply with the relevant provisions of national laws and regulations.
[0023] In the embodiments of this application, certain software, components, models and other existing solutions in the industry may be mentioned. These should be regarded as exemplary and are only intended to illustrate the feasibility of implementing the technical solution of this application. However, they do not mean that the applicant has used or necessarily used the solution.
[0024] To better understand and explain the solutions provided in the embodiments of this application, some technical terms involved in the embodiments of this application will be briefly introduced below.
[0025] Artificial Intelligence (AI) is the theory, methods, technology, and application systems that use digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use that knowledge to achieve optimal results. In essence, AI is a comprehensive technology within computer science that attempts to understand the nature of intelligence and produce new intelligent machines that can react in a way similar to human intelligence. AI is used to study the design principles and implementation methods of various intelligent machines, enabling them to possess perception, reasoning, and decision-making capabilities.
[0026] Cloud storage (CS) is an online storage technology that stores data in virtual servers so that data accessors can access, manage, and use their data at any time.
[0027] Artificial intelligence technology can be used to analyze video data, such as for facial recognition, mask detection, and presence / absence detection. Specifically, the collected video data can be input into different AI models to complete video analysis tasks.
[0028] The video data to be analyzed is typically captured by image acquisition devices such as cameras and can be uploaded to cloud storage services. Since there are many devices with cloud storage services, and these image acquisition devices are located in different geographical locations, to ensure storage performance, the acquired video data to be analyzed is usually accessed from the nearest available location. Therefore, videos from different devices are stored in cloud storage in various edge data centers.
[0029] To efficiently acquire video resources for analysis during video AI analysis, target servers can be deployed in a distributed manner based on the storage location of these resources. Task requests can be scheduled and distributed through a task scheduling center or routed to target servers in various data centers. During task execution, target servers acquire video resources from non-local data centers via dedicated lines or public networks. After completing the video analysis task, they store the analysis results in a nearby unified cloud storage service and then report the results.
[0030] Identifying the target server is a crucial step in task scheduling. However, existing methods for determining the target server do not consider the different resource consumption of different types of tasks. This leads to the determination of an unreasonable target server, affecting the efficiency of subsequent task execution and potentially causing unreasonable allocation of computing resources, which in turn affects the execution of subsequent tasks.
[0031] To address the problems in related technologies, embodiments of this application provide a task scheduling method, apparatus, device, and storage medium. The method involves acquiring a task request encompassing a target time range, and using a video data query interface to determine the quantity, size, storage location, and data information from events reported by each video acquisition device within the target time range, thereby determining the task type. Based on the task type, data information, and multiple preset storage location selection strategies, a target storage location is selected. These strategies include at least one of single-event intranet priority, multi-event resource priority, multi-file priority, and specified storage location strategies. A target server is selected from the servers within the target storage location according to a pre-configured server selection strategy. The video data analysis task required by the task request is scheduled to the target server, enabling the target server to analyze the video data. This application utilizes various data information and pre-configures different storage location selection strategies to make the selected storage locations more reasonable, thereby making the selected target servers more appropriate, reducing video resource transmission costs, and ensuring transmission performance.
[0032] It should be noted that the execution entity of the task scheduling method provided in this application embodiment can be a task scheduling center. The task scheduling center can communicate with any server in the distributed cluster to send video data analysis tasks to the corresponding target server. The task scheduling center can also interact with the business platform to obtain the video data analysis tasks requested by the business platform from the target server. The business platform can be any electronic device with video data analysis requirements.
[0033] The task scheduling method provided in the embodiments of this application will be introduced first below.
[0034] Figure 1 This is a flowchart illustrating a task scheduling method provided in an embodiment of this application. Figure 1 As shown, the task scheduling method may include the following steps: S101~S106.
[0035] S101: Get task request.
[0036] In this embodiment of the application, the task scheduling center receives a task request sent by the business platform and obtains the task request, which includes a target time range and a video data analysis task.
[0037] The video data analysis task is based on artificial intelligence analysis methods. The target time range can be any two moments, specifically any first moment and a second moment, where the first moment is earlier than the second moment and the second moment is no later than the current moment. The current moment is the moment the task scheduling center receives the task request. Alternatively, the target time range can include only one moment; in this case, the video data analysis task analyzes the video data at that moment.
[0038] Of course, the task request may also include a user identifier with a video analysis task. In this case, the video data subsequently analyzed can be video captured by the video capture device associated with that user. It is understandable that the user identifier is associated with several video capture devices, and this association is preset.
[0039] S102: Based on the target time range, determine the data information of the video data to be analyzed in the video data analysis task through the video data query interface.
[0040] In this embodiment, the task scheduling center can schedule a video data query interface to obtain data information of the video data to be analyzed within the target time range. Generally, the data information is stored in a specific database. This database records the video data collected by each video acquisition device at various times or time periods, the video size, the storage room, the events reported by each video acquisition device, and the preset cloud storage location. This cloud storage location refers to the location where multiple videos within a certain time range are stitched together and stored. Generally, this cloud storage location can be set as needed, and this application does not impose any restrictions on it.
[0041] It is understood that the data information includes at least one of the following: the number of videos within the target time range, the video size of each video to be analyzed in the video data to be analyzed, the storage room, the events reported by the video acquisition equipment, and the cloud storage location.
[0042] S103: Determine the task type of the video data analysis task based on the data information.
[0043] The task type is configured through at least one of the following: number of videos, video size, storage room, events reported by video capture devices, and cloud storage location. In other words, the task type can be pre-configured and stored in the configuration information.
[0044] Figure 2 This is a schematic diagram of configuration information provided in an embodiment of this application, such as... Figure 2 As shown.
[0045] Configuration information includes ID, name, task type, pre-configured duration, delay duration, whether retry is supported, whether it is asynchronous, number of consumer threads, etc., and may also include a first identifier code, task status, scan frequency, and load balancing strategy code. The ID represents the quantity of configuration information. Figure 2 There are 6 configuration items, numbered 1 through 6. The names can include video inspection, store timeline, head detection, heatmap, equipment-side spot check, and on-duty / off-duty detection, etc. These names represent the scenario and specific task content of the video data analysis task. For example, head detection indicates that the video data analysis task is to detect whether there are heads in the video and the number of heads. On-duty / off-duty detection indicates that the video data analysis task is to detect whether there is a target object in the video; if it does not exist, it indicates that the target is off-duty; if it exists, it indicates that the target is on-duty.
[0046] The pre-configured duration is the delay required when determining the scheduling of the video data analysis task. The delay duration is the delay required to re-determine the scheduling of the video data analysis task if the target server fails to obtain the video data to be analyzed required by the video data analysis task. It can be understood that both the pre-configured duration and the delay duration are the delay required for scheduling the task, but the difference lies in the timing of the delay.
[0047] Since tasks cannot be guaranteed to succeed on the first try, retries are necessary to ensure a high success rate. Furthermore, different tasks have different requirements regarding latency and retries; therefore, different retry-related information needs to be configured. In other words, the configuration information also includes whether the task supports retries and the number of retries allowed, to facilitate subsequent operations during retries. Asynchronous operation refers to whether, when executing the video data analysis task, it is necessary to wait for the task result before performing subsequent operations. If not, asynchronous operation is supported; if so, it is not. The number of consumer threads represents the number of threads required to execute this task.
[0048] The first identifier (code) represents the functionality achievable by the task and corresponds to its name. Taking a store scenario as an example, the code identifier may include Shop Cameras Inspect, Shop Time Track, Shop Head Count, Shop Heat Map, Live Snap shot, and Shop On Leave. Shop Cameras Inspect corresponds to video inspection, which involves checking or managing store cameras through video inspection to determine if they are functioning correctly. Shop Time Track corresponds to the store's timeline, used to track user activity within the store, such as the time users spend in different areas. Shop Head Count corresponds to head detection, determining the number of users in the store. Shop Heat Map corresponds to a heat map, used to display areas where users congregate. Live Snap shot corresponds to device-side frame extraction, used to create real-time snapshots. Shop On Leave corresponds to on-duty / off-duty detection, indicating whether a user or employee has left the store.
[0049] Task status indicates whether the task needs to be executed, and scan frequency refers to the processing speed per unit time when processing video data. The load balancing policy identifier indicates the correspondence between this task type and the data center selection policy.
[0050] The task type includes any one of the following: single alarm type, first time range type, second time range type, and fixed type. Among them, the second time range corresponding to the second time range type is greater than the first time range corresponding to the first time range type.
[0051] For example, the first time range may be one hour, and the second time range may be one day, that is, the second time range may include multiple first time ranges.
[0052] A single alarm type indicates that the video data to be analyzed includes one video; a first time range type indicates that the target time range corresponding to the video to be analyzed is the first time range; a second time range type indicates that the target time range corresponding to the video data to be analyzed is the second time range; a fixed type indicates that the video acquisition device reported an event that a target object exists in the video to be analyzed, and / or that the event reported by the video acquisition device is a high-computational-resource-consuming event. The target object can be set as needed; generally, it can be set to an event reported by the video acquisition device, indicating that a target object exists in the video to be analyzed. It can also be determined whether the event identifier of the event reported by each video acquisition device is a high-computational-resource-consuming event.
[0053] In other words, when determining whether the events reported by each video acquisition device are high-computation-resource-consuming events, each video acquisition device has a corresponding event identifier for the events reported. This event identifier can indicate whether the event is a high-computation-resource-consuming event, and the correspondence between the event identifier and the high-computation-resource-consuming event can be pre-configured.
[0054] For example, the configured event identifiers include 1 to 5, where 1 to 3 are high computing resource consumption events, and 4 to 5 are non-high computing resource consumption events. If the event identifier of the event reported by each video acquisition device is 1, it indicates that the event is a high computing resource consumption event.
[0055] Generally, tasks in home-based scenarios are computationally intensive, such as human detection, facial recognition, pet identification, and abnormal behavior analysis using home security cameras. These tasks are typically handled by AI models.
[0056] Of course, it is also possible to determine whether a reported event is a high-computation-resource-consuming event based on the type of video capture device used to report the event. In this case, the data information may also include the type of video capture device. If the type of video capture device is a home camera, a pet capture camera, etc., then the event reported by that video capture device is a high-computation-resource-consuming event. Otherwise, the event reported by that video capture device is not a high-computation-resource-consuming event.
[0057] When determining the task type, if the number of videos to be analyzed in the data information is 1, the task type of the video data analysis task is determined to be a single alarm type; if the number of videos to be analyzed in the data information is not 1 and the target time range is the first time range, the task type of the video data analysis task is determined to be the first time range type; if the number of videos to be analyzed in the data information is not 1 and the target time range is the second time range, the task type of the video data analysis task is determined to be the second time range type; if the events reported by each video acquisition device in the data information are high-computation-resource-consuming events, the task type of the video data analysis task is determined to be a fixed type.
[0058] Figure 3 This application provides a flowchart illustrating the process of determining a task type, as shown in the embodiments of this application. Figure 3 As shown.
[0059] Understandably, when determining the task type, there's no need for complex combinations of various data elements. First, determine if the events reported by each video capture device are high-resource-consuming events. If so, the task type is fixed. If not, determine if the number of videos to be analyzed is one. If so, the task type is a single alarm. If not, determine if the target time range is the first time range. If so, the task type is the first time range type. If not, continue to determine if the target time range is the second time range. If so, the task type is the second time range type. If not, there may be errors in the data; return a prompt to the business platform and re-obtain the task request.
[0060] In this embodiment, determining the task type based on data information first is necessary because directly determining the corresponding data center selection strategy requires combining and pairing each data element. Since there is a large amount of data and numerous combination methods, this necessitates consuming significant computing resources for data combination and pairing with various data center selection strategies, greatly reducing task scheduling efficiency. By first determining the task type based on data information, which includes multiple task types but each corresponding to a single data center selection strategy, the computing resources required for pairing are significantly reduced, and data combination is eliminated, thus improving task scheduling efficiency. The correspondence between task types and data center selection strategies is pre-configured.
[0061] S104: Based on the task type and the data information, determine the target data center selection strategy from a set of preset data center selection strategies, and determine the target data center based on the target data center selection strategy.
[0062] The data center selection strategy includes at least one of the following: single-event intranet priority strategy, multi-event resource priority strategy, multi-file priority strategy, and designated data center strategy.
[0063] Generally, one task type corresponds to one data center selection strategy. Once the task type is determined, the corresponding data center selection strategy can also be determined. Therefore, the task scheduling center can determine the target data center based on the task type and the corresponding data center selection strategy.
[0064] Specifically, when the task type is a single alarm type, the target data center selection strategy is a single-event intranet priority strategy. Based on the single-event intranet priority strategy and the storage data center of the video to be analyzed, the target data center is determined. When the task type is a first time range type, the target data center selection strategy is a multi-event resource priority strategy. Based on the multi-event resource priority strategy, the number of videos, the size of the videos, and the storage data center, the target data center is determined. When the task type is a second time range type, the target data center selection strategy is a multi-file priority strategy. Based on the multi-file priority strategy, the second time range is divided into several non-overlapping first time ranges. The initial data center where the cloud storage location of the video to be analyzed is located within the first time range is determined. Among the multiple initial data centers, the target data center is determined. When the task type is a fixed type, the target data center selection strategy is a designated data center strategy. Based on the designated data center strategy, the data center with preset physical resources is determined as the target data center.
[0065] The single-event intranet priority strategy means that when executing a video data analysis task, if the number of videos to be analyzed for that task is only one, then the target data center can be selected as the data center where that video is stored. In other words, when the task type is a single alarm type, the data center storing the video to be analyzed in the data information is determined as the target data center. Tasks such as video frame extraction and off-duty detection generally use a single-event intranet priority strategy. The multi-event resource priority strategy means that when the number of videos to be analyzed required for a video data analysis task is at least 2, it is necessary to determine the number of videos to be analyzed in the same storage room and the total data volume of the videos to be analyzed in the same storage room. Based on the number and / or the total data volume, a target storage room is selected from multiple storage rooms. The total data volume can be determined based on the size of each video to be analyzed stored in the same storage room.
[0066] The task scheduling center can select the storage room with the most data of videos to be analyzed from several storage rooms as the target storage room, or it can select the storage room with the largest total data volume from several storage rooms as the target storage room. Furthermore, after assigning weight coefficients to the number of videos to be analyzed and the total data volume of videos to be analyzed in the same storage room, a weighted average of the number of videos to be analyzed and the total data volume in the same storage room is calculated to obtain the comparison parameter for that storage room. The storage room with the largest value of the comparison parameter is selected as the target storage room.
[0067] In addition, if all the videos to be analyzed required for the video data analysis task are stored in the same storage room, then the storage room storing the videos to be analyzed is selected as the target storage room.
[0068] The multi-file priority strategy refers to the process where, when there are multiple first time ranges within a second time range, the second time range is first divided into several non-overlapping first time ranges. Candidate data centers are then identified for each first time range. The specific method for determining the candidate data center can use the same approach as in the multi-event resource priority strategy. Finally, the target data center is selected from the candidate data centers. It should be noted that the video data to be analyzed for the second time range includes a video stitched together from the videos to be analyzed for multiple first time ranges. The stitched video will be stored in the initial data center where cloud storage is located; the candidate data center can be the initial data center. Therefore, when selecting the target data center, the initial data center with the largest amount of stored video data can be chosen.
[0069] The designated data center policy refers to the execution of fixed types of video data analysis tasks in a designated data center. This designated data center is a data center with preset physical resources, specifically a data center with graphics processing unit (GPU) physical resources, so that the video data analysis tasks can be executed normally.
[0070] In this embodiment of the application, by determining the corresponding data center selection strategy based on the task type, the target data center can obtain the data to be analyzed through the intranet as much as possible, reducing the computational resources and time consumed, thereby improving the execution efficiency of video data analysis tasks.
[0071] In addition to the strategies mentioned above, custom data center selection strategies can be implemented based on data information encoding to meet the different video resource needs of various scenarios. That is, by encoding each data element in the data information and setting the correspondence between the encoding of the data content and the data center selection strategy, flexible data center selection strategies can be achieved.
[0072] S105: Select the target server in the target data center according to the pre-configured server selection strategy.
[0073] In this embodiment of the application, in order to ensure that the selected target server can perform video data analysis tasks normally, the selection can be made in combination with the load of each server in the target data center.
[0074] Specifically, the task scheduling center can determine the machine load of each server in the target data center based on the machine load information reported by the server, and determine the task load of the server based on the number of tasks of each task type currently being executed by the server and the corresponding task weight; for each server in each target data center, determine the load weight of the server based on the machine load and task load; sort the multiple load weights to obtain the sorting results; determine the minimum load weight in the sorting results; and select the server with the minimum load weight as the target server.
[0075] The machine load information includes at least one of the following: CPU utilization, memory utilization, and load.
[0076] Since the CPU utilization, memory utilization, and load reported by the server have different dimensions, they can be normalized for easier calculation, resulting in normalized CPU utilization, memory utilization, and load.
[0077] For example, machine load can be determined based on the following formula:
[0078] in, For machine load, For normalized CPU utilization, The weight corresponding to the central processing unit utilization rate. For normalized memory usage, The weight corresponding to memory usage. For normalized load, The weights corresponding to the load.
[0079] It should be noted that the machine load information may also include other data content. This application does not impose any restrictions on this. When using other data content to determine the machine load, the data content can be normalized first, and corresponding weights can be configured. The machine load can then be obtained through the aforementioned expression used to determine the machine load.
[0080] Task load can be determined based on the following formula:
[0081] in, For task load, The number of tasks of each task type currently being executed by the server. The corresponding task weights can be set as needed for each task type.
[0082] Therefore, for each server in each target data center, the load weight of that server is determined based on its machine load and task load, as shown in the following formula:
[0083] in, For server load weights, For task load, This represents the machine load. Alternatively, a weighted average of the machine load and task load can be calculated to obtain the load weight.
[0084] After determining the load weight of each server, the load weights can be sorted to obtain the sorting result for the target data center.
[0085] For example, for data center X, the sorting result for data center X is: Data center X: [Wa, Wb, Wc, ...], where a, b, and c are the servers in data center X.
[0086] In other words, the sorting is performed by comparing the load weights of data centers within the same data center.
[0087] Traditional load balancing strategies randomly select servers or only consider machine load information without taking task load into account, resulting in uneven load distribution among servers and ineffective utilization of computing resources. However, in this embodiment, the target server is determined by a weighted calculation based on a combination of task load and machine load, thus solving the problems of uneven load balancing and low utilization of computing resources in existing task scheduling methods.
[0088] S106: Schedule the video data analysis task required by the task request to the target server, so that the target server can analyze the video data to be analyzed.
[0089] In this embodiment of the application, when forwarding a task, the task scheduling center can construct a new request, add relevant information to the new request, and then send the new request to the target server.
[0090] Figure 4 This application provides a schematic diagram of a task forwarding process, such as... Figure 4 As shown.
[0091] S1061: Construct a Hypertext Transfer Protocol (HTTP) request for AI analysis task scheduling.
[0092] S1062: Construct a task context based on the task type and add the task context to the HTTP request.
[0093] In this embodiment of the application, a task context can also be constructed by combining data information.
[0094] S1063: Add the storage room access address of each video to be analyzed in the video data to the HTTP request.
[0095] S1064: Add the target server's address information to the HTTP request header.
[0096] S1065: Get the load balancer address of the target data center from the configuration information.
[0097] Load balancers include, but are not limited to, nginx.
[0098] S1066: Sends the HTTP request to the load balancer in the target data center.
[0099] Afterwards, the load balancer in the target data center can parse the HTTP request header and forward the task to the target server corresponding to the address information. The target server can then begin executing the video data analysis task.
[0100] This application provides a task scheduling method. It acquires task requests within a target time range, and through a video data query interface, determines the quantity, size, storage location, and data information from events reported by each video acquisition device within the target time range, including the data in these information. Based on the task type and data information, a target data center selection strategy is determined from multiple preset data center selection strategies. The target data center selection strategy includes at least one of the following: single-event intranet priority strategy, multi-event resource priority strategy, multi-file priority strategy, and specified data center strategy. A target server is selected from the target data center according to a pre-configured server selection strategy. The video data analysis task is scheduled to the target server so that the target server can analyze the video data. This application utilizes various data information and pre-configures different data center selection strategies to make the selected data centers more reasonable, thereby making the selected target servers more reasonable, reducing video resource transmission costs, and ensuring transmission performance.
[0101] In one embodiment, when the task scheduling center receives a task request, the video data to be analyzed required by the task request may not yet have been uploaded to cloud storage, thus requiring a delay in task scheduling. Therefore, before executing S102, the task scheduling center can first determine the task execution time. When the task execution time is reached, based on the target time range, the data information of the video data to be analyzed is determined through the video data query interface.
[0102] Specifically, when the execution time of the video data analysis task is determined for the first time, and the task request includes the specified execution time of the video data analysis task, the execution time of the video data analysis task is determined and recorded according to the specified execution time and the pre-configured duration in the configuration information corresponding to the task type of the video data to be analyzed.
[0103] When the execution time of the video data analysis task is determined for the first time, and the task request does not include the specified execution time of the video data analysis task, the execution time of the video data analysis task is determined and recorded based on the current time and the pre-configured duration in the configuration information corresponding to the task type of the video data to be analyzed.
[0104] Based on the task execution time, the video data analysis task is added to a preset delay queue, which includes the identification information of the video data analysis task.
[0105] The term "first determination" refers to the fact that the task scheduling center receives a task request for the video data analysis task for the first time. Therefore, the task execution time of the video data analysis task has not been determined before the task request was received.
[0106] Understandably, the task request also includes a specified execution time for the video data analysis task. If the video data analysis task includes a specified execution time, the task execution time can be determined according to the following formula:
[0107] in, For the time of task execution, To specify the execution time, As a random factor, This random factor is set to prevent task execution times from being too concentrated, thus avoiding excessive server load. This is the pre-configured duration.
[0108] If no specific execution time is specified, the task execution time can be determined using the following formula:
[0109] in, The current time is the moment when the task scheduling center receives the task request.
[0110] In this embodiment, determining the task execution time before task scheduling avoids task failure due to the failure to upload required video resources, thus improving the task execution success rate. Furthermore, by modifying configuration information, custom delayed task scheduling can be supported, avoiding high task failure rates caused by unreasonable scheduling times or server instability.
[0111] It should be noted that the foundation of task delay scheduling is the implementation of a time-ordered delay queue, which in this embodiment can be implemented using the sorted set (ZSET) data structure in Redis. This data structure includes identity information such as a task identifier to distinguish different tasks. This identity information serves as the key of a ZSET element, and the calculated task execution time is used as the score of the ZSET element. A background thread is started to retrieve tasks that have reached their execution time (i.e., tasks with a score greater than the current time) and distributes them to a thread pool for task processing.
[0112] In one embodiment, when executing S1066, the task scheduling center may also update the load weight of the target server.
[0113] Specifically, the task scheduling center can analyze tasks based on video data, redetermine the number of tasks of each task type currently being executed by the target server, and update the load weight of the target server according to the redetermined number of tasks of each task type currently being executed by the target server and the corresponding task weight; or when receiving task results reported by the target server, update the load weight of the target server according to the task type and number of tasks already executed in the task results; when the target server fails to report machine load information and / or task results within a preset time, the load weight of the target server is deleted from the sorting results.
[0114] It is understood that there are two load weight update methods in this application embodiment. One method is that when the task scheduling center issues a task, it updates the load weight of the target server based on the task type, the number of tasks, and the number of tasks of each task type currently being executed reported by the target server.
[0115] Another approach is to update the load weight of the target server based on the task results and the number of tasks of each task type currently being executed, as reported by the target server. In other words, the task load is reduced based on the number and type of tasks completed in the task results; the reduction in task load is determined by the number of completed tasks and the weight of each task type.
[0116] For example, if the completed task type is Task 1, the weight of Task 1 is 0.3, and the number of completed Task 1 tasks is 3, then the reduced task load is 0.3 * 3 = 0.9. If the task load is 1.3, then the updated task load is 0.4, and the load weight is further updated based on the updated task load.
[0117] This method of determining and updating the load weight of the target server at the task scheduling center avoids the problem of time delays that could lead to the target server's machine load information actually changing by the time the machine load information sent by the target server is received.
[0118] For example, the target server sends machine load information at 3 o'clock, and the task scheduling center receives the machine load information at 3:01. However, at 3:01, the machine load information of the target server changes abruptly, and the load suddenly increases. However, the load weight determined by the task scheduling center based on the machine load information at 3 o'clock is not meaningful, resulting in uneven load distribution during subsequent task scheduling and affecting task execution.
[0119] The load weight obtained through the aforementioned load weight update method is no less than the actual load weight, reserving more load weight for the target server to grow and avoiding the problem of uneven load distribution. This is because when the task scheduling center receives the task result, whether the task succeeds or fails, it has already been removed from the preset delay queue and does not occupy the target server's machine load. Furthermore, there may be a delay in transmitting the task result. During this delay, if the task scheduling center does not send a task to the target server, the number of tasks executed by the target server will not exceed the number of tasks when the task result was sent. Therefore, the task load will not increase, but may even decrease, because the target server may complete other tasks during this delay. The load weight obtained in this way avoids the problem of uneven load distribution.
[0120] In addition, if the target server fails to report machine load information and / or task results within a preset time, it indicates that there may be a problem with the target server. In order to avoid the execution of subsequent tasks, the load weight of the target server is deleted, so that the target server can no longer be used as the target server for new tasks.
[0121] Of course, the task scheduling center can also periodically report machine load information, the number of tasks of each task type currently being executed, and their corresponding task weights from the target server, and then recalculate the machine load and update the task load and load weights of the target server. This calculation mechanism is retained to correct for the load weights recalculated by the task scheduling center.
[0122] In one embodiment, after executing S1066, the target server receives the HTTP request, parses the task context, accesses and obtains dependent resources such as videos and files via the intranet and / or public network, stores them locally, and then calls the algorithm model to execute the specific task to obtain the task result. Afterwards, the task result is processed and reported to the task scheduling center, and local files are cleaned up. Specifically, when the data center selection strategy is a single-event intranet priority strategy, the video data to be analyzed is obtained by pulling the stream from the intranet, which effectively reduces transmission costs. When the data center selection strategy is a multi-event resource priority strategy, resources are obtained efficiently via the intranet, and video resources outside the data center are obtained via public network addresses. When the data center selection strategy is a multi-file priority strategy, cloud storage files outside the data center need to be obtained via the public network. When the data center selection strategy is a specified data center strategy, video resources are uniformly obtained via public network addresses.
[0123] Figure 5 Another task scheduling process diagram provided in this application embodiment, such as Figure 5 As shown.
[0124] In the central data center, the task scheduling center can receive task requests from external business platforms, select target data centers, determine target servers, and then distribute tasks to the target servers. On the server side, servers are deployed in a distributed manner; multiple servers can form a server cluster, and a server cluster can be considered an edge cloud data center. Figure 5 This includes X edge cloud data centers. The selected target data center is an edge cloud data center. When a task is issued, it can be sent to a load balancer in the edge cloud data center, which will then forward the task to the target server. The target server can access the cloud storage video resources, invoke the algorithm model, perform video data analysis, obtain the task results, and then send the results to the task scheduling center. The task scheduling center can return the task results to the business platform via result callback. The task scheduling center is centrally deployed and can store the necessary data in a database.
[0125] Understandably, the task scheduling center can receive task results reported by the target server. When the task result indicates that the video data analysis task has failed, the center determines the failure type of the video data analysis task based on the error code in the task result. If the failure type is retryable, the center determines whether the video data analysis task supports retrying based on the configuration information corresponding to the task type. If the video data analysis task supports retrying and has not reached the configured retry limit, the center redetermines the task execution time according to the preset retry mechanism, adds the video data analysis task to the preset delay queue based on the task execution time, and updates the recorded task execution time and the number of retries.
[0126] When a task fails, the target server can send a failure type, which indicates whether the task can be successfully executed by re-execution. Specifically, a retryable failure type indicates that the task can be successfully executed by re-execution.
[0127] For example, if the video data to be analyzed fails to be uploaded to cloud storage due to network issues, the failure type can be retryable. If the failure is due to an error in the target time range included in the task request, the failure type can be non-retryable.
[0128] It should be noted that the task scheduling center is not used to determine which situations are retryable or non-retryable.
[0129] When retrying, it is necessary to first determine the new execution time of the task. In this case, the execution time of the video data analysis task is not the first determination. Then, according to the preset retry mechanism, the execution time of the video data analysis task is re-determined.
[0130] In addition, if the failure type is a retryable type, but the configuration information in the task type indicates that the task does not support retries, or the configured retry limit has been reached, then the database task status is updated to canceled, and the execution result is recorded.
[0131] In this embodiment of the application, the failure type of the task is determined by the error code, and it is quickly determined whether the task can be successfully executed through the retry mechanism, so as to avoid repeatedly executing the task, wasting computing resources, and the task failing to execute successfully.
[0132] When re-determining the execution time of the video data analysis task according to the preset retry mechanism, if the task result includes the preset retry time, then the preset retry time is determined as the execution time of the video data analysis task. The preset retry time is the time when the server storing the video data to be analyzed sends the data to the target server. If the task result does not include the preset retry time, then the execution time of the video data analysis task is determined according to the current time and the delay duration in the configuration information corresponding to the task type of the video data to be analyzed.
[0133] The server storing the video data to be analyzed can also be the target server.
[0134] For example, if the task result does not include a preset retry time, the task execution time can be determined based on the following formula:
[0135] in, This refers to the task execution time determined during retries. For the current moment, This is the duration of the delay.
[0136] In this embodiment of the application, the task execution time re-determined through the retry mechanism is more accurate and can be adjusted as needed. That is, the re-determined task execution time can be flexibly adjusted by adjusting the delay duration in the configuration information.
[0137] Figure 6 This application provides a schematic diagram of the structure of a task scheduling device according to an embodiment. For example... Figure 6 As shown, the device is applied in a task scheduling center. The task scheduling device 600 may include a request acquisition module 601, a data information acquisition module 602, a task type determination module 603, a target data center selection module 604, a target server determination module 605, and a task scheduling module 606, wherein: The request acquisition module 601 is used to acquire a task request, which includes a target time range and a video data analysis task. The data information acquisition module 602 is used to determine the data information of the video data to be analyzed in the video data analysis task according to the target time range through the video data query interface. The data information includes at least one of the following: the number of videos in the target time range, the video size of each video to be analyzed in the video data to be analyzed, the storage room, the events reported by the video acquisition device, and the cloud storage location. The task type determination module 603 is used to determine the task type of the video data analysis task based on the data information, wherein the task type is configured by at least one of the following: number of videos, video size, storage room, events reported by video acquisition devices, and cloud storage location. The target data center selection module 604 is used to determine a target data center selection strategy from a plurality of preset data center selection strategies based on the task type and the data information, and to determine the target data center based on the target data center selection strategy. The target data center selection strategy includes at least one of the following: single-event intranet priority strategy, multi-event resource priority strategy, multi-file priority strategy, and specified data center strategy. The target server determination module 605 is used to select a target server in the target data center according to a pre-configured server selection strategy. The task scheduling module 606 is used to schedule the video data analysis task to the target server so that the target server can analyze the video data to be analyzed.
[0138] This application provides a task scheduling device that acquires task requests within a target time range. Through a video data query interface, it determines the quantity, size, storage location, and data information from events reported by each video acquisition device within the target time range, including the amount and size of the videos to be analyzed. Based on the task type and data information, a target data center selection strategy is determined from multiple preset data center selection strategies. The target data center selection strategy includes at least one of the following: single-event intranet priority strategy, multi-event resource priority strategy, multi-file priority strategy, and specified data center strategy. A target server is selected from the target data center according to a pre-configured server selection strategy. The video data analysis task is scheduled to the target server so that the target server can analyze the video data to be analyzed. This application utilizes various data information and pre-configures different data center selection strategies to make the selected data centers more reasonable, thereby making the selected target servers more reasonable, reducing video resource transmission costs and ensuring transmission performance.
[0139] In one embodiment, the task type includes any one of: a single alarm type, a first time range type, a second time range type, and a fixed type; Wherein, the second time range corresponding to the second time range type is greater than the first time range corresponding to the first time range type; The single alarm type indicates that the video data to be analyzed includes a single video to be analyzed. The first time range type indicates that the target time range corresponding to the video to be analyzed is the first time range; The second time range type indicates that the target time range corresponding to the video data to be analyzed is the second time range; The fixed type indicates that the video acquisition device reported an event that the video to be analyzed contains a target object, and / or the event reported by the video acquisition device is a high-computing-resource-consuming event.
[0140] In one embodiment, the target data center selection module 604 is specifically used to determine the target data center selection strategy as the single-event intranet priority strategy when the task type is the single alarm type, and to determine the target data center based on the single-event intranet priority strategy and the storage data center of the video to be analyzed. When the task type is the first time range type, the target data center selection strategy is determined to be the multi-event resource priority strategy. The target data center is determined based on the multi-event resource priority strategy, the number of videos, the size of the videos, and the storage data center. When the task type is the second time range type, the target data center selection strategy is determined to be the multi-file priority strategy. According to the multi-file priority strategy, the second time range is divided into several non-overlapping first time ranges. The initial data center where the cloud storage location of the video to be analyzed is located within the first time range is determined. Among the multiple initial data centers, the target data center is determined. When the task type is the fixed type, the target data center selection strategy is determined to be the specified data center strategy. According to the specified data center strategy, the data center with preset physical resources is determined as the target data center.
[0141] In one embodiment, the target server determination module 605 is specifically used to determine the machine load of each server in the target data center based on the machine load information reported by the server. The server's task load is determined based on the number of tasks of each task type currently being executed by the server and the corresponding task weight. For each server in each target data center, the load weight of the server is determined based on the server's machine load and task load. The multiple load weights are sorted to obtain the sorting result; From the sorting results, the minimum load weight is determined; The server with the lowest load weight is selected as the target server.
[0142] In one embodiment, based on the video data analysis task, the number of tasks of each task type currently being executed by the target server is re-determined, and the load weight of the target server is updated according to the re-determined number of tasks of each task type currently being executed by the target server and the corresponding task weight; or When the task results reported by the target server are received, the load weight of the target server is updated according to the task type and number of tasks executed in the task results; If the target server fails to report machine load information and / or task results within a preset time, the load weight of the target server will be removed from the sorting results.
[0143] In one embodiment, the task request further includes a specified execution time for the video data analysis task; The device further includes: The task execution time determination module is used to determine and record the task execution time of the video data analysis task before determining the data information of the video to be analyzed by the video data query interface according to the target time range. When the task execution time of the video data analysis task is determined for the first time and the task request includes the specified execution time of the video data analysis task, the module determines and records the task execution time of the video data analysis task according to the specified execution time and the pre-configured duration in the configuration information corresponding to the task type of the video data to be analyzed. When the execution time of the video data analysis task is determined for the first time, and the task request does not include the specified execution time of the video data analysis task, the execution time of the video data analysis task is determined and recorded according to the current time and the pre-configured duration in the configuration information corresponding to the task type of the video data to be analyzed. Based on the task execution time, the video data analysis task is added to a preset delay queue, the preset delay queue including the identification information of the video data analysis task; The data information acquisition module 602 is specifically used to determine the data information of the video data to be analyzed through the video data query interface according to the target time range when the task execution time is reached.
[0144] In one embodiment, the apparatus further includes: The retry module is used to receive the task results reported by the target server; When the task result indicates that the video data analysis task has failed, the failure type of the video data analysis task is determined based on the error code in the task result. When the failure type is a retryable type, determine whether the video data analysis task supports retrying based on the configuration information corresponding to the task type of the video data analysis task. If the video data analysis task supports retries and has not reached the configured retry limit, then according to the preset retry mechanism, the task execution time of the video data analysis task is re-determined, and according to the task execution time, the video data analysis task is added to the preset delay queue, and the recorded task execution time and number of retries of the video data analysis task are updated.
[0145] In one embodiment, the retry module is specifically used to determine the preset retry time as the task execution time of the video data analysis task if the task result includes a preset retry time, wherein the preset retry time is the time when the server storing the video data to be analyzed sends the data to the target server. If the task result does not include a preset retry time, the task execution time of the video data analysis task is determined based on the current time and the delay duration in the configuration information corresponding to the task type of the video data to be analyzed.
[0146] Figure 7 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of this application is shown.
[0147] An electronic device may include a processor 701 and a memory 702 storing computer program instructions.
[0148] Specifically, the processor 701 may include a central processing unit (CPU), an application specific integrated circuit (ASIC), or one or more integrated circuits that can be configured to implement the embodiments of this application.
[0149] Memory 702 may include mass storage for data or instructions. For example, and not limitingly, memory 702 may include a hard disk drive (HDD), floppy disk drive, flash memory, optical disk, magneto-optical disk, magnetic tape, or Universal Serial Bus (USB) drive, or a combination of two or more of these. In one instance, memory 702 may include removable or non-removable (or fixed) media, or memory 702 may be a non-volatile solid-state memory. Memory 702 may be internal or external to an electronic device.
[0150] In one example, memory 702 may include read-only memory (ROM), random access memory (RAM), disk storage media device, optical storage media device, flash memory device, electrical, optical, or other physical / tangible memory storage device. Thus, typically, memory includes one or more tangible (non-transitory) computer-readable storage media (e.g., memory devices) encoded with software including computer-executable instructions, and when the software is executed (e.g., by one or more processors), it is operable to perform the operations described with reference to the method according to one aspect of this application.
[0151] The processor 701 reads and executes computer program instructions stored in the memory 702 to achieve... Figure 1 The task scheduling method in the illustrated embodiment.
[0152] In one example, the electronic device may also include a communication interface 703 and a bus 710. For example, Figure 7 As shown, the processor 701, memory 702, and communication interface 703 are connected through bus 710 and complete communication with each other.
[0153] The communication interface 703 is mainly used to realize communication between various modules, devices, units and / or equipment in the embodiments of this application.
[0154] Bus 710 includes hardware, software, or both, that couples components of an online data flow metering device together. For example, and not limited to, the bus may include an Accelerated Graphics Port (AGP) or other graphics bus, an Extended Industry Standard Architecture (EISA) bus, a Front Side Bus (FSB), a Hyper Transport (HT) interconnect, an Industry Standard Architecture (ISA) bus, an Infinite Bandwidth Interconnect, a Low Pin Count (LPC) bus, a memory bus, a Micro Channel Architecture (MCA) bus, a Peripheral Component Interconnect (PCI) bus, a PCI-Express (PCI-X) bus, a Serial Advanced Technology Attachment (SATA) bus, a Video Electronics Standards Association Local Bus (VESA Local Bus, VLB) bus, or other suitable buses, or a combination of two or more of these. Where appropriate, bus 710 may include one or more buses. Although specific buses are described and illustrated in the embodiments of this application, this application considers any suitable bus or interconnection.
[0155] Furthermore, in conjunction with the task scheduling methods in the above embodiments, this application embodiment can provide a computer storage medium for implementation. The computer storage medium stores computer program instructions; when these computer program instructions are executed by a processor, they implement any of the task scheduling methods in the above embodiments.
[0156] This application also provides a computer program product, including a computer program that, when executed by a processor, implements any of the task scheduling methods described in the above embodiments.
[0157] It should be clarified that this application is not limited to the specific configurations and processes described above and shown in the figures. For the sake of brevity, detailed descriptions of known methods are omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of this application is not limited to the specific steps described and shown. Those skilled in the art can make various changes, modifications, and additions, or change the order of steps, after understanding the spirit of this application.
[0158] The functional blocks shown in the above-described block diagram can be implemented as hardware, software, firmware, or a combination thereof. When implemented in hardware, they can be, for example, electronic circuits, application-specific integrated circuits (ASICs), appropriate firmware, plug-ins, function cards, etc. When implemented in software, the elements of this application are programs or code segments used to perform the required tasks. Programs or code segments can be stored on a machine-readable medium or transmitted over a transmission medium or communication link via data signals carried on a carrier wave. "Machine-readable medium" can include any medium capable of storing or transmitting information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, read-only memory (ROM), flash memory, erasable read-only memory (EROM), floppy disks, compact disc read-only memory (CD-ROM), optical disks, hard disks, fiber optic media, radio frequency (RF) links, etc. Code segments can be downloaded via computer networks such as the Internet, intranets, etc.
[0159] It should also be noted that the exemplary embodiments mentioned in this application describe methods or systems based on a series of steps or apparatus. However, this application is not limited to the order of the above steps; that is, the steps can be performed in the order mentioned in the embodiments, or in a different order, or several steps can be performed simultaneously.
[0160] The aspects of this application have been described above with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It should be understood that each block in the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing apparatus to produce a machine such that these instructions, executable via the processor of the computer or other programmable data processing apparatus, enable the implementation of the functions / actions specified in one or more blocks of the flowchart illustrations and / or block diagrams. Such a processor can be, but is not limited to, a general-purpose processor, a special-purpose processor, a special application processor, or a field-programmable logic circuit. It is also understood that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can also be implemented by dedicated hardware performing the specified functions or actions, or can be implemented by a combination of dedicated hardware and computer instructions.
[0161] The above description is merely a specific implementation of this application. Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, modules, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here. It should be understood that the protection scope of this application is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in this application, and these modifications or substitutions should all be covered within the protection scope of this application.
Claims
1. A task scheduling method, characterized in that, The method is applied to a task scheduling center, and the method includes: Obtain a task request, which includes a target time range and a video data analysis task; Based on the target time range, the data information of the video data to be analyzed in the video data analysis task is determined through the video data query interface. The data information includes at least one of the following: the number of videos within the target time range, the video size of each video to be analyzed, the storage room, the events reported by the video acquisition device, and the cloud storage location. Based on the data information, the task type of the video data analysis task is determined, wherein the task type is configured by at least one of the following: number of videos, video size, storage room, events reported by video acquisition devices, and cloud storage location. Based on the task type and the data information, a target data center selection strategy is determined from a plurality of preset data center selection strategies, and a target data center is determined based on the target data center selection strategy. The target data center selection strategy includes at least one of a single-event intranet priority strategy, a multi-event resource priority strategy, a multi-file priority strategy, and a specified data center strategy. Select the target server in the target data center according to the pre-configured server selection strategy; The video data analysis task is scheduled to the target server so that the target server can analyze the video data to be analyzed.
2. The method according to claim 1, characterized in that, The task types include any one of the following: single alarm type, first time range type, second time range type, and fixed type; Wherein, the second time range corresponding to the second time range type is greater than the first time range corresponding to the first time range type; The single alarm type indicates that the video data to be analyzed includes a single video to be analyzed. The first time range type indicates that the target time range corresponding to the video to be analyzed is the first time range; The second time range type indicates that the target time range corresponding to the video data to be analyzed is the second time range; The fixed type indicates that the video acquisition device reported an event that the video to be analyzed contains a target object, and / or the event reported by the video acquisition device is a high-computing-resource-consuming event.
3. The method according to claim 2, characterized in that, Based on the task type and the data information, a target data center selection strategy is determined from a set of preset data center selection strategies, and the target data center is determined according to the target data center selection strategy. Specifically, this includes: When the task type is the single alarm type, the target data center selection strategy is determined to be the single event intranet priority strategy. The target data center is determined based on the single event intranet priority strategy and the storage data center of the video to be analyzed. When the task type is the first time range type, the target data center selection strategy is determined to be the multi-event resource priority strategy. The target data center is determined based on the multi-event resource priority strategy, the number of videos, the size of the videos, and the storage data center. When the task type is the second time range type, the target data center selection strategy is determined to be the multi-file priority strategy. According to the multi-file priority strategy, the second time range is divided into several non-overlapping first time ranges. The initial data center where the cloud storage location of the video to be analyzed is located within the first time range is determined. Among the multiple initial data centers, the target data center is determined. When the task type is the fixed type, the target data center selection strategy is determined to be the specified data center strategy. According to the specified data center strategy, the data center with preset physical resources is determined as the target data center.
4. The method according to claim 1, characterized in that, Based on the pre-configured server selection strategy, the target server is selected in the target data center, specifically including: For each server in the target data center, determine the server's machine load based on the machine load information reported by that server; The server's task load is determined based on the number of tasks of each task type currently being executed by the server and the corresponding task weight. For each server in each target data center, the load weight of the server is determined based on the server's machine load and task load. The multiple load weights are sorted to obtain the sorting result; From the sorting results, the minimum load weight is determined; The server with the lowest load weight is selected as the target server.
5. The method according to claim 4, characterized in that, The method further includes: Based on the video data analysis task, the number of tasks of each task type currently being executed by the target server is re-determined. Based on the re-determined number of tasks of each task type currently being executed by the target server and the corresponding task weights, the load weight of the target server is updated; or When the task results reported by the target server are received, the load weight of the target server is updated according to the task type and number of tasks executed in the task results; If the target server fails to report machine load information and / or task results within a preset time, the load weight of the target server will be removed from the sorting results.
6. The method according to claim 1, characterized in that, The task request also includes a specified execution time for the video data analysis task; Before determining the data information of the video to be analyzed in the video data analysis task based on the target time range through the video data query interface, the method further includes: When the execution time of the video data analysis task is determined for the first time, and the task request includes a specified execution time of the video data analysis task, the execution time of the video data analysis task is determined and recorded according to the specified execution time and the pre-configured duration in the configuration information corresponding to the task type of the video data to be analyzed. When the execution time of the video data analysis task is determined for the first time, and the task request does not include the specified execution time of the video data analysis task, the execution time of the video data analysis task is determined and recorded according to the current time and the pre-configured duration in the configuration information corresponding to the task type of the video data to be analyzed. Based on the task execution time, the video data analysis task is added to a preset delay queue, the preset delay queue including the identification information of the video data analysis task; Based on the target time range, the data information of the video data to be analyzed is determined through a video data query interface, specifically including: When the task execution time is reached, the data information of the video data to be analyzed is determined through the video data query interface according to the target time range.
7. The method according to claim 1, characterized in that, The method further includes: Receive the task results reported by the target server; When the task result indicates that the video data analysis task has failed, the failure type of the video data analysis task is determined based on the error code in the task result. When the failure type is a retryable type, determine whether the video data analysis task supports retrying based on the configuration information corresponding to the task type of the video data analysis task. If the video data analysis task supports retries and has not reached the configured retry limit, then according to the preset retry mechanism, the task execution time of the video data analysis task is re-determined, and according to the task execution time, the video data analysis task is added to the preset delay queue, and the recorded task execution time and number of retries of the video data analysis task are updated.
8. The method according to claim 7, characterized in that, According to the preset retry mechanism, the task execution time of the video data analysis task is re-determined, specifically including: If the task result includes a preset retry time, then the preset retry time is determined as the task execution time of the video data analysis task, and the preset retry time is the time when the server storing the video data to be analyzed sends it to the target server; If the task result does not include a preset retry time, the task execution time of the video data analysis task is determined based on the current time and the delay duration in the configuration information corresponding to the task type of the video data to be analyzed.
9. An electronic device, characterized in that, The electronic device includes: a processor and a memory storing computer program instructions; the processor reads and executes the computer program instructions to implement the task scheduling method as described in any one of claims 1-8.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer program instructions, which, when executed by a processor, implement the task scheduling method as described in any one of claims 1-8.