Detection task processing method and apparatus, storage medium, and electronic device

By building a detection task processing system, we adopted a distributed task lock and coroutine execution mechanism to solve the problems of high access cost, poor real-time performance and inflexible configuration in existing technologies, and achieved efficient, flexible and real-time detection prompts for detection tasks.

CN116991702BActive Publication Date: 2026-11-27TENCENT TECH (BEIJING) CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202211242301.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-10-11
Publication Date
2026-11-27
Estimated Expiration
2042-10-11

AI Technical Summary

Technical Problem

Existing technologies suffer from high access costs, poor real-time performance, and inflexible configuration for detection tasks, leading to alarm delays and difficulty in understanding information, which affects management efficiency.

Method used

This paper presents a self-built detection task processing system that uses a distributed preemption mechanism to manage task locks, allocates detection tasks through a task manager, executes tasks using coroutines, generates and pushes custom prompts, and supports fine-grained configuration and high-concurrency processing.

Benefits of technology

It enables flexible configuration of detection tasks and rapid fault detection, ensures millisecond-level push of alert information, reduces access costs and latency, and improves management efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116991702B_ABST
    Figure CN116991702B_ABST
Patent Text Reader

Abstract

Embodiments of the present application disclose a detection task processing method and device, a storage medium and an electronic device. The method can be applied in the field of artificial intelligence, and the method comprises: in the case that a timing task is woken up, requesting a distributed task lock from a lock management component; in the case that the distributed task lock is acquired, requesting a target detection task from a task manager; in the case that the target detection task is acquired, executing the target detection task to obtain a target task execution result; and in the case that a push execution condition is met, generating push information based on the target task execution result and task configuration information corresponding to the target detection task, and pushing the push information to a target client. The target client can be an instant messaging client. The present application can support distributed, high-concurrency and lightweight detection tasks, and support millisecond-level pushing of detection results.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to detection task processing methods, apparatus, storage media and electronic devices. Background Technology

[0002] In many scenarios, it's necessary to monitor the status of running tasks in a timely manner and generate monitoring information based on the results, enabling relevant administrators to understand the status of the monitored objects promptly. Especially when the status of a monitored object becomes abnormal, it's crucial to output an alert message to the administrator, prompting them to take immediate action and prevent the continued abnormal state from causing further losses. However, existing technologies for implementing this status monitoring suffer from high integration costs, poor real-time performance, and inflexible configuration. Summary of the Invention

[0003] To address at least one of the aforementioned technical problems, embodiments of this application provide a detection task processing method, apparatus, storage medium, and electronic device.

[0004] On one hand, embodiments of this application provide a detection task processing method applied to a target detection node, the method comprising:

[0005] When a scheduled task is awakened, it requests a distributed task lock from the lock management component, which is used to allocate a distributed task lock to each detection node based on a preemption mechanism.

[0006] Upon acquiring the distributed task lock, a target detection task is requested from the task manager, which is used to allocate detection tasks to each detection node in the distributed detection system.

[0007] If the target detection task is obtained, the target detection task is executed to obtain the target task execution result;

[0008] When the push execution conditions are met, push information is generated based on the execution result of the target task and the task configuration information corresponding to the target detection task, and the push information is pushed to the target client.

[0009] On the other hand, embodiments of this application provide a detection task processing device applied to a target detection node, the device comprising:

[0010] The distributed preemption module is used to request a distributed task lock from the lock management component when the timed task is woken up. The lock management component is used to allocate the distributed task lock to each detection node based on the preemption mechanism.

[0011] The task request module is used to request a target detection task from the task manager when the distributed task lock is acquired. The task manager is used to allocate detection tasks to each detection node in the distributed detection system.

[0012] The task execution module is used to execute the target detection task when the target detection task is obtained, and to obtain the target task execution result;

[0013] The push module is used to generate push information based on the execution result of the target task and the task configuration information corresponding to the target detection task when the push execution conditions are met, and push the push information to the target client.

[0014] On the other hand, embodiments of this application provide a computer-readable storage medium storing at least one instruction or at least one program, wherein the at least one instruction or at least one program is loaded and executed by a processor to implement the above-described detection task processing method.

[0015] On the other hand, embodiments of this application provide an electronic device, including at least one processor and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the at least one processor implements the above-described detection task processing method by executing the instructions stored in the memory.

[0016] On the other hand, embodiments of this application provide a computer program product, including a computer program or instructions, which, when executed by a processor, implement the aforementioned detection task processing method.

[0017] This application proposes a detection task processing method, which is applied to a self-built detection task processing system. The system includes a distributed detection system composed of multiple detection nodes, a lock management component, and a task manager. The lock management component can handle distributed task lock requests from each node in the distributed detection system. The task manager can manage various detection tasks and allocate them to appropriate detection nodes for processing. This enables the detection task processing system to support distributed, high-concurrency, and lightweight detection tasks. Each detection node can push the prompt information generated by executing its corresponding detection task to the target client according to a preset configuration. The detailed information of the prompt information, the push time, the push frequency, and the detailed information of the target client can all be set in fine-grained terms in the preset configuration. The detection task processing system guarantees millisecond-level push of the prompt information.

[0018] In this detection task processing system, task management, task execution, and lock management are handled by independent components, resulting in a high degree of decoupling. During the execution of the system, it also supports functions such as quickly adding detection tasks, customizing prompt message push rules, and statistically analyzing prompt message push records. Due to the high degree of decoupling, these functions can operate in a fine-grained and highly decoupled mode, enabling flexible configuration of detection tasks and rapid fault detection. Attached Figure Description

[0019] To more clearly illustrate the technical solutions and advantages in the embodiments of this application or related technologies, the drawings used in the description of the embodiments or related technologies will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0020] Figure 1 This is a schematic diagram of a feasible implementation framework for the detection task processing method provided in the embodiments of this application;

[0021] Figure 2 This is a flowchart illustrating the detection task processing method provided in an embodiment of this application;

[0022] Figure 3 This is a schematic diagram of the operating logic of the lock management component provided in the embodiments of this application;

[0023] Figure 4 This is a schematic diagram of a message template provided in an embodiment of this application;

[0024] Figure 5 This is a schematic diagram of data in the first data management component provided in the embodiments of this application;

[0025] Figure 6 This is a representation of the target chain provided in the embodiments of this application;

[0026] Figure 7 This is a schematic diagram of the push execution condition judgment method provided in the embodiments of this application;

[0027] Figure 8 This is a schematic diagram of the detection framework according to an embodiment of this application;

[0028] Figure 9 This is a schematic diagram of the detection timing in an embodiment of this application;

[0029] Figure 10 This is a schematic diagram of push information in an embodiment of this application;

[0030] Figure 11This is a block diagram of the detection task processing device provided in the embodiments of this application;

[0031] Figure 12 This is a schematic diagram of the hardware structure of a device for implementing the method provided in the embodiments of this application. Detailed Implementation

[0032] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the protection scope of the embodiments of this application.

[0033] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of the embodiments of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that embodiments of the present application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or server that includes a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to these processes, methods, products, or devices.

[0034] To make the objectives, technical solutions, and advantages disclosed in the embodiments of this application clearer, the embodiments of this application will be further described in detail below with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are merely illustrative of the embodiments of this application and are not intended to limit the embodiments of this application.

[0035] Hereinafter, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of this embodiment, unless otherwise stated, "multiple" means two or more. To facilitate understanding of the above-described technical solutions and their resulting technical effects in the embodiments of this application, the embodiments of this application first explain the relevant technical terms:

[0036] A Cron expression is a string representing a time, separated by 5 to 6 spaces and divided into 6 to 7 fields, in the format XXXXXXX. Here, X is a placeholder for a field. The last field, representing the year, is optional and can be omitted. When a single field has multiple values, they are separated by commas. Each field can be a definite value or a special character with logical meaning. Each field supports at most one leading zero.

[0037] go-template templates: The Go standard library provides templates, and the text / template template provides the functionality to output text content based on templates. Templates can be used to easily dynamically generate stub code based on metadata.

[0038] Go is a statically typed, compiled, concurrent programming language with garbage collection.

[0039] TaskFactory: Provides support for creating and scheduling Task objects. The constructor in TaskFactory initializes a TaskFactory instance. It also provides TaskCreationOptions to select the construction mode. The following values ​​for TaskCreationOptions represent the following meanings:

[0040] (1) None specifies that the default behavior should be used.

[0041] (2) PreferFairness suggests scheduling tasks in a way that is as fair as possible, meaning that tasks scheduled earlier are more likely to run earlier, and tasks scheduled later are more likely to run later.

[0042] (3) LongRunning specifies that a task will be a long-running, coarse-grained operation. It will indicate that oversubscribing may be reasonable.

[0043] (4) AttachedToParent specifies the parent to which the task is attached in the task hierarchy.

[0044] It also provides TaskContinuationOptions to specify behavior for continuous tasks. The following values ​​of TaskContinuationOptions represent the following meanings:

[0045] (1)None By default, after the previous task is completed, a continuation task will be scheduled to run, regardless of the final state of the previous task.

[0046] (2) PreferFairness suggests scheduling tasks in a way that is as fair as possible, meaning that tasks scheduled earlier are more likely to run earlier, and tasks scheduled later are more likely to run later.

[0047] (3) LongRunning specifies that a task will be a long-running, coarse-grained operation. It suggests that oversubscribing may be reasonable.

[0048] (4) AttachedToParent specifies the parent to which the task is attached in the task hierarchy.

[0049] (5) NotOnRanToCompletion specifies that a continuation task should not be scheduled if the task preceding the continuation task has already completed.

[0050] (6) NotOnFaulted specifies that a continuing task should not be scheduled if an unhandled exception was raised in a task preceding it. NotOnCanceled specifies that a continuing task should not be scheduled if the task preceding it has been canceled.

[0051] (7) OnlyOnRanToCompletion specifies that a continuation task should only be scheduled if the task preceding the continuation task has already completed.

[0052] (8) OnlyOnFaulted specifies that a continuation task should only be scheduled if an unhandled exception is raised in the task preceding the continuation task.

[0053] (9) OnlyOnCanceled specifies that a continuation task should only be scheduled if the task preceding the continuation task has been cancelled.

[0054] (10) ExecuteSynchronously specifies that the continuation task should be executed synchronously. When this option is specified, the continuation task will run on the same thread that caused the preceding task to transition to its final state. If the preceding task has already completed when the continuation task is created, the continuation task will run on the thread that created it. Only continuation tasks with very short execution times should be executed synchronously.

[0055] Go coroutines: Coroutines are a more lightweight approach than threads. Just as a process can have multiple threads, a thread can have multiple coroutines. The switching and creation of coroutines are entirely user-defined. Threads and processes are entirely allocated by the operating system; for the operating system, a thread is the smallest unit of execution, and a process is the smallest unit of resource management. Go coroutines typically require only 2KB of memory, while threads require 1MB, resulting in significantly lower memory consumption. Because thread creation requires requesting resources from the operating system and reclaiming those resources upon destruction, its creation and destruction incur considerable overhead. In contrast, the creation and destruction of Go coroutines are managed by the Go language itself at runtime, thus reducing overhead.

[0056] Redis (Remote Dictionary Server) is an open-source, network-enabled, in-memory or persistent, log-structured, key-value database.

[0057] zset data structure: Compared to set, zset adds a weight parameter, which allows the elements in the set to be arranged in order. It can also obtain a list of elements by the range of the weight parameter. zset is provided by Redis.

[0058] Zabbix is ​​a web-based, enterprise-grade, open-source solution for real-time monitoring of distributed systems. Zabbix can monitor various network parameters in real time, ensuring the secure operation of server systems; and it provides a flexible notification mechanism to allow system administrators to quickly locate and resolve various problems.

[0059] SaaS is an abbreviation for Software-as-a-Service, meaning software as a service, which is the delivery of software services over the internet. SaaS platform providers deploy application software uniformly on their own servers, and customers can order the application software services they need from the vendor via the internet according to their actual work requirements.

[0060] CMDB: Configuration Management Database (CMDB) is a logical database that contains information about the entire lifecycle of configuration items and the relationships between them (including physical relationships, real-time communication relationships, non-real-time communication relationships, and dependencies).

[0061] Cloud technology refers to a hosting technology that unifies hardware, software, and network resources within a wide area network (WAN) or local area network (LAN) to achieve data computation, storage, processing, and sharing. It encompasses network technologies, information technologies, integration technologies, management platform technologies, and application technologies based on cloud computing business models. These technologies can form resource pools, allowing for flexible and convenient on-demand use. Cloud computing technology will become a crucial support. Backend services of technical network systems require substantial computing and storage resources, such as video websites, image websites, and many portal websites. With the rapid development and application of the internet industry, each resource may have its own identification mark in the future, requiring transmission to backend systems for logical processing. Data at different levels will be processed separately, and various industry data will require robust system support, which can only be achieved through cloud computing.

[0062] Intelligent Traffic Systems (ITS), also known as Intelligent Transportation Systems, effectively integrate advanced science and technology (information technology, computer technology, data communication technology, sensor technology, electronic control technology, automatic control theory, operations research, artificial intelligence, etc.) into transportation, service control, and vehicle manufacturing. This strengthens the connection between vehicles, roads, and users, thereby forming a comprehensive transportation system that ensures safety, improves efficiency, enhances the environment, and saves energy.

[0063] Intelligent Vehicle Infrastructure Cooperative Systems (IVICS) are a development direction of Intelligent Transportation Systems (ITS). IVICS utilizes advanced wireless communication and next-generation Internet technologies to implement comprehensive, real-time dynamic information exchange between vehicles and infrastructure. Based on the collection and fusion of dynamic traffic information across all times and spaces, it conducts active vehicle safety control and cooperative road management, fully realizing effective collaboration between people, vehicles, and roads. This ensures traffic safety, improves traffic efficiency, and ultimately forms a safe, efficient, and environmentally friendly road traffic system.

[0064] 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 other words, AI is a comprehensive technology within computer science that attempts to understand the essence of intelligence and produce a new kind of intelligent machine that can react in a way similar to human intelligence. AI studies the design principles and implementation methods of various intelligent machines, enabling them to possess the functions of perception, reasoning, and decision-making.

[0065] Artificial intelligence (AI) is a comprehensive discipline encompassing a wide range of fields, including both hardware and software technologies. Fundamental AI technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing, operating / switching systems, and mechatronics. AI software technologies primarily include computer vision, speech processing, natural language processing, and machine learning / deep learning.

[0066] Machine learning (ML) is a multidisciplinary field involving probability theory, statistics, approximation theory, convex analysis, and algorithm complexity theory. It specifically studies how computers can simulate or implement human learning behavior to acquire new knowledge or skills and reorganize existing knowledge structures to continuously improve their performance. Machine learning is the core of artificial intelligence and the fundamental way to endow computers with intelligence; its applications span all areas of artificial intelligence. Machine learning and deep learning typically include techniques such as artificial neural networks, belief networks, reinforcement learning, transfer learning, inductive learning, and instructional learning.

[0067] Deep learning: The concept of deep learning originated from research on artificial neural networks. A multilayer perceptron with multiple hidden layers is a type of deep learning architecture. Deep learning discovers distributed feature representations of data by combining low-level features to form more abstract high-level representations of attribute categories or features.

[0068] Convolutional Neural Networks (CNNs) are a class of feedforward neural networks that incorporate convolutional computations and have a deep structure. They are one of the representative algorithms in deep learning. CNNs possess representation learning capabilities and can perform translation-invariant classification of input information according to their hierarchical structure; therefore, they are also known as "translation-invariant artificial neural networks."

[0069] In many scenarios, it's necessary to promptly monitor the status of running tasks and generate monitoring information based on the results, enabling relevant administrators to understand the status of the monitored objects in a timely manner. Especially when the status of a monitored object becomes abnormal, it's crucial to output an anomaly alert to the administrator, prompting them to take immediate action and prevent the continued abnormal state from causing further losses. To achieve timely detection and alerts, related technologies tend to rely on third-party applications to build monitoring systems for monitoring their own monitored objects. For example, monitoring systems are built based on Zabbix, CMDB, or SaaS. However, such technical solutions have the following problems:

[0070] 1. High integration costs. This solution may involve Zabbix, CMDB, and SaaS, all of which require significant investment and time to train personnel to become familiar with the systems, resulting in high labor costs.

[0071] 2. Poor real-time alarm performance. The technical solution obtained by combining these three components has a high latency. Taking the detection task that outputs alarm information as an example, it may take at least 30 seconds from the completion of the detection task to the output of the alarm information, which will cause a large alarm delay.

[0072] 3. Inflexible alarm task configuration. When adding a new detection task under this solution, the processing scripts need to be modified or uploaded simultaneously in the data configuration components, parsing components, alarm components, and self-healing components, which poses a significant risk to overall stability.

[0073] 4. Alarm messages are difficult to understand. Alarm messages are extremely difficult for users to read, and even if they receive the message, it takes time to understand it.

[0074] In view of this, this application provides a detection task processing method. This method is applied to a self-built detection task processing system. This system supports distributed, high-concurrency, and lightweight detection tasks. It can push the prompts generated by the detection tasks to the target client according to a preset configuration. The detailed information of the prompts, the push time, the push frequency, and the detailed information of the target client can all be finely configured in this preset configuration, ensuring millisecond-level push of the prompts. Furthermore, it supports functions such as quickly adding detection tasks, customizing prompt push rules, and statistically analyzing prompt push records. Due to the high decoupling of this method and the adapted system, these functions can operate in a fine-grained and highly decoupled mode, achieving flexible configuration of detection tasks and rapid fault detection.

[0075] Please see Figure 1 , Figure 1 This is a schematic diagram of a feasible implementation framework for the detection task processing method provided in the embodiments of this specification, such as... Figure 1 As shown, the implementation framework may include at least a client 10 and a server 20. The client 10 and the server 20 communicate through a network 30. This implementation framework can also be considered a detection task processing system. The server 20 may be located in a cloud environment, and the server 20 is a target detection node in the cloud environment. The target detection node can be any node in the cloud environment.

[0076] When a scheduled task is woken up, server 20 can request a distributed task lock from lock management component 30. Lock management component allocates distributed task locks to each detection node based on a preemption mechanism. Upon acquiring the distributed task lock, server 20 requests a target detection task from task manager 40. Task manager allocates detection tasks to each detection node in the distributed detection system. Upon acquiring the target detection task, server 20 executes the target detection task and obtains the target task execution result. If the target task execution result meets the push triggering conditions, server 20 obtains push configuration management information corresponding to the target detection task by accessing first data management component 50 and push status information corresponding to the target detection task by accessing second data management component 60. If the push execution conditions are determined to be met based on the push configuration management information and the push status information, push information is generated based on the target task execution result and the task configuration information corresponding to the target detection task, and the push information is pushed to the target client, i.e., client 10. This embodiment does not limit the type of client 10; it can be an email client or an instant messaging client.

[0077] In this embodiment, the lock management component 30, task manager 40, first data management component 50, and second data management component 60 are all oriented towards a cluster formed by multiple detection nodes. The lock management component 30, task manager 40, first data management component 50, and second data management component 60 can also be located in a cloud environment.

[0078] The framework described in this invention can provide the detection task processing capabilities required for applications in various scenarios, including but not limited to cloud technology, cloud gaming, cloud rendering, artificial intelligence, smart transportation, assisted driving, video media, smart communities, and instant messaging. Each component in this framework can be a terminal device or a server. Terminal devices include, but are not limited to, mobile phones, computers, intelligent voice exchange devices, smart home appliances, and in-vehicle terminals.

[0079] The following describes a detection task processing method according to an embodiment of this application. Figure 2This illustration shows a flowchart of a detection task processing method provided in an embodiment of this application. This detection task processing method can be executed based on the server 20 described above. The embodiments of this application provide the method operation steps as described in the embodiments or flowcharts, but based on conventional or non-inventive labor, more or fewer operation steps may be included. The order of steps listed in the embodiments is merely one possible execution order among many steps and does not represent the only execution order. In actual systems, terminal devices, or server products, the method can be executed sequentially according to the embodiments or drawings, or in parallel (e.g., in a parallel processor or multi-threaded processing environment). The above method may include:

[0080] S201. When the scheduled task is woken up, a distributed task lock is requested from the lock management component. The lock management component is used to allocate distributed task locks to each detection node based on the preemption mechanism.

[0081] In this embodiment, a scheduled task can be set for the target detection node. This scheduled task can be woken up by a timer, and its configuration can be achieved through a visual interface corresponding to the target detection node. Users can set the wake-up time or frequency of the scheduled task in this visual interface, and the task will then be triggered on schedule. In this embodiment, the scheduled task can be customized using cron expressions, thereby enriching the user's means of configuring scheduled tasks and reducing the difficulty of configuring them.

[0082] If a target detection node is awakened by the scheduled task, it can request a distributed task lock from the lock management component. The lock management component can be open to a cluster of detection nodes, where each node preemptively requests the distributed task lock. Only the node that successfully acquires the distributed task lock can execute the detection task. The lock management component maintains communication with the detection nodes that have successfully acquired the distributed task lock (referred to as valid detection nodes in this document). A heartbeat mechanism can be used to confirm the status of valid detection nodes. If a valid detection node fails to send a heartbeat to the lock management component for a preset time, the lock management component can determine that the valid detection node has failed and forcibly reclaim the distributed task lock, allowing other nodes to reclaim the distributed task lock and execute the detection task. This prevents a single node failure from affecting the execution of the detection task and improves the robustness of the overall detection framework. Of course, this embodiment does not limit the number of distributed task locks in the lock management component; it can be set according to requirements.

[0083] Please refer to Figure 3The diagram illustrates the operational logic of the lock management component. This embodiment addresses the risk of single-node failure for single-node tasks by proposing a distributed task lock. Each detection node competes for the distributed task lock, and only the node holding the lock can continue executing the task. For example, if detection node 'node3' fails to acquire the lock, other healthy nodes will continue competing, and the node holding the lock will continue executing the detection task. Regardless of success or failure, the execution result of each detection task can be recorded in the database, including task identifier, success or failure information, and execution time.

[0084] In this embodiment, the lock management component can be implemented based on Redis. However, considering that Redis may also have single points of failure, the lock management component can also be replaced by Etcd. Etcd has a distributed election function. When a detection node fails, a healthy node is automatically elected through a distributed election strategy to ensure the normal operation of the service. Etcd is an open-source, distributed key-value data storage system that provides services such as shared configuration, service registration, and discovery.

[0085] S202. After acquiring the aforementioned distributed task lock, request a target detection task from the task manager, which is used to allocate detection tasks to each detection node in the aforementioned distributed detection system.

[0086] In some embodiments, after acquiring the distributed task lock and the target detection task, the target detection node can also record the acquisition time of the target detection task in the database. If, after a preset time, the database does not acquire any record related to the execution result of the target detection task, it can be determined that the target detection node has failed. In this case, all detection tasks running in the target detection node can be forcibly released and reclaimed by the task manager so that they can be reassigned to other healthy detection nodes for re-execution. This ensures that the failure of a single node will not affect the implementation of the detection task, giving the framework of this application embodiment a significant advantage of strong robustness. Furthermore, each detection node independently requests detection tasks from the task manager and executes the detection tasks in parallel, giving the framework of this application embodiment a significant advantage of high concurrency.

[0087] Still with Figure 3 For example, if the detection node 3 is damaged, the attempt to acquire the distributed task lock will fail. Furthermore, if the database is still unable to obtain the execution results of tasks 1, 2, 3, and 4 running on node 3 after a certain period of time, it can trigger a forced release of tasks 1, 2, 3, and 4 running on node 3, allowing other healthy detection nodes to re-execute them.

[0088] In this application, the task manager is not limited. In one embodiment, a task factory can be used to construct the task manager. The task factory can uniformly manage the detection tasks registered in the task factory and allocate detection tasks to detection nodes based on the running mode of each detection task, thereby decoupling the allocation and execution of detection tasks.

[0089] In one embodiment, the object detection task is generated by the following method:

[0090] S301. Construct the message template component in the above task manager based on the preset template library, which is used to separate message data and message text.

[0091] In this embodiment, the preset template library can be based on go text / template, mainly generating various strings. These strings are used to generate push notifications, which can be displayed on the target client. This target client can be held by the administrator of the target detection task. The main function of the preset template library is to separate message data from message text, reduce the repetition of message text, and render different message texts based on different message data.

[0092] S302. Display the prompt target field corresponding to the above message data and at least one of the following fields: prompt title field, prompt type field, and prompt scenario field.

[0093] In this embodiment, the prompt target field is used to record information about the recipient of the detection information related to the detection task. The prompt title field, prompt type field, and prompt scenario field are used to record information about the alarm title, alarm type, and alarm content in the detection information related to the detection task, respectively. Please refer to c. Figure 4 The document illustrates a message template. Taking inventory detection for e-commerce activities in a live-streaming scenario as an example, the information corresponding to the prompt title field, prompt type field, and prompt scenario field can be "***Activity," "Insufficient Inventory," and "Insufficient Inventory List***," respectively. The prompt scenario field, prompt title field, and prompt type field each have their corresponding names in the message template. For example, the prompt type field is named "Alarm Type," and the prompt scenario field is named "E-commerce Inspection." The prompt target field, prompt title field, prompt type field, and prompt scenario field all support visual configuration. This means that users only need to configure the parameters corresponding to the fields according to the actual situation, and the push notification can be automatically generated in this embodiment.

[0094] S303. After obtaining the configuration results corresponding to each of the above fields, generate the message text corresponding to the above target detection task based on the above configuration results and the above message template component.

[0095] The message template component automatically generates message text based on the above configuration results. This message text can then be used to automatically generate push notifications without requiring human intervention, thus achieving fully automatic generation of push notifications and enhancing the intelligence of the framework in this application embodiment.

[0096] S304. Determine the above task configuration information based on the above message text.

[0097] S305. Generate the target detection task as described above based on the task configuration information.

[0098] In some embodiments, the running mode configuration information of the target detection task can be obtained; a preset interface of the task management component can be implemented according to the running mode configuration information and the task configuration information; and the target detection task can be registered in the task management component by calling the preset interface. This application embodiment can support detection tasks with different running modes, improving the processing diversity of detection tasks and the running mode compatibility of the detection task processing system.

[0099] This application embodiment supports various detection tasks. By setting a message template component, it can provide support for the automatic adaptation of these different detection tasks. For example, different prompt types, such as missing or inconsistent inventory or product information, as well as different prompt scenarios and prompt titles, can all be uniformly adapted. It supports users to customize task configuration information at a fine-grained level. Moreover, based on the above-mentioned preset template library, this application embodiment can also support automatic truncation of Chinese push messages that are too long and generate batch messages.

[0100] S203. If the above target detection task is obtained, execute the above target detection task and obtain the target task execution result.

[0101] This application allows target detection nodes to automatically execute target detection tasks and write the execution results to the aforementioned database. This database records the execution results obtained by each target detection node in executing its respective detection task. Target detection tasks can be executed via coroutines, allowing multiple coroutines to run in parallel, further improving concurrency.

[0102] S204. If the push execution conditions are met, push information is generated based on the execution result of the target task and the task configuration information corresponding to the target detection task, and the push information is pushed to the target client.

[0103] This application does not limit the push execution conditions. For example, push parameters can be configured on each detection node. If the push parameters indicate that push is allowed, the push execution condition is determined to be met. In this case, personalized push management can be achieved for each detection node. This application does not limit the target client; it can be an email client, an instant messaging client, etc.

[0104] In one exemplary embodiment, if the execution result of the target task meets the push triggering conditions, push configuration management information corresponding to the target detection task can be obtained by accessing the first data management component, and push status information corresponding to the target detection task can be obtained by accessing the second data management component. If the push configuration management information and the push status information meet preset requirements, it is determined that the push execution conditions are met. This application does not limit the push triggering conditions; for example, it can be set that the push triggering condition is only met when an abnormal situation is detected.

[0105] In some embodiments, the push configuration management information corresponding to the target detection task includes a task identifier, a prompt switch, a prompt start time, a prompt end time, and a prompt frequency. The push status information corresponding to the target detection task includes each pushed prompt message, and each prompt message corresponds to the target detection task. Obtaining the push configuration management information corresponding to the target detection task by accessing the first data management component and obtaining the push status information corresponding to the target detection task by accessing the second data management component includes: obtaining the task identifier corresponding to the target detection task; querying the first data management component and the second data management component respectively based on the task identifier to obtain the prompt switch, the prompt start time, the prompt end time, the prompt frequency, and the number of pushes.

[0106] This application does not specifically limit the first data management component and the second data management component. For example, the first data component can be based on a relational database, and the second data management component can be based on Redis. Please refer to... Figure 5The diagram illustrates data within the first data management component. This data corresponds to the push configuration management information for the target detection task. The prompt switch (alarm switch) indicates whether push information is generated based on the execution result of the target detection task and whether this information is pushed to the target client. If this switch is on, push information generation based on the target detection task's execution result and its push to the target client are allowed; otherwise, no push information is generated. The prompt frequency (alarm frequency) represents the frequency of push information delivery within a defined time interval of prompt start and end times. By setting up the first and second data management components, the push process is decoupled from the detection task execution process, enabling flexible configuration of push-related information.

[0107] If there is no record corresponding to the task identifier of the target detection task in the first data management component, the default configuration can be used, such as allowing continuous push of information or pushing at five-minute intervals.

[0108] In some embodiments, the aforementioned push information is recorded in a target linked list, where each node records its update time. This target linked list is designed to ensure both fast querying within a given time period and convenient updates from the second data management component. The second data management component can maintain a corresponding linked list for each detection task, based on a sorted set (zset). Each zset node stores its update time, and the entire linked list is a fast-queryable structure. When querying the number of pushes within a given time period, the zset query interface can be used directly. Upon completion of the push, the push time point is directly packaged into a zset node and inserted into the linked list. In other words, after pushing the push information corresponding to the target detection task, a target node can be generated based on the push information and the current system time of the target detection node; this target node is then added to the target linked list.

[0109] Please refer to Figure 6 The target chain represents the intent, which includes four nodes, each recording the update time as time1, time2, time3, and time4, indicating that four push messages have been pushed for the target detection task.

[0110] In one embodiment, the current system time corresponding to the target detection node can be obtained. When the prompt switch is turned on, a prompt time interval is determined based on the prompt start time and the prompt end time. If the current system time is within the prompt time interval, and the number of pushes has not yet met the requirement corresponding to the prompt frequency, it is determined that the preset requirement is met, i.e., the push execution condition is met.

[0111] Specifically, based on please refer to Figure 7 The diagram illustrates the method for determining push notification execution conditions. First, the state of the notification switch is checked. If the switch is off, the push notification execution condition is not met. Otherwise, the current system time is retrieved. If the current system time is not within the notification time interval, the push notification execution condition is not met. Alternatively, the number of push notifications can be checked. If the number of push notifications has reached the upper limit determined by the notification frequency, the push notification execution condition is not met; otherwise, the push notification execution condition is met. By determining the fulfillment of push notification conditions based on the notification start time, notification end time, current system time, notification switch, notification frequency, and number of push notifications, the technical effect of flexibly triggering push notifications according to preset configurations can be achieved, enabling customized and highly flexible fine-grained information push notifications.

[0112] In one embodiment, the execution result of the target task and the task configuration information corresponding to the target detection task are used to generate push information, which is then pushed to the target client, including:

[0113] S601. Generate a message template based on the above message text.

[0114] S602. Generate push information based on the above target task execution results and the above message template.

[0115] S603. Determine the target client based on the target field provided above.

[0116] S604. Send the above push message to the above target client.

[0117] After obtaining the execution results of the aforementioned target tasks, the method further includes: writing the execution results of the target tasks into a database, whereby the database records the execution results obtained by each target detection node in executing the detection tasks. After pushing the aforementioned push information to the target client, the method includes: releasing the distributed task lock held by the aforementioned target detection nodes, and having the lock management component reclaim the distributed task lock. This facilitates the continuous processing of various detection tasks through the cyclical use of the distributed task lock.

[0118] Please refer to Figure 8This diagram illustrates the detection framework of an embodiment of this application. The timer can be configured on each detection node, with each node having its own corresponding timer. This timer is used to wake up scheduled tasks, which can be visually configured by the user. The task manager is built through a task factory, where each detection task can be configured with a running mode and message template. Furthermore, the push configuration management information and push status information for each detection task are managed by the first data management component and the second data management component, respectively. Each detection node can execute detection tasks concurrently, and in the event of a failure, other detection nodes can re-execute the task.

[0119] Please refer to Figure 9 The diagram illustrates the detection timing of an embodiment of this application. After the timer wakes up the scheduled task, the detection node requests a distributed task lock. If the distributed task lock is obtained, the node requests a target detection task from the task factory. The task factory returns the target detection task based on the running mode and task configuration information of each registered detection task. If the target detection task is obtained, the detection node executes the target detection task, pushes the results to the target client, and writes the execution results to the database.

[0120] This application embodiment can automatically detect multiple scenarios and quickly alert the client, taking the missing product scenario as an example. The activity homepage corresponding to this scenario contains a large number of products, and the display process of these products is as follows:

[0121] 1. Operations are configured manually on the management side.

[0122] 2. The backend calls the middle platform interface to obtain detailed information based on these configurations.

[0123] 3. The backend returns the product details to the frontend.

[0124] Since product information is centrally managed by a central platform, and products on this platform are periodically added or removed from the shelves, if a product configured by the operations team is removed, the entire page will be blank for that product at any given moment. To prevent this risk, a missing product information detection task can be configured in the task factory. The push notification will then be displayed on the client side. Please refer to [link / reference]. Figure 10 The diagram illustrates the push notification. Upon receiving the notification, relevant personnel can promptly identify problematic products and replenish stock on the activity page, thus preventing missing information and improving overall profitability. Furthermore, this embodiment can also be applied to various scenarios such as insufficient coupon inventory or insufficient product inventory. Due to the high real-time alerting capability of this embodiment, risks can be quickly detected, and timely responses can be made to special circumstances.

[0125] This application's embodiments can also be applied to multiple scenarios in e-commerce backends, such as coupon inventory shortage alerts. When a user enters an activity page, new users are automatically issued exclusive coupons to stimulate consumption. Coupon issuance needs to be configured on the management side; often, once issued, operations staff don't receive the notification, leading to untimely coupon replenishment and many users not receiving coupons and thus unable to make purchases promptly. Therefore, coupon inventory shortage detection tasks can be registered in the task factory. The technical solution in this application embodiment allows operations staff to receive the notification that coupons have been issued within 1 second, and then promptly replenish coupons on the management backend. If 5,000 coupons are issued in a day, each with a discount of 100 yuan, timely replenishment can generate an additional 500,000 yuan in revenue.

[0126] This application embodiment can be applied to a self-built detection task processing system. The system includes a distributed detection system composed of multiple detection nodes, a lock management component, and a task manager. The lock management component handles distributed task lock requests from each node in the distributed detection system. The task manager manages various detection tasks and assigns them to appropriate detection nodes for processing. This enables the system to support distributed, high-concurrency, and lightweight detection tasks. This application embodiment has the advantages of low access cost and good real-time alarm performance; the delay from detecting an anomaly to the user receiving the push notification is in milliseconds. Detection task configuration is flexible, decoupling the three stages of detection task configuration, execution, and push notification. When adding a new detection task, only the relevant interface needs to be implemented and registered with the task factory. Push notifications are simple, easy to understand, and easily expandable, with simple display and customizable support. High concurrency is supported, achieving isolation between detection tasks. Machine resources are fully utilized, supporting single-node and multi-node tasks; multi-node tasks can run simultaneously on multiple nodes. Disaster recovery is supported; if any detection node fails, other detection nodes will take over in real time, ensuring the continuity of detection task execution.

[0127] Please refer to Figure 11 This diagram illustrates a block diagram of a detection task processing device in this embodiment, applied to a target detection node. The device includes:

[0128] The distributed preemption module 101 is used to request a distributed task lock from the lock management component when the timed task is woken up. The lock management component is used to allocate distributed task locks to each detection node based on the preemption mechanism.

[0129] The task request module 102 is used to request a target detection task from the task manager when the distributed task lock is acquired. The task manager is used to allocate detection tasks to each detection node in the distributed detection system.

[0130] The task execution module 103 is used to execute the target detection task when the target detection task is obtained, and to obtain the target task execution result.

[0131] The push module 104 is used to generate push information based on the execution result of the target task and the task configuration information corresponding to the target detection task when the push execution conditions are met, and push the push information to the target client.

[0132] In one embodiment, the task request module is used to perform the following operations:

[0133] The message template component in the above task manager is constructed based on the preset template library, which is used to separate message data and message text.

[0134] Display the prompt target field corresponding to the above message data, as well as at least one of the following fields: prompt title field, prompt type field, and prompt scenario field;

[0135] Having obtained the configuration results corresponding to each of the above fields, the message text corresponding to the above target detection task is generated based on the above configuration results and the above message template component;

[0136] The above task configuration information is determined based on the above message text;

[0137] Based on the task configuration information above, the target detection task is generated.

[0138] In one embodiment, the above-described apparatus further includes a data access module, which is configured to perform the following operations:

[0139] If the execution result of the above target task meets the push triggering conditions, the push configuration management information corresponding to the above target detection task is obtained by accessing the first data management component, and the push status information corresponding to the above target detection task is obtained by accessing the second data management component.

[0140] If the above push configuration management information and the above push status information meet the preset requirements, it is determined that the above push execution conditions are met.

[0141] In one embodiment, the push configuration management information corresponding to the above-mentioned target detection task includes task identifier, prompt switch, prompt start time, prompt end time and prompt frequency, and the push status information corresponding to the above-mentioned target detection task includes each pushed prompt message, and the above-mentioned prompt message corresponds to the above-mentioned target detection task.

[0142] The aforementioned data access module is used to perform the following operations:

[0143] Obtain the task identifier corresponding to the above target detection task;

[0144] Based on the task identifier, query the first data management component and the second data management component to obtain the prompt switch, the prompt start time, the prompt end time, the prompt frequency, and the number of times the prompt has been pushed.

[0145] In one embodiment, the data access module described above is used to perform the following operations:

[0146] Obtain the current system time corresponding to the above target detection nodes;

[0147] When the above-mentioned prompt switch is turned on, the prompt time interval is determined according to the above-mentioned prompt start time and prompt end time;

[0148] If the current system time is within the aforementioned notification time interval, and the number of notifications pushed has not yet met the requirements corresponding to the notification frequency, then the aforementioned preset conditions are deemed to be met.

[0149] In one embodiment, the push module is used to perform the following operations:

[0150] Generate a message template based on the above message text;

[0151] Based on the execution results of the above target tasks and the above message template, push information is generated;

[0152] The target client can be determined based on the target fields provided above.

[0153] The aforementioned push message will be sent to the aforementioned target client.

[0154] In one embodiment, the aforementioned push information is recorded in a target linked list, and each node in the target linked list records its update time; the push module is used to perform the following operations:

[0155] The target node is generated based on the aforementioned push information and the current system time of the aforementioned target detection node;

[0156] Add the target node to the target linked list.

[0157] In one embodiment, the task request module is used to perform the following operations:

[0158] Obtain the runtime configuration information for the above target detection task;

[0159] Based on the above-mentioned operating mode configuration information and task configuration information, the above-mentioned task management component's preset interface is implemented, and the above-mentioned target detection task is registered in the above-mentioned task management component by calling the above-mentioned preset interface.

[0160] In one embodiment, the task execution module described above is used to perform the following operations:

[0161] The execution results of the above target tasks are written into the database, which is used to record the execution results obtained by each target detection node in executing the detection task.

[0162] In one embodiment, the task execution module described above is used to perform the following operations:

[0163] Release the distributed task lock held by the aforementioned target detection node, and have the aforementioned lock management component reclaim the distributed task lock.

[0164] The apparatus portion of the embodiments in this application is based on the same inventive concept as the method embodiment, and will not be described in detail here.

[0165] Furthermore, Figure 12 A schematic diagram of a hardware structure for implementing the method provided in the embodiments of this application is shown. This device can participate in or include the apparatus or system provided in the embodiments of this application. Figure 12 As shown, device 10 may include one or more processors 102 (shown as 102a, 102b, ..., 102n in the figure) 102 (processor 102 may include, but is not limited to, a microprocessor MCU or a programmable logic device FPGA, etc.), a memory 104 for storing data, and a transmission device 106 for communication functions. In addition, it may also include: a display, an input / output interface (I / O interface), a universal serial bus (USB) port (which may be included as one of the ports of the I / O interface), a network interface, a power supply, and / or a camera. Those skilled in the art will understand that... Figure 12 The structure shown is for illustrative purposes only and does not limit the structure of the electronic device described above. For example, device 10 may also include a... Figure 12 The more or fewer components shown, or having the same Figure 12 The different configurations shown.

[0166] It should be noted that the aforementioned one or more processors 102 and / or other data processing circuits are generally referred to herein as "data processing circuits". These data processing circuits may be embodied, in whole or in part, in software, hardware, firmware, or any other combination thereof. Furthermore, the data processing circuits may be a single, independent processing module, or may be integrated, in whole or in part, into any other element within the device 10 (or mobile device). As involved in the embodiments of this application, the data processing circuits serve as a processor control mechanism (e.g., selection of a variable resistor termination path connected to an interface).

[0167] The memory 104 can be used to store software programs and modules of application software, such as the program instructions / data storage device corresponding to the method described in the embodiments of this application. The processor 102 executes various functional applications and data processing by running the software programs and modules stored in the memory 104, thereby realizing the above-described detection task processing method. The memory 104 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include memory remotely located relative to the processor 102, and these remote memories can be connected to the device 10 via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.

[0168] The transmission device 106 is used to receive or send data via a network. Specific examples of the network described above may include a wireless network provided by the communication provider of device 10. In one example, the transmission device 106 includes a Network Interface Controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the transmission device 106 may be a radio frequency (RF) module used for wireless communication with the Internet.

[0169] The display may be, for example, a touchscreen liquid crystal display (LCD) that allows the user to interact with the user interface of device 10 (or mobile device).

[0170] It should be noted that the order of the embodiments described above is merely for descriptive purposes and does not represent the superiority or inferiority of the embodiments. Furthermore, the above description focuses on specific embodiments of this application. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps described in the claims can be performed in a different order than that shown in the embodiments and still achieve the desired result. Additionally, the processes depicted in the drawings do not necessarily require a specific or sequential order to achieve the desired result. In some implementations, multitasking and parallel processing are also possible or may be advantageous.

[0171] The embodiments in this application are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the device and server embodiments are basically similar to the method embodiments, so the descriptions are relatively simple; relevant parts can be referred to the descriptions of the method embodiments.

[0172] Those skilled in the art will understand that all or part of the steps of the above embodiments can be implemented by hardware or by a program instructing related hardware. The program can be stored in a computer-readable storage medium, such as a read-only memory, a disk, or an optical disk.

[0173] The instructions in the aforementioned storage medium can execute a detection task processing method applied to a target detection node, the method including:

[0174] When a scheduled task is woken up, it requests a distributed task lock from the lock management component. The lock management component is used to allocate distributed task locks to each detection node based on a preemption mechanism.

[0175] Once the aforementioned distributed task lock is acquired, a target detection task is requested from the task manager, which is used to allocate detection tasks to each detection node in the aforementioned distributed detection system.

[0176] Having obtained the above-mentioned target detection task, execute the above-mentioned target detection task to obtain the target task execution result;

[0177] If the push execution conditions are met, push information is generated based on the execution results of the target task and the task configuration information corresponding to the target detection task, and the push information is pushed to the target client.

[0178] In one embodiment, the above method further includes:

[0179] The message template component in the above task manager is constructed based on the preset template library, which is used to separate message data and message text.

[0180] Display the prompt target field corresponding to the above message data, as well as at least one of the following fields: prompt title field, prompt type field, and prompt scenario field;

[0181] Having obtained the configuration results corresponding to each of the above fields, the message text corresponding to the above target detection task is generated based on the above configuration results and the above message template component;

[0182] The above task configuration information is determined based on the above message text;

[0183] Based on the task configuration information above, the target detection task is generated.

[0184] In one embodiment, the above method further includes:

[0185] If the execution result of the above target task meets the push triggering conditions, the push configuration management information corresponding to the above target detection task is obtained by accessing the first data management component, and the push status information corresponding to the above target detection task is obtained by accessing the second data management component.

[0186] If the above push configuration management information and the above push status information meet the preset requirements, it is determined that the above push execution conditions are met.

[0187] In one embodiment, the push configuration management information corresponding to the above-mentioned target detection task includes task identifier, prompt switch, prompt start time, prompt end time, and prompt frequency.

[0188] The push notification information corresponding to the above target detection task includes each pushed notification message, and the above notification message corresponds to the above target detection task;

[0189] The above-mentioned push configuration management information corresponding to the target detection task is obtained by accessing the first data management component, and the push status information corresponding to the target detection task is obtained by accessing the second data management component, including:

[0190] Obtain the task identifier corresponding to the above target detection task;

[0191] Based on the task identifier, query the first data management component and the second data management component to obtain the prompt switch, the prompt start time, the prompt end time, the prompt frequency, and the number of times the prompt has been pushed.

[0192] In one embodiment, the above method further includes:

[0193] Obtain the current system time corresponding to the above target detection nodes;

[0194] When the above-mentioned prompt switch is turned on, the prompt time interval is determined according to the above-mentioned prompt start time and prompt end time;

[0195] If the current system time is within the aforementioned notification time interval, and the number of notifications pushed has not yet met the requirements corresponding to the notification frequency, then the aforementioned preset requirements are deemed to be met.

[0196] In one embodiment, the above-mentioned generation of push information based on the execution result of the target task and the task configuration information corresponding to the target detection task, and the push information being pushed to the target client, includes:

[0197] Generate a message template based on the above message text;

[0198] Based on the execution results of the above target tasks and the above message template, push information is generated;

[0199] The target client can be determined based on the target fields provided above.

[0200] The aforementioned push message will be sent to the aforementioned target client.

[0201] In one embodiment, the aforementioned push information is recorded in a target linked list, and each node in the target linked list records the node's update time.

[0202] After generating push information based on the execution result of the target task and the task configuration information corresponding to the target detection task, and pushing the push information to the target client, the method further includes:

[0203] The target node is generated based on the aforementioned push information and the current system time of the aforementioned target detection node;

[0204] Add the target node to the target linked list.

[0205] In one embodiment, generating the target detection task based on the task configuration information includes:

[0206] Obtain the runtime configuration information for the above target detection task;

[0207] Based on the above-mentioned operating mode configuration information and task configuration information, the above-mentioned task management component's preset interface is implemented, and the above-mentioned target detection task is registered in the above-mentioned task management component by calling the above-mentioned preset interface.

[0208] In one embodiment, after obtaining the execution result of the target task, the method further includes: writing the execution result of the target task into a database, wherein the database is used to record the execution results obtained by each target detection node in performing the detection task.

[0209] In one embodiment, after generating push information based on the execution result of the target task and the task configuration information corresponding to the target detection task, and pushing the push information to the target client, the method includes:

[0210] Release the distributed task lock held by the aforementioned target detection node, and have the aforementioned lock management component reclaim the distributed task lock.

[0211] The above are merely preferred embodiments of the present application and are not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present application should be included within the protection scope of the present application.

Claims

1. A detection task processing method, characterized in that, The method includes: The Task Manager retrieves message text generated based on user configuration, obtains task configuration information based on the message text, and registers a corresponding detection task in the Task Manager according to the task configuration information; the message text indicates the information of the recipient of the detection information. Each detection node in the distributed detection system is configured with a corresponding timer, which is used to wake up a scheduled task. The scheduled task is configured visually by the user. For any of the aforementioned detection nodes, when the corresponding scheduled task is awakened, a distributed task lock is requested from the lock management component. The lock management component is used to allocate distributed task locks to each detection node based on a preemption mechanism. When the distributed task lock is obtained, a target detection task is requested from the task manager. The task manager returns the target detection task according to the running mode and task configuration information of each registered detection task. If the target detection task is obtained, the target detection task is executed to obtain the target task execution result; the target detection task is used to detect the task status of the task to be detected. If the execution result of the target task meets the push triggering conditions, the push configuration management information corresponding to the target detection task, which is pre-configured by the user, is obtained by accessing the first data management component, and the push status information corresponding to the target detection task is obtained by accessing the second data management component; if the push configuration management information and the push status information meet the preset requirements, it is determined that the push execution conditions are met; if an abnormal situation is detected, it is determined that the push triggering conditions are met. When the push execution conditions are met, push information is generated based on the execution result of the target task and the task configuration information corresponding to the target detection task, and the push information is pushed to the target client; the distributed task lock held by the target detection node is released, and the distributed task lock is reclaimed by the lock management component.

2. The method according to claim 1, characterized in that, The method further includes: The message template component in the task manager is constructed based on a preset template library, which is used to separate message data and message text. Display the prompt target field corresponding to the message data, as well as at least one of the following fields: prompt title field, prompt type field, and prompt scenario field; Upon obtaining the configuration results corresponding to each of the fields, the message text corresponding to the target detection task is generated based on the configuration results and the message template component.

3. The method according to claim 1, characterized in that, The push configuration management information corresponding to the target detection task includes task identifier, prompt switch, prompt start time, prompt end time, and prompt frequency. The push status information corresponding to the target detection task includes each pushed notification message, and the notification message corresponds to the target detection task; The step of obtaining push configuration management information corresponding to the target detection task by accessing the first data management component, and obtaining push status information corresponding to the target detection task by accessing the second data management component, includes: Obtain the task identifier corresponding to the target detection task; Based on the task identifier, query the first data management component and the second data management component respectively to obtain the prompt switch, the prompt start time, the prompt end time, the prompt frequency, and the number of times it has been pushed.

4. The method according to claim 3, characterized in that, The method further includes: Obtain the current system time corresponding to the target detection node; When the prompt switch is turned on, a prompt time interval is determined based on the prompt start time and the prompt end time; If the current system time is within the notification time interval and the number of pushes has not yet met the requirement corresponding to the notification frequency, the preset requirement is determined to be met.

5. The method according to claim 2, characterized in that, The step of generating push information based on the execution result of the target task and the task configuration information corresponding to the target detection task, and pushing the push information to the target client, includes: Generate a message template based on the message text; Generate push information based on the target task execution result and the message template; The target client is determined based on the target field provided. The push message is sent to the target client.

6. The method according to claim 5, characterized in that, The push information is recorded in a target linked list, and each node in the target linked list records the node's update time. After generating push information based on the execution result of the target task and the task configuration information corresponding to the target detection task, and pushing the push information to the target client, the method further includes: The target node is generated based on the push information and the current system time of the target detection node; Add the target node to the target linked list.

7. The method according to claim 6, characterized in that, The step of generating the target detection task based on the task configuration information includes: Obtain the running mode configuration information of the target detection task; The preset interface of the task management component is implemented based on the operation mode configuration information and the task configuration information, and the target detection task is registered in the task management component by calling the preset interface.

8. The method according to claim 1, characterized in that, After obtaining the execution result of the target task, the method further includes: writing the execution result of the target task into a database, wherein the database is used to record the execution results obtained by each target detection node in executing the detection task.

9. A detection task processing device, characterized in that, The device includes: The task manager is used to obtain message text generated based on user configuration, obtain task configuration information based on the message text, and register a corresponding detection task in the task manager according to the task configuration information; the message text indicates the information of the recipient of the detection information. The distributed preemption module is used to request a distributed task lock from the lock management component when the scheduled task of the corresponding detection node in the distributed detection system is woken up. The lock management component is used to allocate distributed task locks to each detection node based on the preemption mechanism. Each detection node in the distributed detection system is configured with a corresponding timer, which is used to wake up the scheduled task. The scheduled task is configured visually by the user. The task request module is used to request a target detection task from the task manager when the corresponding detection node acquires the distributed task lock. The task manager is used to return the target detection task according to the running mode and task configuration information of each registered detection task. The task execution module is used to execute the target detection task when the target detection task is obtained, and to obtain the target task execution result; the target detection task is used to detect the task status of the task to be detected. The push module is used to, when the execution result of the target task meets the push triggering conditions, obtain the push configuration management information pre-configured by the user corresponding to the target detection task by accessing the first data management component, and obtain the push status information corresponding to the target detection task by accessing the second data management component; determine that the push execution conditions are met when the push configuration management information and the push status information meet preset requirements; and determine that the push triggering conditions are met when an abnormal situation is detected. When the push execution conditions are met, push information is generated based on the execution result of the target task and the task configuration information corresponding to the target detection task, and the push information is pushed to the target client; the distributed task lock held by the target detection node is released, and the distributed task lock is reclaimed by the lock management component.

10. The apparatus according to claim 9, characterized in that, The task request module is used to perform the following operations: The message template component in the task manager is constructed based on a preset template library, which is used to separate message data and message text. Display the prompt target field corresponding to the message data, as well as at least one of the following fields: prompt title field, prompt type field, and prompt scenario field; Upon obtaining the configuration results corresponding to each of the fields, the message text corresponding to the target detection task is generated based on the configuration results and the message template component.

11. The apparatus according to claim 9, characterized in that, The push configuration management information corresponding to the target detection task includes task identifier, prompt switch, prompt start time, prompt end time and prompt frequency; the push status information corresponding to the target detection task includes each pushed prompt message, and the prompt message corresponds to the target detection task. The device further includes a data access module for performing the following operations: Obtain the task identifier corresponding to the target detection task; Based on the task identifier, query the first data management component and the second data management component respectively to obtain the prompt switch, the prompt start time, the prompt end time, the prompt frequency, and the number of times it has been pushed.

12. The apparatus according to claim 11, characterized in that, The data access module is used to perform the following operations: Obtain the current system time corresponding to the target detection node; When the prompt switch is turned on, a prompt time interval is determined based on the prompt start time and the prompt end time; If the current system time is within the notification time interval and the number of pushes has not yet met the requirement corresponding to the notification frequency, the preset requirement is determined to be met.

13. The apparatus according to claim 10, characterized in that, The push module is used to perform the following operations: Generate a message template based on the message text; Generate push information based on the target task execution result and the message template; The target client is determined based on the target field provided. The push message is sent to the target client.

14. The apparatus according to claim 13, characterized in that, The push notification information is recorded in a target linked list, and each node in the target linked list records its update time; the push module is used to perform the following operations: The target node is generated based on the push information and the current system time of the target detection node; Add the target node to the target linked list.

15. The apparatus according to claim 14, characterized in that, The task request module is used to perform the following operations: Obtain the running mode configuration information of the target detection task; The preset interface of the task management component is implemented based on the operation mode configuration information and the task configuration information, and the target detection task is registered in the task management component by calling the preset interface.

16. The apparatus according to claim 9, characterized in that, The task execution module is used to perform the following operations: The execution results of the target task are written into a database, which is used to record the execution results obtained by each target detection node in executing the detection task.

17. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores at least one instruction, which is loaded and executed by a processor to implement a detection task processing method as described in any one of claims 1 to 8.

18. An electronic device, characterized in that, The method includes at least one processor and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the at least one processor implements a detection task processing method as described in any one of claims 1 to 8 by executing the instructions stored in the memory.

19. A computer program product comprising a computer program or instructions, wherein the computer program or instructions, when executed by a processor, implement a detection task processing method according to any one of claims 1 to 8.

Citation Information

Patent Citations

  • Data migration method and data migration system

    CN110532247A

  • Task execution method and device, electronic equipment and computer readable storage medium

    CN114331267A

  • Message pushing method and device, computer equipment and storage medium

    CN114615325A