Task checking method, device, equipment and medium
By dynamically adjusting the task inspection order in the Internet of Things platform, and traversing from the head node or target task node of the task queue based on device information, the problem of low efficiency in task inspection of IoT devices is solved, and more efficient task inspection and execution is achieved.
Patent Information
- Application Number
- CN202411311320.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-20
- Publication Date
- 2025-07-22
- Estimated Expiration
- 2044-09-20
AI Technical Summary
In the prior art, the task inspection method of IoT devices is relatively single, resulting in extremely low task inspection efficiency and the inability to dynamically adjust the inspection order, affecting the task execution efficiency.
By receiving task inspection requests from IoT devices, obtaining device information, traverse the task node from the head node of the task queue to determine whether it matches. If it does not match, determine the target task node based on the task inspection frequency, and traverse from the target node until the matching task or traversal is completed.
It realizes higher flexibility in task inspection, improves task inspection efficiency, ensures priority inspection of target task nodes, and avoids the issuance of previous tasks affecting subsequent task inspections.
Smart Images

Figure CN119383104B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of data processing, and in particular, to a task checking method, device, equipment and medium. Background Art
[0002] With the continuous development of computer technology, the industrial Internet of Things has been increasingly applied to various different scenarios, such as device monitoring and maintenance, production process optimization, intelligent manufacturing, industrial safety, energy management, etc. Among them, the industrial Internet of Things integrates various types of collection and control sensors or controllers with sensing and monitoring capabilities, as well as technologies such as mobile communication and intelligent analysis into all aspects of the industrial production process, thereby greatly improving manufacturing efficiency, improving product quality, reducing product costs and resource consumption, and ultimately realizing the transformation of traditional industries to a new stage of intelligence. Each Internet of Things device in the industrial Internet of Things needs to construct and execute tasks during operation. In order to make the intelligent level of each Internet of Things device higher, how to check the tasks of each Internet of Things device is particularly important.
[0003] Currently, in the related art, the Internet of Things platform sequentially checks whether it is necessary to send tasks to the Internet of Things device from the task queue according to the relevant information of the Internet of Things device. However, this solution needs to sequentially check all tasks in the task queue from the beginning for each task request, and its checking method is relatively single and one-sided, resulting in extremely low task checking efficiency. Summary of the Invention
[0004] The purpose of the present application is to provide a task checking method, device, equipment and medium, which can dynamically adjust the order of task checking, making the task checking more flexible and further improving the task checking efficiency.
[0005] To achieve the above purpose, the present application provides the following solutions:
[0006] In the first aspect, the present application provides a task checking method, including:
[0007] Receiving a current task checking request sent by an Internet of Things device, and obtaining Internet of Things device information;
[0008] According to the Internet of Things device information, traversing all task nodes of the task queue starting from the head node of the task queue, and determining whether there is a task that matches the Internet of Things device information; the task queue includes a plurality of circularly connected task nodes;
[0009] When there is no task that matches the Internet of Things device information, determining a target task node from the task queue, where the target task node is a task node determined from the task queue according to the task checking frequency;
[0010] Traverse all the task nodes in the task queue starting from the target task node, and determine whether there is a task that matches the Internet of Things device information until a task that matches the Internet of Things device information is found or all the task nodes in the task queue have been traversed.
[0011] Optionally, according to the Internet of Things device information, traverse all the task nodes in the task queue starting from the head node of the task queue, and determine whether there is a task that matches the Internet of Things device information. Specifically, it includes:
[0012] Point the head pointer to the head node in the task queue, and determine whether there is a task that matches the Internet of Things device information in the head node;
[0013] When there is a match, point the head pointer to the next sequential node in the task queue; the next sequential node is the next task node in the task queue whose serial number is after the head node.
[0014] When receiving the next task check request sent by the Internet of Things device, traverse all the nodes in the task queue starting from the next task node, and determine whether there is a task that matches the Internet of Things device.
[0015] Optionally, determine the target task node from the task queue. Specifically, it includes:
[0016] Obtain the task matching times of all the task nodes in the task queue;
[0017] Determine the task node with the most task matching times in the task queue as the target task node; or, determine the task node with the least task matching times in the task queue as the target task node.
[0018] Optionally, traverse all the task nodes in the task queue starting from the target task node, and determine whether there is a task that matches the Internet of Things device information until a task that matches the Internet of Things device information is found or all the task nodes in the task queue have been traversed. Specifically, it includes:
[0019] Point the head pointer to the target task node, and determine whether there is a task that matches the Internet of Things device information in the target task node;
[0020] If there is a match, point the head pointer to the next target node of the target task node;
[0021] When receiving the next task check request sent by the Internet of Things device, traverse all nodes of the task queue starting from the next task node, and determine whether there is a task that matches the Internet of Things device until there is a task that matches the information of the Internet of Things device or all task nodes in the task queue are traversed.
[0022] Optionally, when the target task node is the task node with the most task matching times, the next target node is the next task node in the task queue arranged in descending order of task matching times after the target task node;
[0023] When the target task node is the task node with the least task matching times, the next target node is the next task node in the task queue arranged in ascending order of task matching times after the target task node.
[0024] Optionally, the method further includes:
[0025] If there is a task that matches the information of the Internet of Things device in the current task node, send the task to the Internet of Things device; the current task node is the head node or the target task node.
[0026] Optionally, after sending the task to the Internet of Things device, the method further includes:
[0027] Increment the task matching times of the current task node by one.
[0028] In a second aspect, the present application provides a task checking device, including:
[0029] An obtaining module, configured to receive the current task check request sent by the Internet of Things device and obtain the Internet of Things device information;
[0030] A traversing module, configured to traverse all task nodes of the task queue starting from the head node of the task queue according to the Internet of Things device information, and determine whether there is a task that matches the Internet of Things device information; the task queue includes a plurality of circularly connected task nodes;
[0031] A determining module, configured to determine a target task node from the task queue if there is no task that matches the Internet of Things device information, and the target task node is a task node determined from the task queue according to a preset rule;
[0032] A matching module, configured to traverse all task nodes of the task queue starting from the target task node, and determine whether there is a task that matches the Internet of Things device information until there is a task that matches the Internet of Things device information or all task nodes in the task queue are traversed.
[0033] In a third aspect, the present application provides a computer device, including: a memory, a processor, and a computer program stored on the memory and executable on the processor, where the processor executes the computer program to implement the steps of the task checking method described in any one of the above.
[0034] In a fourth aspect, the present application provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the task checking method described in any one of the above are implemented.
[0035] According to the specific embodiments provided by the present application, the following technical effects are disclosed in the present application:
[0036] The present application provides a task checking method, device, equipment and medium. After receiving a current task checking request sent by an Internet of Things device, it obtains Internet of Things device information, and according to the Internet of Things device information, traverses all circularly connected task nodes of the task queue starting from the head node of the task queue, and determines whether there is a task that matches the Internet of Things device information, and can traverse all task nodes in the task queue more comprehensively according to the Internet of Things device information; and when there is no task that matches the Internet of Things device information, it can determine a target task node from the task queue according to the task checking frequency. Each time a task request is made, it does not need to sequentially check all tasks in the task queue from the beginning, but only needs to traverse the task nodes of the task queue starting from the target task node to determine whether there is a task that matches the Internet of Things device information, so that the order of task checking can be dynamically adjusted, and by starting to traverse from the target task node, it is ensured that the target task node is preferentially checked for tasks until there is a task that matches the Internet of Things device information or all task nodes in the task queue are traversed, making the task checking more flexible and further improving the task checking efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings required for use in the embodiments. Obviously, the drawings in the following description are only some embodiments of the present application, and those of ordinary skill in the art can also obtain other drawings based on these drawings without creative efforts.
[0038] Figure 1 It is a schematic structural diagram of an existing task checking method in an embodiment of the present application;
[0039] Figure 2 It is an application environment diagram of a task checking method in an embodiment of the present application;
[0040] Figure 3Schematic flowchart of a task checking method provided by an embodiment of the present application;
[0041] Figure 4 Schematic structural diagram of a task queue provided by an embodiment of the present application;
[0042] Figure 5 Schematic flowchart of the refinement steps of traversing all task nodes of a task queue starting from the head node of the task queue according to the Internet of Things device information provided by an embodiment of the present application;
[0043] Figure 6 Schematic flowchart of a method for traversing all task nodes of a task queue starting from a target task node provided by another embodiment of the present application;
[0044] Figure 7 Schematic structural diagram of a task checking method provided by an embodiment of the present application;
[0045] Figure 8 Schematic diagram of functional modules of a task checking device provided by an embodiment of the present application;
[0046] Figure 9 Schematic structural diagram of a computer device provided by an embodiment of the present application. Detailed implementation manners
[0047] Next, the technical solutions in the embodiments of the present application will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present application.
[0048] As mentioned in the background art, please refer to Figure 1 As shown, in the related art, the Internet of Things platform manages each connected device, and each Internet of Things device reports heartbeat information regularly. When the Internet of Things platform receives a task execution request sent by an Internet of Things device, it obtains the information of the Internet of Things device and sequentially checks whether the current task in the task list needs to be sent to the Internet of Things device one by one. If so, it directly sends the task to the Internet of Things device, sets the task status of the Internet of Things device to in execution, and no longer checks other tasks in the task list; if not, it sequentially checks other tasks in the task list until a task is matched to the Internet of Things device or all tasks are checked. When no task is matched to the Internet of Things device after checking all tasks, a heartbeat information is generated and sent to the Internet of Things device. Among them, the task list includes Task 1, Task 2,..., Task n.
[0049] However, in the above solution, during the task execution process, for each Internet of Things device, all tasks need to be checked from the task list in sequence, and the task check order cannot be dynamically adjusted. If the previous tasks are continuously issued, the subsequent tasks will always be unable to be checked and executed, resulting in a decrease in the task execution efficiency.
[0050] To make the above objects, features, and advantages of the present application more obvious and understandable, the present application will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0051] The task check method provided by the embodiments of the present application can be applied to an Figure 2 application environment as shown. This application environment includes an Internet of Things platform and multiple Internet of Things devices. Among them, the Internet of Things device 102 communicates with the Internet of Things platform 104 through a network. The data storage system can store the data that the Internet of Things platform 104 needs to process. The data storage system can be set up separately, integrated on the Internet of Things platform 104, placed in the cloud or on other servers. The Internet of Things device 102 can send a task check request to the Internet of Things platform 104. After receiving the task check request, the Internet of Things platform 104 obtains the Internet of Things device information. Based on the Internet of Things device information, the Internet of Things platform 104 determines whether there is a task that matches the Internet of Things device information in the task queue until there is a task that matches the Internet of Things device information or all task nodes in the task queue are traversed. The Internet of Things platform 104 can send the matching task to the Internet of Things device 102 for execution.
[0052] Among them, the Internet of Things device 102 can be one or more. The Internet of Things device 102 can be, but is not limited to, various desktop computers, laptop computers, smartphones, tablets, Internet of Things devices, and portable wearable devices. The Internet of Things device can be a smart speaker, a smart TV, a smart air conditioner, a smart vehicle-mounted device, etc. The portable wearable device can be a smart watch, a smart bracelet, a head-mounted device, etc. The Internet of Things platform 104 can be implemented by an independent server or a server cluster composed of multiple servers, and can also be a cloud server.
[0053] In an exemplary embodiment, as Figure 3 shown, a task check method is provided. This method is executed by a computer device, and specifically can be executed alone by a computer device such as a terminal or a server, or jointly executed by a terminal and a server. In the embodiments of the present application, taking this method applied to Figure 2 the Internet of Things platform 104 in as an example for description, it includes the following steps 201 to step 204. Among them:
[0054] Step 201, receive the current task check request sent by the Internet of Things device, and obtain the Internet of Things device information.
[0055] It should be noted that the mapping relationship between tasks and Internet of Things devices can be pre-stored in the above-mentioned Internet of Things platform. Each task can correspond to one or more Internet of Things devices. For example, when there are multiple tasks, they are Task 1, Task 2, and Task 3 respectively. When there are multiple Internet of Things devices, they are Device 1, Device 2, Device 3, and Device 4 respectively. Then Task 1 can correspond to Device 1 and Device 2, Task 2 can correspond to Device 2 and Device 3, and Task 3 can correspond to Device 4.
[0056] Specifically, the above-mentioned Internet of Things device can send a current task check request to the Internet of Things platform, so that the Internet of Things platform receives the current task check request sent by the Internet of Things device and obtains the information of the Internet of Things device. The information of the Internet of Things device can include the identification of the Internet of Things device, the IP address of the Internet of Things device, etc.
[0057] In this step, when receiving the current task check request sent by the Internet of Things device and obtaining the information of the Internet of Things device, it is possible to specifically determine whether there is a task that matches the information of the Internet of Things device, which improves the accuracy of task checking.
[0058] Step 202: According to the information of the Internet of Things device, traverse all task nodes in the task queue starting from the head node of the task queue to determine whether there is a task that matches the information of the Internet of Things device; the task queue includes a plurality of task nodes connected in a ring.
[0059] Specifically, please refer to Figure 4 as shown in Figure 4 which is a schematic structural diagram of the task queue provided by the embodiment of the present application. The above-mentioned task queue includes a plurality of task nodes connected in a ring in sequence. Each task node corresponds to a task, and the task can include a task type and a task execution entity. The task execution entity can be an Internet of Things device. For example, the task queue includes Task Node 1, Task Node 2, Task Node 3, and Task Node 4, and Task Node 1, Task Node 2, Task Node 3, and Task Node 4 are connected in sequence.
[0060] After obtaining the information of the Internet of Things device, based on the information of the Internet of Things device, all task nodes in the task queue can be traversed starting from the head node of the task queue, that is, starting from task node 1 and determining whether the task corresponding to task node 1 matches the information of the Internet of Things device. When the task corresponding to task node 1 matches the information of the Internet of Things device, the task corresponding to this task node 1 is sent to the Internet of Things device; when the task corresponding to task node 1 does not match the information of the Internet of Things device, it can be determined whether the task corresponding to task node 2 matches the information of the Internet of Things device. When the task corresponding to task node 2 matches the information of the Internet of Things device, the task corresponding to this task node 2 is sent to the Internet of Things device; when the task corresponding to task node 2 does not match the information of the Internet of Things device, it can be determined whether the task corresponding to task node 3 matches the information of the Internet of Things device, and so on, until a corresponding task is matched for the Internet of Things device, or all task nodes in the task queue are traversed and no corresponding task is matched.
[0061] Step 203, if there is no task that matches the information of the Internet of Things device, determine a target task node from the task queue. The target task node is the task node determined from the task queue according to the task check frequency.
[0062] Specifically, when there is no task in the task queue that matches the information of the Internet of Things device, a target task node can be determined from the task queue according to the task check frequency. The task check frequency can, for example, include the number of times a task of a certain task node is matched, and its rule can be customized according to actual needs.
[0063] Among them, in the process of determining the target task node from the task queue, it specifically includes: obtaining the task matching times of all task nodes in the task queue, and determining the task node with the most task matching times in the task queue as the target task node, or determining the task node with the least task matching times in the task queue as the target task node.
[0064] Exemplarily, when there are four task nodes in the task queue, namely task node 1, task node 2, task node 3, and task node 4, the task matching times corresponding to each task node are different. For example, the matching times corresponding to task node 1 are 2, the matching times corresponding to task node 2 are 5, the matching times corresponding to task node 3 are 8, and the matching times corresponding to task node 2 are 3. When the target task node is set as the node with the most matching times, the target task node is task node 3; when the target task node is set as the node with the least matching times, the target task node is task node 1.
[0065] In this step, by determining the target task node from the task queue, the order of task checking can be dynamically adjusted. By traversing the tasks in the task queue starting from the target task node, it is ensured that the target task node is preferentially checked for tasks, improving the task checking efficiency.
[0066] Step 204: Starting from the target task node, traverse all the task nodes in the task queue, and determine whether there is a task that matches the Internet of Things device information until there is a task that matches the Internet of Things device information or all the task nodes in the task queue have been traversed.
[0067] Specifically, after determining the target task node, it can start from the target task node and determine whether the task corresponding to the target task node matches the Internet of Things device information. When the task corresponding to the target task node matches the Internet of Things device information, the task corresponding to the target task node is sent to the Internet of Things device; when the task corresponding to the target task node does not match the Internet of Things device information, the next target node can be determined, and it is determined whether the task corresponding to the next target node matches the Internet of Things device information. When the task corresponding to the next target node matches the Internet of Things device information, the task corresponding to the next target node is sent to the Internet of Things device; when the task corresponding to the next target node does not match the Internet of Things device information, the next target node of the next target node can be continuously determined, and it is determined whether the task corresponding to the next target node matches the Internet of Things device information, and so on, until a corresponding task is matched for the Internet of Things device or all the task nodes in the task queue have been traversed and no corresponding task has been matched.
[0068] This application provides a task checking method. After receiving the current task checking request sent by the Internet of Things device, the Internet of Things device information is obtained, and according to the Internet of Things device information, all the circularly connected task nodes in the task queue are traversed starting from the head node of the task queue, and it is determined whether there is a task that matches the Internet of Things device information, so that all the task nodes in the task queue can be traversed more comprehensively according to the Internet of Things device information; and when there is no task that matches the Internet of Things device information, the target task node can be determined from the task queue according to the task checking frequency. Each task request does not need to sequentially check all the tasks in the task queue from the beginning, and only needs to traverse the task nodes in the task queue starting from the target task node to determine whether there is a task that matches the Internet of Things device information, so that the order of task checking can be dynamically adjusted. By starting to traverse from the target task node, it is ensured that the target task node is preferentially checked for tasks until there is a task that matches the Internet of Things device information or all the task nodes in the task queue have been traversed. Moreover, the checking and issuing processes of each task are independent of each other, and the issuing of the previous task does not affect the checking process of the subsequent task, making the task checking more flexible and further improving the task checking efficiency.
[0069] In another exemplary embodiment of the present application, in order to accurately traverse and check each task node in the task queue, all task nodes in the task queue can be traversed starting from the head node to determine whether there is a task that matches the Internet of Things information. For example, Figure 5 As shown, the above step 202 is replaced by the following steps 301 to 303:
[0070] Step 301: Point the head pointer to the head node in the task queue and determine whether there is a task in the head node that matches the Internet of Things device information.
[0071] Step 302: When there is a match, point the head pointer to the next sequential node in the task queue; the next sequential node is the next task node in the task queue whose serial number is after the head node.
[0072] Step 303: When receiving a request for checking the next task sent by the Internet of Things device, traverse all nodes in the task queue starting from the next task node and determine whether there is a task that matches the Internet of Things device.
[0073] It can be understood that nodes and pointers are interdependent. A node includes a data field and a pointer field, and the pointer contained in the pointer field points to the address of the next node. In computer science, a node is a basic component of a data structure. It consists of two parts: a data field and a pointer field. The data field is used to store data elements, that is, to store task information, and the pointer field contains a pointer that points to the address of the next task node.
[0074] Specifically, the task queue includes multiple task nodes and a head pointer. First, the head pointer can be pointed to the head node in the task queue. The head node is the task node whose serial number is at the head of the task queue. For example, the head node can be task node 1 in the task queue. Then, it is determined whether there is a task in task node 1 that matches the Internet of Things information. When there is a match, the task is sent to the Internet of Things device, and the head pointer is pointed to the next sequential node of task node 1 in the task queue. For example, the next sequential node is task node 2, and the head pointer can be pointed to task node 2 in the task queue.
[0075] When the Internet of Things device needs to request the issuance of a task, it can send a task check request to the Internet of Things platform again, so that the Internet of Things platform receives the next task check request sent by the Internet of Things device, traverses all nodes of the task queue starting from task node 2, determines whether the task corresponding to task node 2 matches the Internet of Things device information. When they match, the head pointer is pointed to the next sequential node of task node 2 in the task queue. This next sequential node is, for example, task node 3. The head pointer can be pointed to task node 3 in the task queue, and then further determine whether the task corresponding to task node 3 matches the Internet of Things device information to obtain a matching result, and so on, until a corresponding task is matched for the Internet of Things device, or all task nodes in the task queue are traversed and no corresponding task is matched.
[0076] In this embodiment, when receiving the next task check request sent by the Internet of Things device, all nodes of the task queue are traversed starting from the next task node to determine whether there is a task that matches the Internet of Things device. It does not need to traverse the task queue starting from the head node, and can dynamically adjust the nodes for task checking according to the task matching situation, which is convenient for preferentially checking and matching the nodes with higher matching degrees and improves the efficiency of node checking.
[0077] In another exemplary embodiment of the present application, in order to improve the efficiency of node checking, all task nodes of the task queue can be traversed starting from the target task node, as Figure 6 shown in the above step 204, the method may further include the following steps 401 to 403. Wherein:
[0078] Step 401: Point the head pointer to the target task node and determine whether there is a task that matches the Internet of Things device information in the target task node.
[0079] Step 402: If it exists, point the head pointer to the next target node of the target task node.
[0080] Step 403: When receiving the next task check request sent by the Internet of Things device, traverse all nodes of the task queue starting from the next task node to determine whether there is a task that matches the Internet of Things device until there is a task that matches the Internet of Things device information or all task nodes in the task queue are traversed.
[0081] Specifically, taking the node with the most task matching times as the target task node as an example, when all tasks in the task queue do not match the Internet of Things device information, the node with the most task matching times in the task queue can be determined, and the head pointer is pointed to this node with the most task matching times. Then, it is judged whether there is a task that matches the Internet of Things device information in the target task node. When there is a match, the task corresponding to the target task node is sent to the Internet of Things device, and the next target node of the target task node is determined, and the head pointer is pointed to the next target node of the target task node. This next target node is the next node arranged after the target task node in the order of decreasing task matching times. For example, this next target node is task node 3.
[0082] When the Internet of Things device needs to request the task to be sent down, it can send a task check request to the Internet of Things platform again, so that the Internet of Things platform receives the next task check request sent by the Internet of Things device, traverses all nodes of the task queue starting from task node 3, and judges whether the task corresponding to task node 3 matches the Internet of Things device information. When there is a match, the head pointer is pointed to the next target node of task node 3 in the task queue. For example, this next target node is task node 2. The head pointer can be pointed to task node 2 in the task queue, and further judge whether the task corresponding to task node 2 matches the Internet of Things device information to obtain a matching result, and so on, until a corresponding task is matched for the Internet of Things device, or all task nodes in the task queue are traversed and no corresponding task is matched.
[0083] Among them, when the target task node is the task node with the most task matching times, the next target node is the next task node arranged after the target task node in the order of decreasing task matching times in the task queue; when the target task node is the task node with the least task matching times, the next target node is the next task node arranged after the target task node in the order of increasing task matching times in the task queue.
[0084] Exemplarily, please refer to Figure 7As shown, the task queue includes n circularly connected task nodes, where n > 1, namely task node 1, task node 2,..., task node n - 1, and task node n. Each task node corresponds to a task matching count. For example, an Internet of Things device includes five tasks and needs to send five requests to the Internet of Things platform for task matching. The Internet of Things device can first send a request to the Internet of Things platform, enabling the platform to parse and process the request, obtain the Internet of Things device identification code, and then start traversing the task queue from the head pointer. The head pointer can first point to task node 1 in the task queue, and determine whether there is a task in task node 1 that matches the Internet of Things device identification code. When there is a match, the task corresponding to task node 1 is sent to the Internet of Things device, and the head pointer points to task node 2. When the Internet of Things device sends a request to the Internet of Things platform for the second time, it can start traversing all tasks in the task queue from task node 2; when there is no match, continue traversing the task queue from task node 2 in the task queue, and determine whether there is a task in task node 2 that matches the Internet of Things device identification code until there is a task that matches the Internet of Things device identification code, or all task nodes in the task queue have been traversed.
[0085] If, when receiving the first task request, all task nodes in the task queue do not match the Internet of Things device identification code, the head pointer can be moved to the task node with the highest matching count. Among them, the task matching count of task node 1 is 3, the task matching count of task node 2 is 5, the matching count of task node n - 1 is 8, and the matching count of task node n is 2. Then, the matching count of task node n - 1 is the highest, so the head pointer points to this task node n - 1, and determine whether there is a task in task node n - 1 that matches the Internet of Things device identification code. If there is a match, the task is sent to the Internet of Things device, and the next target node with a relatively higher matching count is determined. This next target node is task node 2, and the head pointer points to task node 2. When the Internet of Things device sends a request to the Internet of Things platform for the second time, it can start traversing all tasks in the task queue from task node 2; when there is no match, continue traversing from task node 2 in the task queue, and determine whether there is a task in task node 2 that matches the Internet of Things device identification code until there is a task that matches the Internet of Things device identification code, or all task nodes in the task queue have been traversed.
[0086] In this embodiment, by setting up a circular task queue, the pointing of the head pointer can be dynamically adjusted according to the task matching count, so as to dynamically adjust the inspection order of task nodes, enabling the target task node in the task queue to perform task inspection preferentially. Then, when there is no match, continue to inspect the subsequent task nodes in the task queue, so that all task nodes are traversed, ensuring that all tasks are traversed and executed, and greatly improving the task inspection efficiency.
[0087] After sending the task to the Internet of Things device, the method further includes: incrementing the task matching count of the current task node by one.
[0088] Specifically, for example, if the matching count of the current task node is 3, when it is determined that the current task node matches the Internet of Things device information, the matching count of the current task node can be incremented by one, and then it is determined that the matching count of the current task node is 4.
[0089] In this embodiment, through the matching count of the task node, the matching order of the task node can be dynamically adjusted according to the matching count, thereby further improving the matching efficiency.
[0090] The present application also provides an application scenario that applies the above task checking method. Specifically: The task checking method provided in this embodiment can be applied in the task distribution scenario. The Internet of Things device sends a task checking request to the Internet of Things platform, so that the Internet of Things platform determines whether there is a task that matches the Internet of Things device information in the task queue. When there is a match, the corresponding task is sent down and enters the downstream task execution link. The task checking method provided in this embodiment belongs to the checking link before task distribution. Based on the same inventive concept, the embodiments of the present application also provide a task checking device for implementing the above-mentioned task checking method. The implementation solutions provided by this device to solve problems are similar to the implementation solutions described in the above method. Therefore, the specific limitations in one or more of the following task checking device embodiments can refer to the limitations on the task checking method in the above text and will not be repeated here.
[0091] In an exemplary embodiment, as Figure 8 shown, a task checking device is provided, including:
[0092] An obtaining module 610, configured to receive the current task checking request sent by the Internet of Things device and obtain the Internet of Things device information;
[0093] A traversing module 620, configured to traverse all task nodes of the task queue starting from the head node of the task queue according to the Internet of Things device information, and determine whether there is a task that matches the Internet of Things device information; the task queue includes a plurality of task nodes connected in a ring;
[0094] A determining module 630, configured to determine a target task node from the task queue if there is no task that matches the Internet of Things device information, where the target task node is a task node determined from the task queue according to a preset rule;
[0095] A matching module 640, configured to traverse all task nodes of the task queue starting from the target task node, and determine whether there is a task that matches the Internet of Things device information until there is a task that matches the Internet of Things device information or all task nodes in the task queue have been traversed.
[0096] As an alternative implementation, the above traversal module 620 is specifically configured to:
[0097] Point the head pointer to the head node in the task queue, and determine whether there is a task in the head node that matches the Internet of Things device information;
[0098] When there is a match, point the head pointer to the next sequential node in the task queue; the next sequential node is the next task node in the task queue whose serial number is after the head node;
[0099] When receiving a next task check request sent by the Internet of Things device, traverse all nodes of the task queue starting from the next task node, and determine whether there is a task that matches the Internet of Things device.
[0100] As an alternative implementation, the above determination module 630 is specifically configured to:
[0101] Obtain the task matching times of all task nodes in the task queue;
[0102] Determine the task node with the most task matching times in the task queue as the target task node; or, determine the task node with the least task matching times in the task queue as the target task node.
[0103] As an alternative implementation, the above matching module 640 is specifically configured to:
[0104] Point the head pointer to the target task node, and determine whether there is a task in the target task node that matches the Internet of Things device information;
[0105] If there is a match, point the head pointer to the next target node of the target task node;
[0106] When receiving a next task check request sent by the Internet of Things device, traverse all nodes of the task queue starting from the next task node, and determine whether there is a task that matches the Internet of Things device until there is a task that matches the Internet of Things device information or all task nodes in the task queue are traversed.
[0107] As an alternative implementation, when the target task node is the task node with the most task matching times, the next target node is the next task node in the task queue arranged in descending order of task matching times after the target task node;
[0108] When the target task node is the task node with the least task matching times, the next target node is the next task node in the task queue arranged in ascending order of task matching times after the target task node.
[0109] As an alternative implementation, the device is further configured to:
[0110] If there is a task that matches the information of the Internet of Things device at the current task node, send the task to the Internet of Things device; the current task node is the head node or the target task node.
[0111] As an alternative implementation, the device is further configured to:
[0112] Increment the task matching count of the current task node by one.
[0113] In an exemplary embodiment, a computer device is provided. The computer device can be a server or a terminal, and its internal structural diagram can be as Figure 9 shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, abbreviated as I / O), and a communication interface. Among them, the processor, the memory, and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store video tag processing data. The input / output interface of the computer device is used for the processor to exchange information with external devices. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, it implements a task checking method.
[0114] Those skilled in the art can understand that Figure 9 the structure shown in
[0115] is only a block diagram of some structures related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0116] In an exemplary embodiment, a computer device is further provided, including a memory and a processor. A computer program is stored in the memory, and when the processor executes the computer program, the steps in the above method embodiments are implemented.
[0117] In an exemplary embodiment, a computer program product is provided, including a computer program which, when executed by a processor, implements the steps in the above method embodiments.
[0118] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use, and processing of relevant data need to comply with relevant regulations.
[0119] Those of ordinary skill in the art can understand that all or part of the processes of implementing the above method embodiments can be completed by instructing relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the above method embodiments. Among them, any reference to a memory, database, or other medium used in the embodiments provided in this application can include at least one of non-volatile and volatile memories. Non-volatile memories can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memories can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc.
[0120] The databases involved in the embodiments provided in this application can include at least one of relational databases and non-relational databases. Non-relational databases can include distributed databases based on blockchain, etc., without limitation. The processors involved in the embodiments provided in this application can be general-purpose processors, central processors, graphics processors, digital signal processors, programmable logic devices, data processing logics based on quantum computing, etc., without limitation.
[0121] The technical features of the above embodiments can be combined arbitrarily. For the sake of brevity of description, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, it should be considered as the scope recorded in this specification.
[0122] Specific examples are used in this article to elaborate on the principles and implementation manners of the present application. The descriptions of the above embodiments are only used to help understand the method and its core idea of the present application; at the same time, for those of ordinary skill in the art, according to the idea of the present application, there will be changes in the specific implementation manners and application scopes. In summary, the content of this specification should not be construed as a limitation to the present application.
Claims
1. A task checking method, characterized in that, The task checking method includes: Receiving a current task checking request sent by an Internet of Things device and obtaining the Internet of Things device information; According to the Internet of Things device information, traversing all task nodes of the task queue starting from the head node of the task queue, and determining whether there is a task that matches the Internet of Things device information; the task queue includes a plurality of circularly connected task nodes; If there is no task that matches the Internet of Things device information, determining a target task node from the task queue, where the target task node is a task node determined from the task queue according to the task checking frequency; Traversing all task nodes of the task queue starting from the target task node, and determining whether there is a task that matches the Internet of Things device information until there is a task that matches the Internet of Things device information or all task nodes in the task queue are traversed; Among them, according to the Internet of Things device information, traversing all task nodes of the task queue starting from the head node of the task queue, and determining whether there is a task that matches the Internet of Things device information specifically includes: Pointing the head pointer to the head node in the task queue, and determining whether there is a task that matches the Internet of Things device information in the head node; When there is, pointing the head pointer to the next sequential node in the task queue; the next sequential node is the next task node in the task queue whose serial number is after the head node; When receiving the next task checking request sent by the Internet of Things device, traversing all nodes of the task queue starting from the next task node, and determining whether there is a task that matches the Internet of Things device.
2. The task checking method according to claim 1, characterized in that Determining the target task node from the task queue specifically includes: Obtaining the task matching times of all task nodes in the task queue; Determining the task node with the most task matching times in the task queue as the target task node; or, determining the task node with the least task matching times in the task queue as the target task node.
3. The task checking method according to claim 2, characterized in that, Traversing all task nodes of the task queue starting from the target task node, and determining whether there is a task that matches the Internet of Things device information until there is a task that matches the Internet of Things device information or all task nodes in the task queue are traversed specifically includes: Pointing the head pointer to the target task node, and determining whether there is a task that matches the Internet of Things device information in the target task node; If there is, pointing the head pointer to the next target node of the target task node; When receiving the next task checking request sent by the Internet of Things device, traversing all nodes of the task queue starting from the next task node, and determining whether there is a task that matches the Internet of Things device until there is a task that matches the Internet of Things device information or all task nodes in the task queue are traversed.
4. The task checking method according to claim 3, wherein When the target task node is the task node with the most task matching times, the next target node is the next task node in the task queue arranged in descending order of task matching times after the target task node; When the target task node is the task node with the least task matching times, the next target node is the next task node in the task queue arranged in ascending order of task matching times after the target task node.
5. The task checking method according to claim 1, characterized in that, The method further includes: If there is a task that matches the Internet of Things device information at the current task node, send the task to the Internet of Things device; the current task node is the head node or the target task node.
6. The task checking method according to claim 5, characterized in that, After sending the task to the Internet of Things device, the method further includes: Increment the task matching times of the current task node by one.
7. A task checking device, characterized in that, The task checking device includes: An obtaining module, configured to receive a current task checking request sent by an Internet of Things device and obtain Internet of Things device information; A traversing module, configured to traverse all task nodes in the task queue starting from the head node of the task queue according to the Internet of Things device information, and determine whether there is a task that matches the Internet of Things device information; the task queue includes a plurality of circularly connected task nodes; A determining module, configured to determine a target task node from the task queue if there is no task that matches the Internet of Things device information, and the target task node is a task node determined from the task queue according to a preset rule; A matching module, configured to traverse all task nodes in the task queue starting from the target task node, and determine whether there is a task that matches the Internet of Things device information until there is a task that matches the Internet of Things device information or all task nodes in the task queue are traversed; The traversing module is specifically configured to: Point the head pointer to the head node in the task queue, and determine whether there is a task that matches the Internet of Things device information at the head node; When there is a match, point the head pointer to the next sequential node of the head node in the task queue; the next sequential node is the next task node in the task queue whose serial number is after the head node; When receiving the next task checking request sent by the Internet of Things device, traverse all nodes in the task queue starting from the next task node, and determine whether there is a task that matches the Internet of Things device.
8. A computer device, comprising: A memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the task checking method according to any one of claims 1-6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the steps of the task checking method according to any one of claims 1-6.
Citation Information
Patent Citations
Program starting method and device, equipment and medium
CN112799822A
Scheduling method, system and equipment and storage medium
CN115481923A