A task query method, device and storage medium

By using historical execution information in the asynchronous task scheduling system to predict the task end time, reducing the number of task queries and delays, the problem that the task initiating system cannot detect the task ending in time is solved, and the simple, universal and low coupling characteristics of task queries are maintained.

CN114579265BActive Publication Date: 2024-11-08TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202011392850.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-12-02
Publication Date
2024-11-08
Estimated Expiration
2040-12-02

AI Technical Summary

Technical Problem

In the existing asynchronous task scheduling system, the task initiation system cannot detect the task ending in time, resulting in an increase in time. The callback method has problems such as high coupling, high implementation cost and inapplicable to all scenarios.

Method used

After receiving the task identifier returned by the task execution system, search for historical execution information of the same type of task in the history record, predict the execution end time of the target task, and send a task query request before and after that time to reduce the number of queries and delays .

Benefits of technology

It realizes the simplicity, generality and low coupling of task query, and timely discovers the end of the task, reducing the time-consuming delay caused by task query.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114579265B_ABST
    Figure CN114579265B_ABST
Patent Text Reader

Abstract

The present application provides a method, device and storage medium for task query, which maintains the simple, universal and low-coupling characteristics of task query, reduces the number of queries, and reduces the time consumption of the task initiation system. After receiving the task identifier returned by the task execution system, search the historical task execution information corresponding to other tasks of the same type as the target task corresponding to the task identifier in the historical records; determine the target query time set for sending a task query request to the task execution system based on the historical task execution information, and the target query time set includes at least one target query time; each time a target query time is reached, send a task query request to the task execution system to query whether the target task has ended; when receiving the target task end notification returned by the task execution system, determine that the target task has ended. Compared with periodic query, it can reduce the number of queries and time consumption, and at the same time adopt a polling method to maintain the simplicity, universality and low coupling characteristics of task query.
Need to check novelty before this filing date? Find Prior Art

Description

Background Art

[0002] At present, asynchronous task scheduling systems are widely used in front-end and back-end systems. Asynchronous task scheduling systems are usually used for interaction between two systems. For example, the task initiation system initiates a task to the task execution system and obtains a task identifier from the task execution system. After receiving the task identifier, the task initiation system periodically sends a query request to the task execution system to inquire whether the task has been completed.

[0003] The use of a simple periodic or incremental task query method makes it impossible for the task initiation system to detect the end of the task in a timely manner. It takes a certain interval of time to detect the end of the task, which increases the time consumption of the task initiation system.

[0004] Therefore, the relevant technology proposes to use a callback method to solve the problem of increased time consumption of the task initiation system. However, when using the callback method, the task execution system needs to perceive the address of the task initiation system, which has a high implementation cost and a high degree of coupling between the task execution system and the task initiation system. At the same time, the callback method is not suitable for all situations. For example, when the task initiation system is in the external network and the task execution system is in the local area network, the callback method cannot be used to determine the end of the task.

[0005] Therefore, there is currently no implementation method that can maintain the characteristics of simple, universal, and low-coupling task query methods while reducing the time-consuming delay of the task initiation system caused by task query. Summary of the invention

[0006] The present application provides a task query method, device and storage medium, which are used to maintain the simplicity, universality and low coupling characteristics of task query, while reducing the task time delay caused by task query.

[0007] In a first aspect, an embodiment of the present application provides a method for querying a task, the method comprising:

[0008] After receiving the task identifier returned by the task execution system, searching the historical records for historical task execution information corresponding to other tasks of the same type as the target task corresponding to the task identifier;

[0009] Determine, based on historical task execution information, a target query time set for sending a task query request to a task execution system, wherein the target query time set includes at least one target query time;

[0010] Whenever a target query time in the target query time set is reached, a task query request is sent to the task execution system to query whether the target task is completed;

[0011] When receiving the target task completion notification returned by the task execution system, it is determined that the target task is completed.

[0012] In a second aspect, an embodiment of the present application provides a task query device, the device comprising:

[0013] A search unit is used to search the historical records for historical task execution information corresponding to other tasks of the same type as the target task corresponding to the task identifier after receiving the task identifier returned by the task execution system;

[0014] A first determining unit, configured to determine a target query time set for sending a task query request to a task execution system according to historical task execution information, wherein the target query time set includes at least one target query time;

[0015] A sending unit, configured to send a task query request to the task execution system every time a target query time in the target query time set is reached, so as to query whether the target task is completed;

[0016] The second determining unit is configured to determine that the target task is completed upon receiving a target task completion notification returned by the task execution system.

[0017] In a possible implementation, the search unit is further configured to:

[0018] If the historical records do not record the historical task execution information corresponding to other tasks of the same type as the target task, the sending unit periodically sends a task query request to the task execution system from the time the task identification is received to query whether the target task is completed.

[0019] In a possible implementation, the first determining unit is used to determine whether the target task corresponding to the task identifier is a task unrelated to user data before determining the target query time set for the task execution system to send a task query request based on historical task execution information.

[0020] In a possible implementation manner, the first determining unit is specifically configured to:

[0021] If the target task is a task unrelated to user data, at least one target query time in the target query time set is determined according to the average execution time determined by the historical task execution information and the preset query times; or

[0022] If the target task is a task related to user data, the first target query time in the target query time set is determined according to the minimum historical task execution time in the historical task execution information, and based on the first target query time, at least one other target query time in the target query time set is determined in a time-increasing manner.

[0023] In a possible implementation manner, after the second determining unit determines that the target task is completed, it is further configured to:

[0024] The interval between the last target query time and the task identification time before receiving the target task end notification is taken as the historical task execution time of the target task;

[0025] The historical task execution information determined according to the historical task execution duration is stored in the historical record.

[0026] In a third aspect, an embodiment of the present application provides a task query device, comprising: a memory and a processor, wherein the memory is used to store computer instructions; and the processor is used to execute computer instructions to implement the task query method provided by the embodiment of the present application.

[0027] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, which stores computer instructions. When the computer instructions are executed by a processor, the task query method provided by the embodiment of the present application is implemented.

[0028] The beneficial effects of this application are as follows:

[0029] The present application provides a method, device and storage medium for task query. In the present application, after receiving the task identifier returned by the task execution system, the historical task execution information corresponding to other tasks of the same type as the target task corresponding to the task identifier is searched in the historical records, and at least one target query time for sending a task query request to the task execution system is determined based on the historical task execution information obtained. When each target query time is reached, a task query request is sent to the task execution system to query whether the target task has ended. When receiving the target task end notification sent by the task execution system, it is determined that the target task has ended. When performing a task query, the execution time of tasks of the same type can be estimated based on the historical execution time of other tasks of the same type. The query time is determined based on the task execution time, so that each target query time is close to the task end time, which can reduce the number of queries. At the same time, the task execution end can be discovered in time, reducing the time-consuming delay caused by the task query.

[0030] Other features and advantages of the present application will be described in the following description, and partly become apparent from the description, or be understood by practicing the present application. The purpose and other advantages of the present application can be realized and obtained by the structures specifically pointed out in the written description, claims, and drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0031] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0032] Figure 1 A flowchart of a task query method in the related art;

[0033] Figure 2 A flowchart of another method for task query in the related art;

[0034] Figure 3 A schematic diagram of an application scenario provided for an embodiment of the present application;

[0035] Figure 4 A flowchart of a task query method provided in an embodiment of the present application;

[0036] Figure 5 A flowchart of an overall method for task query provided in an embodiment of the present application;

[0037] Figure 6 A structural diagram of a task query device provided in an embodiment of the present application;

[0038] Figure 7 A computing device is provided in accordance with an embodiment of the present application. DETAILED DESCRIPTION

[0039] In order to make the purpose, technical solution and beneficial effects of this application clearer, the technical solution in the embodiment of this application will be clearly and completely described below in conjunction with the drawings in the embodiment of this application. Obviously, the described embodiment is only a part of the embodiment of this application, not all the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.

[0040] Some of the terms used in the embodiments of the present application are explained below to facilitate understanding by those skilled in the art.

[0041] The task execution system is a server used to execute tasks. The server can be an independent physical server, a server cluster or a distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDN), and big data and artificial intelligence platforms. Terminal devices can be smartphones, tablets, laptops, desktop computers, smart speakers, smart watches, etc.

[0042] The task initiation system is a client or server used to initiate tasks.

[0043] Cloud technology refers to a hosting technology that unifies hardware, software, network and other resources within a wide area network or local area network to achieve data computing, storage, processing and sharing.

[0044] Cloud technology is a general term for network technology, information technology, integration technology, management platform technology, application technology, etc. based on the cloud computing business model. It can form a resource pool, which can be used on demand and is flexible and convenient. Cloud computing technology will become an important support. The backend services of the technical network system require a large amount of computing and storage resources, such as video websites, picture websites and more portal websites. With the rapid development and application of the Internet industry, in the future, each item may have its own identification mark, which needs to be transmitted to the backend system for logical processing. Data of different levels will be processed separately. All kinds of industry data need strong system backing support, which can only be achieved through cloud computing.

[0045] The following is a brief introduction to the design concept of the embodiments of the present application.

[0046] This application is for task query and is applied to asynchronous task scheduling systems. Asynchronous task scheduling systems are widely used to perform task scheduling and data interaction between clients and servers or between servers. In the relevant technology of task query, the client and the server are usually regarded as separate systems. Taking the task scheduling and data interaction between the client and the server as an example, the client is the task initiation system and the server is the task execution system.

[0047] The task initiation system initiates a task to the task execution system, and the task execution system executes the task initiated by the task initiation system. After receiving the task initiated by the task initiation system, the task execution system returns a response message including the task ID to the task initiation system before ending the task, and executes the task in the task execution system at the same time;

[0048] At this time, the task initiation system will receive the task identifier sent by the task execution system, and after receiving the task identifier, periodically query the task execution system whether the task is completed. Figure 1 A flowchart of a task query method in the related art is provided exemplarily.

[0049] Figure 1 The task initiation system periodically sends a task query request to the task execution system. For example, the task initiation system sends a query request to the task execution system 2 seconds after receiving the task identifier, and receives a query result from the task execution system indicating whether the task is completed. If a query result indicating that the task is not completed is received, a query request is sent to the task execution system again 4 seconds after receiving the task identifier, and receives a query result from the task execution system indicating whether the task is completed. If a query result indicating that the task is not completed is received, a query request is sent to the task execution system again 6 seconds after receiving the task identifier, and so on, until a query result indicating that the task is completed is received.

[0050] In the method of periodically sending task query requests to the task execution system, there is a situation where the task execution system has already ended the task, but because it has not received the query request, it cannot return the query result, resulting in the task initiation system needing a certain time interval to find out that the task has ended, that is, the task initiation system cannot determine in time that the task has ended, resulting in increased time consumption at the task initiation system. For example, the task execution system ends the task 4 to 5 seconds after sending the task identifier, but receives a query request from the task initiation system at the 6th second. At this time, the task initiation system needs a time interval of 1 to 2 seconds to find out that the task has ended.

[0051] In the related art, when performing task query, it is also considered to use the method of increasing time interval to perform task query, for example, the first query time is 2 seconds after receiving the task identifier, the second query time is 4 seconds after receiving the task identifier, and the third query time is 8 seconds after receiving the task identifier, and the query time is determined in sequence in an increasing time interval manner. The task query method using the increasing time interval has the same problem as the periodic query, that is, the task initiation system cannot detect the end of the task in time, resulting in an increase in the time consumption of the task initiation system.

[0052] Therefore, another implementation method is provided in the related technology, that is, the task execution system actively calls back the callback address of the task initiation system when determining that the task is completed, and sends a notification of the task completion to the task initiation system, where the callback method can be a callback interface, a long connection, or a message queue push event. Figure 2 An exemplary flowchart of another task query method in the related art is provided.

[0053] The task execution system uses a callback method to enable the task initiation system to promptly discover the end of the task and solve the problem of increased time consumption. However, the callback method introduces the following problems:

[0054] 1. The implementation cost is relatively high. In the task query solution, the interaction method between the task initiation system and the task execution system is that the task initiation system sends a request message to the task execution system, and the task execution system replies to the task initiation system according to the request message. The callback method requires the task execution system to perceive the address of the task initiation system. If the task initiation system restarts or other abnormal situations occur, handling the exception will become complicated. At the same time, when the task initiation system is in the external network and the task execution system is in the local area network, the callback method cannot be used;

[0055] 2. The task initiation system and the task execution system are highly coupled. When adding or replacing a task initiation module or execution module, the added module must also provide a callback interface in the corresponding format, implement a long connection, or introduce the same message queue component;

[0056] 3. In the case of multiple initiators, multiple callback addresses, multiple long connections, and multiple message queues will increase operation and maintenance management costs and resource costs;

[0057] 4. Some modules have pure target functions and are not suitable for callbacks. For example, Linux shell commands, such as dd and scp, will be executed in the background and the results will be checked periodically if the command request time is too long. MySQL provides online buffer_pool adjustment capabilities, and the official interface for adjusting the progress using SQL queries is also provided. However, there is currently no solution for the MySQL kernel to actively call back the control system or notify the client of events.

[0058] In view of this, the present application provides a method for task query. In order to avoid the drawbacks caused by the callback method for task query, when performing task query in the embodiment of the present application, a polling query method of sending a query request to the task execution system to obtain the corresponding query result is still adopted, so as to maintain the simple, universal and low coupling characteristics of task query. However, due to the periodic or incremental query method in the related art, the task initiation system cannot timely find out whether the task has been executed, resulting in a time-consuming delay in the task. Therefore, the periodic or incremental query method is no longer adopted in the present application, but firstly predicts the time when the target task is executed based on the historical task execution information corresponding to other tasks of the same type, that is, predicts the total execution time of the target task, and before and after the time when the target task is executed, at least one time point adjacent to the target task execution end time is determined as the target query time, and a query request is sent when the target query time arrives. At this time, the time of sending the query request is closer to the time when the target task is executed, which can reduce the number of times the task initiation system sends the query request, and the task initiation system promptly determines the end of the target task execution, reducing the time-consuming delay of the task caused by the task query.

[0059] In the embodiment of the present application, the predicted time of the target task execution is based on the historical task execution information corresponding to other tasks of the same type. Therefore, in the initial state, it is necessary to query whether the task execution is completed in a periodic polling manner or an incremental polling manner to determine the time of the target task execution completion, and store the execution information of the task and the task type of the task. Multiple accumulations can determine whether the total duration of the task execution completion of the task type during the execution process is fixed.

[0060] For a task of a certain task type, when the task execution time is fixed during execution, the normal distribution can be used to fit the task execution time, that is, the task execution time conforms to the normal distribution, and the average execution time of historical tasks, the sum of squares of execution time, etc. can be determined based on the total execution time of historical tasks of the same type. Further, the average execution time of tasks corresponding to the task type can be determined based on the normal distribution. At this time, the average task execution time is used as the predicted target task execution time. At this time, at least one target query time can be determined before and after the average execution time, that is, at least one target query time is determined based on the average execution time;

[0061] For a task of a certain task type, in the case where the task execution time is not fixed during execution, the minimum execution time of the task corresponding to the task type can be determined. At this time, the minimum execution time can be used as the predicted target task execution time. When the query time is determined based on the target task execution time, the time corresponding to the time when the time from the receipt of the task identifier to the minimum execution time can be used as the first target query time. After the first query, the query is performed using periodic polling or incremental polling to avoid frequent queries in the early stage and waste of resources, that is, at least one target query time is determined based on the minimum execution time.

[0062] Among them, the total task execution time, average execution time, sum of squares of execution time and minimum execution time are historical task execution information. Therefore, in this application, at least one target query time is determined based on the historical task execution information.

[0063] In one possible implementation, after receiving a task identifier returned by a task execution system, historical task execution information corresponding to other tasks of the same type as the target task corresponding to the task identifier is searched in the historical records, and based on the historical task execution information, a target query time set for sending a query request group to the task execution system is determined, the target query time combination includes at least one target query time, and each time a target query time in the target query time set is reached, a task query request is sent to the task execution system to query whether the target task has ended; when a target task end notification returned by the task execution system is received, it is determined that the target task has ended.

[0064] The total execution time of the target task is predicted through the total execution time of historical tasks, the minimum execution time of historical tasks, the average execution time, the sum of squares and other information in the historical task execution information, so as to determine at least one target query time according to the predicted total execution time of the target task. When querying at the target query time, the target query time is closer to the end time of the target task execution, so polling can be performed more accurately, reducing the task time delay caused by periodic or incremental polling, and maintaining the simplicity, universality and low coupling characteristics of polling.

[0065] After introducing the design ideas of the embodiments of the present application, the following briefly introduces the application scenarios to which the technical solutions of the embodiments of the present application can be applied. It should be noted that the application scenarios introduced below are only used to illustrate the embodiments of the present application and are not limited. In the specific implementation process, the technical solutions provided by the embodiments of the present application can be flexibly applied according to actual needs.

[0066] Figure 3 An application scenario diagram of an embodiment of the present application is provided by way of example, and the application scenario includes a terminal device 10 and a server 11.

[0067] Among them, various applications are installed and run in the terminal device 10, and the terminal device 10 is an electronic device used by the user, and the electronic device can be a personal computer, a mobile phone, a tablet computer, a notebook, an e-book reader, etc., which has a certain computing power and runs instant messaging software and websites or social software and websites;

[0068] The server 11 may be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDN), and big data and artificial intelligence platforms. The terminal device may be a smart phone, tablet computer, laptop computer, desktop computer, smart speaker, smart watch, etc.

[0069] In an optional implementation, the terminal device 10 and the server 11 can communicate via a communication network. The communication network is a wired network or a wireless network. The terminal device 10 is indirectly connected to the server 11 via a wireless access point 12, or the terminal device 10 is directly connected to the server 11 via the Internet, which is not limited in this application.

[0070] In one possible implementation, the terminal device 10 initiates a task to the server 11. After receiving the task, the server 11 returns a task identifier to the terminal device 10. After receiving the task identifier, the terminal device 10 sends a task query request with the task identifier to the server 11, so that the server 11 searches the task identifier to determine whether the task corresponding to the task identifier has been completed.

[0071] In a possible implementation, the present application uses cloud computing to provide services for the terminal device 10. Cloud computing is a computing model that distributes computing tasks on a resource pool consisting of a large number of computers, each of which can act as a server, so that various application systems can obtain computing power, storage space and information services as needed. The network that provides resources is called a "cloud". The resources in the "cloud" are infinitely expandable in the eyes of users, and can be obtained at any time, used on demand, expanded at any time, and paid for by use.

[0072] As a provider of basic cloud computing capabilities, a cloud computing resource pool (referred to as a cloud platform, generally referred to as an Infrastructure as a Service (IaaS) platform) will be established, and various types of virtual resources will be deployed in the resource pool for external customers to choose to use. The cloud computing resource pool mainly includes: computing devices (virtualized machines, including operating systems), storage devices, and network devices.

[0073] According to the logical function division, the Platform as a Service (PaaS) layer can be deployed on the Infrastructure as a Service (IaaS) layer, and the Software as a Service (SaaS) layer can be deployed on the PaaS layer. SaaS can also be deployed directly on IaaS. PaaS is a platform for software operation, such as databases, web containers, etc. SaaS is a variety of business software, such as web portals, SMS mass senders, etc. Generally speaking, SaaS and PaaS are upper layers relative to IaaS.

[0074] Among them, cloud computing is the product of the development and integration of traditional computer and network technologies such as grid computing, distributed computing, parallel computing, utility computing, network storage technologies, virtualization, and load balancing.

[0075] In a possible implementation, the present application is also applicable to scenarios where servers interact with each other, and scenarios where a terminal device interacts with a server are similar, which will not be described in detail here.

[0076] based on Figure 3 In the application scenario, the method for task query involved in the embodiment of the present application is illustrated below.

[0077] Please refer to Figure 4 , Figure 4 A task query method in an embodiment of the present application is exemplarily provided, which is applied to an asynchronous task scheduling system. The method includes the following steps:

[0078] Step S400: after receiving the task identifier returned by the task execution system, searching the historical records for historical task execution information corresponding to other tasks of the same type as the target task corresponding to the task identifier.

[0079] The historical task execution information includes one or a combination of the following: at least one historical task total execution time, historical task minimum execution time, historical task average execution time, sum of squares, variance, and number of tasks.

[0080] In the embodiment of the present application, the task initiation system and the task execution system interact with each other, and the task initiation system can initiate a task request to the task execution system. After receiving the task request sent by the task initiation system, the task execution system determines the corresponding task according to the task request, generates a task identifier according to the task, and returns the task identifier to the task initiation system. After receiving the task identifier returned by the task execution system, the task initiation system searches the historical records for the historical task execution information corresponding to other tasks of the same type as the target task corresponding to the task identifier, so as to determine the time to send the task query request according to the historical task execution information.

[0081] The following example takes the task initiation system as the client and the task execution system as the server:

[0082] When the client detects the user's input operation, it determines that the task corresponding to the input operation needs to be executed, generates a Uniform Resource Locator (URL) according to the task, and establishes a connection with the server. In this way, the client can send a task request in the form of a URL to the server through the connection to request the server to execute the task;

[0083] Correspondingly, after receiving the task request sent by the client, the server determines the corresponding task according to the URL in the task request. The task may include the application code, task name, etc. Further, the server generates a task identifier according to the task, and uses the task identifier as an attribute included in the task to uniquely identify the task;

[0084] The server returns the task identifier to the client. After receiving the task identifier returned by the server, the client can send a task query request to the server to query whether the task is completed.

[0085] In an embodiment of the present application, when it is determined that a task query request is to be sent to a task execution system, the target query time for sending the task query request can be determined based on historical task execution information recorded in the historical records corresponding to other tasks of the same type as the target task corresponding to the task identifier returned by the task execution system.

[0086] Therefore, after receiving the task identifier returned by the task execution system, it should be determined first whether other tasks of the same type as the target task corresponding to the task identifier and the corresponding historical task execution information are recorded in the historical record. If other tasks of the same type as the target task corresponding to the task identifier and the corresponding historical task execution information are recorded, continue to execute step S401.

[0087] In a possible implementation, if other tasks of the same type as the target task corresponding to the task identifier and corresponding historical task execution information are not recorded in the historical records, a task query request is periodically sent to the task execution system;

[0088] For example, taking 2 seconds as the task query cycle, at this time, the task query request is sent to the task execution system 2 seconds after the task identification time is received; after determining that the target task has not been completed, the task query request is sent to the task execution system 4 seconds after the task identification time is received; after determining that the target task has not been completed, the task query request is sent to the task execution system 6 seconds after the task identification time is received; and so on, until the target task completion notification is received, it is determined that the target task is completed.

[0089] In a possible implementation, when there are no other tasks of the same type as the target task corresponding to the task identifier and the corresponding historical task execution information recorded in the historical records, a task query request may be sent to the task execution system in an incremental time interval manner;

[0090] For example, the incremental time corresponding to the time interval between two adjacent task query requests is 2 seconds. At this time, the task query request is sent to the task execution system 2 seconds after the task identification time is received; after determining that the target task has not been completed, the task query request is sent to the task execution system 4 seconds after the task identification time is received; after determining that the target task has not been completed, the task query request is sent to the task execution system 8 seconds after the task identification time is received, and so on, until the target task completion notification is received and the target task is determined to be completed.

[0091] After determining that the target task has been completed, the interval between the last task query time and the time of receiving the task identification before receiving the target task completion notification is used as the total historical task execution time of the target task; and based on the total historical task execution time, the historical task execution information is determined, and finally the historical task execution information is stored in the historical record, so as to determine the time for sending the task query request corresponding to the target task based on the historical task execution information recorded in the historical record.

[0092] For example, 6 seconds after receiving the task time, a task query request is sent to the task execution system, and after receiving the target task completion notification returned by the task execution system, it is determined that the total execution time of the target task is 6 seconds. At this time, the total execution time of the historical task can be recorded as 6 seconds in the historical execution information in the historical record. At this time, the historical record includes the total execution time of the historical tasks corresponding to the target task, so that when you query again whether the same type of target task has ended, you can determine the time to send the task query request based on the historical task execution time.

[0093] In an embodiment of the present application, historical task execution information such as the average execution time of historical tasks, the sum of squares, the minimum execution time of historical tasks, and the number of tasks can be determined based on the historical task execution time.

[0094] In one embodiment, in order to save space, for tasks whose task execution time follows a normal distribution, not all historical task execution times may be recorded in the historical records, but only the average execution time, the sum of squares, and the number of tasks. The variance can be determined based on the average execution time, the sum of squares, and the number of tasks; the shape and position of the normal distribution can be determined based on the variance and the average, and further, at least one target query time in the target query time set can be determined. The task number is stored in the historical records so that the average and variance can be updated again based on the number of tasks after the new task is completed.

[0095] In one embodiment, for tasks whose task execution duration does not follow a normal distribution, only the minimum historical task execution time may be stored in the historical records.

[0096] In the embodiment of the present application, whether the task execution time conforms to the normal distribution is determined based on whether the total task execution time corresponding to multiple tasks of the same type is fixed. If the total task time of multiple tasks of the same type is fixed, it conforms to the normal distribution. If the total task execution time of multiple tasks of the same type is not fixed, it does not conform to the normal distribution. For example, data related to users, such as the daily write data of backup users, some users generate less or no new data every day, at this time the total task execution time is shorter, while some users generate more new data every day, at this time the total task execution time is longer, the task execution time is not fixed, so the task does not conform to the normal distribution; and data not related to users, such as user-triggered transfer tasks, the total execution time of the task has nothing to do with the amount the user needs to transfer, no matter how much the transfer amount is, there is only a slight difference in the total execution time, at this time the task conforms to the normal distribution.

[0097] Step S401: Determine a target query time set for sending a task query request to a task execution system according to historical task execution information, wherein the target query time set includes at least one target query time.

[0098] Different types of tasks have different execution times, and the same types of tasks also have different execution times. However, the execution times of most tasks that are not related to user data follow a normal distribution, while tasks related to user data do not follow a normal distribution.

[0099] Therefore, in an embodiment of the present application, for tasks whose task execution duration follows a normal distribution and for tasks whose task execution duration does not follow a normal distribution, the method of determining the target query time set for sending a task query request to the task execution system based on historical task execution information is different.

[0100] And because the execution time corresponding to tasks related to user data does not follow a normal distribution, the execution time corresponding to most tasks unrelated to user data follows a normal distribution. Therefore, in the embodiment of the present application, before determining the target query time set for the task execution system to send a task query request based on historical task execution information, it is determined whether the target task corresponding to the task identifier is a task unrelated to user data.

[0101] When the target task is determined to be a task unrelated to user data, the target query time set is determined according to the historical task execution information in the following manner:

[0102] For tasks that are not related to user data and have a relatively fixed execution time, the normal distribution can be used to fit the task end time, and then at least one target query time can be determined based on the fitted task end time.

[0103] Method 1: When the historical task execution information includes the average execution time, variance, and number of tasks of historical tasks.

[0104] At least one target query time in the target query time set is determined according to the average execution time in the historical task execution information and the preset query times.

[0105] Method 2: When the historical task execution information does not include the historical task average execution time, variance, and number of tasks, but includes the historical task execution time.

[0106] Determine the average execution time according to the historical task execution time in the historical task execution information;

[0107] At least one target query time in the target query time set is determined according to the average execution time and the preset query number.

[0108] In the embodiment of the present application, when the total execution time of historical tasks conforms to the normal distribution, the end time of most tasks is the time corresponding to the average execution time, that is, the probability of the target task execution ending at the time corresponding to the average execution time is the highest, and the probability of determining the end of the target task execution is the highest, and whether the task execution has ended can be discovered in time, so the average execution time is used as the predicted total execution time of the target task, that is, the time point when the target task execution may end is predicted based on the average execution time. Since it is a prediction, in order to query more accurately, it is necessary to determine the target query time according to the preset number of queries before and after the predicted end time of the target task execution.

[0109] For example, according to the average execution time of 6 seconds in the historical task execution information and the preset query number of 3 times, at least one target query time in the target query time set is determined in the vicinity of the average execution time, such as the target query time set is {5.7 seconds, 6.4 seconds, 7 seconds}.

[0110] In the embodiment of the present application, since the execution time of tasks that are not related to user data follows the normal distribution, when determining the specific value in the target query time set, it can be determined by the time corresponding to the area percentage under the normal distribution and the number of queries. For example, the time point corresponding to the average execution time of the normally distributed tasks is the time when 50% of the tasks have ended. If the preset number of queries corresponding to the task initiation system is 2 times, and 50% of the tasks are returned each time, then the first target query time is the average value of the normal distribution, and the second target query time is the value when the normal distribution area reaches 99.9%.

[0111] When the target task is determined to be a task related to user data, the target query time set is determined according to the historical task execution information in the following manner:

[0112] For tasks related to user data, the task execution time is not fixed, but there is a minimum task execution time. Therefore, the minimum value of the historical task execution time can be used to determine the target query time set.

[0113] In order to avoid wasting resources by frequent queries in the early stage, the minimum execution time of historical tasks is used as the predicted total execution time of the target task, that is, the time point when the target task execution may end. Since it is a prediction, the first task query request is made at the time corresponding to the minimum execution time of the historical task. If the query result returned is that the task execution is completed, the task end can be found in time to reduce time delay. If the query result returned is that the task execution is not completed, continue to send task query requests.

[0114] In a possible implementation, the minimum historical task execution time is determined in the historical task execution information, for example, 3 seconds;

[0115] The minimum historical task execution duration is taken as the interval between the first target query time and the time after receiving the task identifier returned by the task execution system. At this time, the first target query time is 3 seconds after receiving the task identifier returned by the task execution system, that is, the first task query request is sent 3 seconds after receiving the task identifier returned by the task execution system.

[0116] After the first target query time is determined, at least one other target query time in the target query time set is determined based on the first target query time in an increasing time interval manner.

[0117] For example, at least one other target query time in the target time set is determined in increments of 1 second. At this time, the second target query time is the 4th second after receiving the task identifier returned by the task execution system, the third target query time is the 6th second after receiving the task identifier returned by the task execution system, and the third target query time is the 9th second after receiving the task identifier returned by the task execution system.

[0118] In a possible implementation, after the first target query time is determined, at least one other target query time in the target query time set is determined based on the first target query time at a fixed time interval.

[0119] For example, at least one other target query time in the target time set is determined with a fixed time interval of 1 second. At this time, the second target query time is the 4th second after receiving the task identifier returned by the task execution system, the third target query time is the 5th second after receiving the task identifier returned by the task execution system, and the third target query time is the 6th second after receiving the task identifier returned by the task execution system.

[0120] Step S402: Every time a target query time in the target query time set is reached, a task query request is sent to the task execution system to query whether the target task is completed.

[0121] For example, the target task is a task that is not related to user data, and the determined target query time set is {5.7 seconds, 6.4 seconds, 7 seconds}. At this time, when it is 5.7 seconds away from receiving the task identifier returned by the task execution system, a task query request is sent to the task execution system to inquire whether the target task is completed; if it is not completed, when it is 6.4 seconds away from receiving the task identifier returned by the task execution system, the task query request is continued to be sent to the task execution system to inquire whether the target task is completed; if it is not completed, when it is 7 seconds away from receiving the task identifier returned by the task execution system, the task query request is continued to be sent to the task execution system to inquire whether the target task is completed.

[0122] In one possible implementation, if after sending a task query request at the last target query time in the target query time set, a notification that the target task has not been completed is still received, the subsequent query time is determined by using an increasing time interval or a fixed time interval until the target task completion notification is received.

[0123] For example, 7 seconds after receiving the task identifier returned by the task execution system, a task query request is sent to the task execution system. After receiving the notification that the target task has not been completed, 8 seconds after receiving the task identifier returned by the task execution system, a task query request is continued to be sent to the task execution system.

[0124] Step S405, upon receiving the target task completion notification returned by the task execution system, determining that the target task is completed.

[0125] In an embodiment of the present application, after determining that the target task is received, the interval between the last task query time and the time when the task identification is received before the target task end notification is received is used as the historical task execution duration of the target task, and the historical task execution information determined based on the historical task execution duration is stored in the historical record, so as to determine the time for sending the task query request corresponding to the target task based on the historical task execution information recorded in the historical record.

[0126] For example, when a task is initiated for the first time, a periodic query is used to send a task query request to the task execution system. After the task is completed, the historical records will contain historical task execution information, and the average execution time can be determined based on the historical task execution information.

[0127] When initiating a task of the same type for the second time, based on the average execution time, queries are performed according to the preset number of times near the average execution time. At this time, the second task initiation may find that the task is completed in one query, which takes less time than the first task query and reduces the number of unnecessary queries. After the task is completed, the historical task execution information in the historical record is updated, and the average execution time is also updated;

[0128] When initiating the same type of task for the third time and querying the task, the average execution time makes the first query shorter, and the wasted time is less than the time spent on the second task query of the same type; and so on. The whole process is to continuously update the historical task execution information in the historical records, and update the average execution time based on the historical task execution information. As the task continues to proceed, the historical records are continuously updated, and the effect of predicting the target query time will become better and better. At the same time, the query interval is shorter each time because the time delay caused by the task query is less.

[0129] In a possible implementation, the target task completion notification returned by the task execution system may include the actual execution time of the target task. When determining that the target task completion notification includes the actual execution time of the target task, the actual execution time of the target task is stored in the historical record as historical task execution information. The target query time is predicted more accurately based on the actual execution time, which can further reduce the number of queries and avoid meaningless early queries.

[0130] Figure 5 An exemplary flowchart of an overall method for task query in an embodiment of the present application is provided, and the method includes the following steps:

[0131] Step S500, the task initiation system sends the task to the task execution system;

[0132] Step S501, the task execution system sends a task identifier to the task initiation system;

[0133] Step S502, after receiving the task identifier returned by the task execution system, the task initiation system searches the historical records for historical task execution information corresponding to other tasks of the same type as the target task corresponding to the task identifier. If found, step S503 is executed, otherwise step S510 is executed;

[0134] Step S503: the task initiation system determines a target query time set for sending a task query request to the task execution system according to the historical task execution information, wherein the target query time set includes at least one target query time;

[0135] Step S504, every time a target query time in the target query time set is reached, the task initiation system sends a task query request to the task execution system to query whether the target task is completed;

[0136] Step S505, after receiving the task query request sent by the task initiation system, the task execution system queries whether the target task is completed. If the target task is completed, step S506 is executed, otherwise step S508 is executed;

[0137] Step S506, the task execution system returns a target task completion notification to the task initiation system;

[0138] Step S507, the task initiation system uses the interval between the last target query time that arrived before receiving the target task end notification and the time when the task identification was received as the historical task execution time of the target task, and stores the historical task execution information determined according to the historical task execution time in the historical record;

[0139] Step S508, the task execution system returns a notification that the target task has not been completed to the task initiation system;

[0140] Step S509, the task initiation system returns to step S504;

[0141] Step S510, the task initiation system periodically sends a task query request to the task execution system from the time of receiving the task identification to query whether the target task is completed;

[0142] Step S511, after receiving the task query request sent by the task initiation system, the task execution system queries whether the target task is completed. If the target task is completed, step S512 is executed, otherwise step S514 is executed;

[0143] Step S512, the task execution system returns a target task completion notification to the task initiation system;

[0144] Step S513, the task initiation system uses the interval between the query time corresponding to the last query request and the time when the task identification is received before receiving the target task completion notification as the historical task execution time of the target task, and stores the historical task execution information determined according to the historical task execution time in the historical record;

[0145] Step S514, the task execution system returns a target task unfinished notification to the task initiation system;

[0146] Step S515, the task initiating system returns to step S510.

[0147] In the embodiment of the present application, the historical task execution information is used to predict the time point when the target task may end, and a task query request is sent to the task execution system at the time point when the target task may end, which can avoid unnecessary query times, and the task initiation system can promptly discover the end of the target task, reducing the time-consuming delay of the task caused by the task query. At the same time, the present application still maintains the characteristics of simple, universal, and low coupling of task query. In the embodiment of the present application, the historical records are continuously optimized to make the predicted time point of the target task more and more accurate, and further discover the end of the target task more and more timely.

[0148] Based on the same inventive concept, the embodiment of the present application also provides a task query device 600, such as Figure 6 As shown, the device 600 includes: a searching unit 601, a first determining unit 602, a sending unit 603 and a second determining unit 604, wherein:

[0149] A search unit 601 is used to search the historical records for historical task execution information corresponding to other tasks of the same type as the target task corresponding to the task identifier after receiving the task identifier returned by the task execution system;

[0150] A first determining unit 602 is used to determine a target query time set for sending a task query request to the task execution system according to historical task execution information, where the target query time set includes at least one target query time;

[0151] The sending unit 603 is used to send a task query request to the task execution system every time a target query time in the target query time set is reached to query whether the target task is completed;

[0152] The second determining unit 604 is configured to determine the target task is completed upon receiving a target task completion notification returned by the task execution system.

[0153] In a possible implementation, the searching unit 601 is further configured to:

[0154] If the historical records do not record the historical task execution information corresponding to other tasks of the same type as the target task, the sending unit periodically sends a task query request to the task execution system from the time the task identification is received to query whether the target task is completed.

[0155] In a possible implementation, the first determining unit 602 is further used to determine whether the target task corresponding to the task identifier is a task unrelated to user data before determining the target query time set for the task execution system to send a task query request based on historical task execution information.

[0156] In a possible implementation manner, the first determining unit 602 is specifically configured to:

[0157] If the target task is a task unrelated to user data, at least one target query time in the target query time set is determined according to the average execution time determined by the historical task execution information and the preset query times; or

[0158] If the target task is a task related to user data, the first target query time in the target query time set is determined according to the minimum historical task execution time in the historical task execution information, and based on the first target query time, at least one other target query time in the target query time set is determined in a time-increasing manner.

[0159] In a possible implementation, after the second determining unit 604 determines that the target task is completed, it is further configured to:

[0160] The interval between the last target query time and the task identification time before receiving the target task end notification is taken as the historical task execution time of the target task;

[0161] The historical task execution information determined according to the historical task execution time is stored in the historical record.

[0162] For the convenience of description, the above parts are divided into units (or modules) according to their functions and described separately. Of course, when implementing this application, the functions of each unit (or module) can be implemented in the same or multiple software or hardware.

[0163] After introducing the method and apparatus for task query according to an exemplary embodiment of the present application, a computing device for task query according to another exemplary embodiment of the present application is introduced next.

[0164] Those skilled in the art will appreciate that various aspects of the present application may be implemented as a system, method or program product. Therefore, various aspects of the present application may be specifically implemented in the following forms, namely: a complete hardware implementation, a complete software implementation (including firmware, microcode, etc.), or a combination of hardware and software, which may be collectively referred to as "circuit", "module" or "system" herein.

[0165] In a possible implementation, the task query computing device provided in the embodiment of the present application may include at least a processor and a memory, wherein the memory stores a program code, and when the program code is executed by the processor, the processor executes any step of the task query method in various exemplary embodiments of the present application.

[0166] Refer to the following Figure 7 The task query computing device 700 according to this embodiment of the present application is described as follows. Figure 7 The task query computing device 700 is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0167] like Figure 7 As shown, the components of the computing device 700 may include but are not limited to: the at least one processor 701 mentioned above, the at least one memory 702 mentioned above, and a bus 703 connecting different system components (including the memory 702 and the processor 701).

[0168] Bus 703 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, a processor, or a local bus using any of a variety of bus architectures.

[0169] The memory 702 may include a readable medium in the form of a volatile memory, such as a random access memory (RAM) 7021 and / or a cache memory 7022 , and may further include a read-only memory (ROM) 7023 .

[0170] Memory 702 may also include a program / utility 7025 having a set (at least one) of program modules 7024, such program modules 7024 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment.

[0171] The computing device 700 may also communicate with one or more external devices 704 (e.g., keyboards, pointing devices, etc.), one or more devices that enable a user to interact with the computing device 700, and / or any device that enables the computing device 700 to communicate with one or more other computing devices (e.g., routers, modems, etc.). Such communication may be performed via input / output (I / O) interface 705. Furthermore, the computing device 700 may also communicate with one or more networks (e.g., local area networks (LANs), wide area networks (WANs), and / or public networks, such as the Internet) via network adapter 706. Figure 7 As shown, network adapter 706 communicates with other modules for computing device 700 via bus 703. Figure 7 Not shown, other hardware and / or software modules may be used in conjunction with computing device 700, including but not limited to microcode, device drivers, redundant processors, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.

[0172] In some possible implementations, various aspects of the task query method provided by the present application may also be implemented in the form of a program product, which includes program code. When the program product is run on a computer device, the program code is used to enable the computer device to execute the steps of the task query method according to various exemplary implementations of the present application described above in this specification.

[0173] The program product may use any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of readable storage media (a non-exhaustive list) include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.

[0174] The program product for controlling the sending of short messages according to the embodiment of the present application may be in the form of a portable compact disk read-only memory (CD-ROM) and include program codes, and may be run on a computing device.

[0175] The readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, wherein the readable program code is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The readable signal medium may also be any readable medium other than a readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with a command execution system, apparatus, or device.

[0176] The program code embodied on the readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination of the foregoing.

[0177] The program code for performing the operations of the present application can be written in any combination of one or more programming languages, including object-oriented programming languages ​​such as Java, C++, etc., and conventional procedural programming languages ​​such as "C" language or similar programming languages.

[0178] It should be noted that, although several units or subunits of the device are mentioned in the above detailed description, this division is merely exemplary and not mandatory. In fact, according to the embodiments of the present application, the features and functions of two or more units described above can be embodied in one unit. Conversely, the features and functions of one unit described above can be further divided into multiple units to be embodied.

[0179] In addition, although the operations of the method of the present application are described in a specific order in the drawings, this does not require or imply that the operations must be performed in this specific order, or that all the operations shown must be performed to achieve the desired results. Additionally or alternatively, some steps may be omitted, multiple steps may be combined into one step, and / or one step may be decomposed into multiple steps.

[0180] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.

Claims

1. A task query method, characterized in that: The method includes: After receiving the task identifier returned by the task execution system, searching the historical records for historical task execution information corresponding to other tasks of the same type as the target task corresponding to the task identifier; Determine, according to the historical task execution information, a target query time set for sending a task query request to the task execution system, wherein the target query time set includes at least one target query time; Whenever a target query time in the target query time set is reached, a task query request is sent to the task execution system to query whether the target task is completed; Upon receiving a target task completion notification returned by the task execution system, determining that the target task is completed; Wherein, determining a target query time set for sending a task query request to the task execution system according to the historical task execution information includes: If the target task is a task unrelated to user data, determining at least one target query time in the target query time set according to the average execution time determined by the historical task execution information and a preset query number; or If the target task is a task related to user data, the first target query time in the target query time set is determined according to the minimum historical task execution time in the historical task execution information, and based on the first target query time, at least one other target query time in the target query time set is determined in a time-increasing manner.

2. The method according to claim 1, characterized in that After receiving the task identifier returned by the task execution system, searching the historical records for historical task execution information corresponding to other tasks of the same type as the target task corresponding to the task identifier, further comprising: If the historical records do not record the historical task execution information corresponding to other tasks of the same type as the target task, a task query request is periodically sent to the task execution system from the time when the task identification is received to query whether the target task is completed.

3. The method according to claim 1, characterized in that After determining that the target task is completed, the method further includes: The interval between the last target query time that arrived before receiving the target task end notification and the time when the task identifier was received is used as the historical task execution time of the target task; The historical task execution information determined according to the historical task execution duration is stored in the historical record.

4. A task query device, characterized in that: The device includes: A search unit, configured to search the historical records for historical task execution information corresponding to other tasks of the same type as the target task corresponding to the task identifier after receiving the task identifier returned by the task execution system; A first determining unit, configured to determine a target query time set for sending a task query request to the task execution system according to the historical task execution information, wherein the target query time set includes at least one target query time; A sending unit, configured to send a task query request to the task execution system at each target query time in the target query time set, so as to query whether the target task is completed; A second determining unit is used to determine that the target task is finished when receiving a target task finish notification returned by the task execution system; Wherein, the first determining unit is specifically used for: If the target task is a task unrelated to user data, determining at least one target query time in the target query time set according to the average execution time determined by the historical task execution information and a preset query number; or If the target task is a task related to user data, the first target query time in the target query time set is determined according to the minimum historical task execution time in the historical task execution information, and based on the first target query time, at least one other target query time in the target query time set is determined in a time-increasing manner.

5. The device according to claim 4, characterized in that The search unit is also used for: If the historical records do not record the historical task execution information corresponding to other tasks of the same type as the target task, the sending unit periodically sends a task query request to the task execution system from the time the task identification is received to inquire whether the target task is completed.

6. A task query device, characterized in that: The device comprises: a memory and a processor, wherein the memory is used to store computer instructions; and the processor is used to execute the computer instructions to implement any one of the methods described in claims 1 to 3.

7. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and when the computer instructions are executed by a processor, the method according to any one of claims 1 to 3 is implemented.