A state detection method and device for a graph database task

By using gradient detection and time interval adjustment methods in graph database tasks, the problem of excessive computational resource consumption is solved, achieving the effect of fast task completion detection and resource saving.

CN120743887BActive Publication Date: 2025-12-30ALIPAY (HANGZHOU) INFORMATION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511240229.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-09-01
Publication Date
2025-12-30
Estimated Expiration
2045-09-01

AI Technical Summary

Technical Problem

Existing technologies consume excessive computing resources when detecting the running status of graph database tasks, making it difficult to reduce resource consumption while quickly detecting task completion.

Method used

By creating detection gradients in graph database tasks and using gradually increasing time intervals and corresponding detection counts, task status information is periodically detected. The detection frequency is adjusted according to the task type to reduce the consumption of computing resources.

Benefits of technology

It enables rapid detection of task completion while reducing computational resource consumption when checking the status of graph database tasks, thus adapting to the needs of different task durations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120743887B_ABST
    Figure CN120743887B_ABST
Patent Text Reader

Abstract

Embodiments of the present specification provide a state detection method and device for a graph database task. Before running a first task, a first detection task is created. The running logic of the first detection task contains a detection gradient, which contains a plurality of time intervals arranged in sequence and gradually increasing and corresponding detection times. The first detection task is run when the first task is run. Running the first task includes communicating with a plurality of node devices in a graph cluster to cause them to execute the processing indicated by the first task for the graph database therein. Running the first detection task includes periodically detecting state information of the first task in the current time interval in the detection gradient, and updating the state information based on the detected state information; if the first task has not ended after detecting the corresponding number of times, periodically detecting the state information in the next time interval. The state information belongs to private data, and privacy protection is required when processing it.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] One or more embodiments of the present specification relate to the technical field of graph database, and in particular to a state detection method and device for a graph database task. BACKGROUND

[0002] In the field of computers, a database is a system for storing, managing, and retrieving data. Databases can be divided into relational databases and non-relational databases. A graph database is a non-relational database that can be used to store unstructured data. A graph database stores and queries graph data in a graph structure, and the graph data is stored in the form of nodes and edges, where a node represents a data entity and an edge represents the relationship between entities. The data stored in the graph database is also referred to as graph data. When private data is stored in the graph data, the management and retrieval of the graph database need to protect the private data.

[0003] A graph platform is a short name for a graph operation platform, which is used to manage a graph database. A graph platform usually manages multiple graph clusters, and a graph cluster contains multiple node devices. The graph databases of multiple node devices store multiple graph data. A user can execute a graph database task through the graph platform, and the running time of different graph database tasks varies. In actual applications, the running process of a graph database task needs to be detected to quickly know that the task execution is complete.

[0004] At present, it is hoped that an improved scheme can reduce the occupied computing resources as much as possible when detecting the running process of a graph database task. SUMMARY

[0005] One or more embodiments of the present specification describe a state detection method and device for a graph database task to reduce the occupied computing resources as much as possible when detecting the running state of a graph database task. The specific technical solutions are as follows.

[0006] In a first aspect, an embodiment provides a state detection method for a graph database task, wherein the graph database is located in a plurality of node devices of a graph cluster; the method comprises:

[0007] Before running a first task for the graph database, a first detection task for the first task is created; wherein the running logic of the first detection task contains a detection gradient, and the detection gradient contains a plurality of time intervals arranged in sequence and gradually increasing and their corresponding detection times;

[0008] The first detection task is run when the first task is run;

[0009] The running of the first task specifically comprises: communicating with a plurality of node devices in the graph cluster, so that the plurality of node devices perform the processing indicated by the first task on the graph database therein; and the running of the first task further comprises: storing state information of the first task.

[0010] The running of the first detection task specifically comprises: periodically detecting the state information in a current time interval in the detection gradient, updating the state information of the first task based on the detected state information, and storing the updated state information; and after detecting for a corresponding number of times, periodically detecting the state information in a next time interval if the first task has not ended.

[0011] In an implementation manner, the step of creating the detection task for the first task comprises:

[0012] A default detection gradient is set in the running logic of the first detection task.

[0013] In an implementation manner, the step of creating the first detection task for the first task comprises:

[0014] A detection gradient corresponding to a first task type to which the first task belongs is determined from a preset correspondence between a plurality of task types and detection gradients;

[0015] The determined detection gradient is set in the running logic of the first detection task.

[0016] In an implementation manner, the method is executed by a graph platform, and the graph platform comprises a plurality of node devices; and the step of running the first detection task when the first task is running comprises:

[0017] The first task and the first detection task are respectively run in different node devices of the graph platform.

[0018] In an implementation manner, the graph platform further comprises a database for storing state information of the first task; and the step of storing the state information of the first task comprises: writing the state information of the first task into the database; and the step of detecting the state information of the first task comprises: reading the state information of the first task from the database.

[0019] In an implementation manner, the state information comprises heartbeat data of the first task; and the step of updating the state information of the first task based on the detected state information comprises: when a time stamp of the detected heartbeat data is greater than a preset time interval from a current time, determining that the first task has been in an ending state.

[0020] In an implementation manner, the state information comprises task progress information of the first task. The step of updating the state information of the first task based on the detected state information comprises:

[0021] When the task progress information indicates that the task is completed, the task result of the first task is verified according to preset verification logic, and the task progress information is updated based on the verification result.

[0022] In an implementation manner, the step of verifying the task result of the first task according to preset verification logic comprises: communicating with a plurality of node devices in the graph cluster according to preset verification logic to verify the task result of the first task.

[0023] In an implementation manner, the method further comprises: when it is determined that the state of the first task is an end state by running the first detection task, ending the running of the first detection task.

[0024] In a second aspect, embodiments provide a state detection apparatus for a graph database task, the graph database being located in a plurality of node devices of a graph cluster; the apparatus comprises:

[0025] A task creation module configured to create a first detection task for a first task before running the first task for a graph database; wherein the running logic of the first detection task comprises a detection gradient, and the detection gradient comprises a plurality of time intervals arranged in sequence and gradually increasing and corresponding detection times;

[0026] A task running module configured to run the first detection task when the first task is running;

[0027] Wherein, running the first task specifically comprises: communicating with a plurality of node devices in the graph cluster to enable the plurality of node devices to execute the processing indicated by the first task for the graph database therein; running the first task further comprises: storing the state information of the first task;

[0028] Running the first detection task specifically comprises: periodically detecting the state information with a current time interval in the detection gradient, updating the state information of the first task based on the detected state information, and storing the updated state information; when the corresponding number of times is detected, if the first task is not ended, the state information is periodically detected with the next time interval.

[0029] In a third aspect, embodiments provide a computer readable storage medium having a computer program stored thereon, which, when executed in a computer, causes the computer to perform the method of any one of the first aspect.

[0030] In a fourth aspect, an embodiment provides a computing device, comprising a memory and a processor, wherein the memory stores executable code, and the processor executes the executable code to implement the method in any one of the first aspect.

[0031] In the method and device provided by the embodiments of the present disclosure, the first detection task for the first task is run when the first task is running. By running the first detection task, the state information of the first task is periodically detected according to a plurality of time intervals arranged in sequence and gradually increasing as detection periods, and the state information of the first task is updated based on the detected state information of the first task. When the running time of the first task is very short and ends, the first detection task can detect the state in a short time with a high frequency; when the first task ends after running for a long time, the detection gradient of the first detection task can increase the time interval of detection after detecting for a period of time, thereby reducing the detection frequency and reducing the excessive occupation of computing resources. BRIEF DESCRIPTION OF DRAWINGS

[0032] In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the following will briefly introduce the drawings needed to be used in the embodiment description. Obviously, the drawings in the following description are only some embodiments of the present disclosure, and for those skilled in the art, other drawings can also be obtained from these drawings without creative labor.

[0033] Figure 1 The schematic diagram of the implementation scenario of an embodiment disclosed in the present disclosure;

[0034] Figure 2 The flowchart of a state detection method for a graph database task provided by an embodiment;

[0035] Figure 3 The contrast schematic diagram of a running process of the first detection task and the first task provided by an embodiment;

[0036] Figure 4 The principle schematic diagram of a state detection method provided by an embodiment;

[0037] Figure 5 The schematic block diagram of a state detection device for a graph database task provided by an embodiment. DETAILED DESCRIPTION

[0038] The schemes provided by the present disclosure will be described below with reference to the drawings.

[0039] Figure 1An implementation scenario of an embodiment disclosed in the present application is shown in the figure. It includes a graph platform and several graph clusters managed by the graph platform. The graph platform includes several node devices and a database for storing state information of tasks. Any graph cluster includes several node devices, and a graph database in each node device is used to store graph data. Multiple node devices start a graph engine service to form a graph cluster, and multiple graph data can be stored in the graph cluster. In order to achieve high availability of graph data, a piece of graph data is usually divided into multiple parts and stored in multiple node devices of the graph cluster.

[0040] The database in the graph platform is not a graph database, but a relational database. The graph software is deployed in the multiple node devices in the graph platform, and the graph platform can control and manage the multiple node devices through the graph software. The graph platform initiates a graph database task for the graph database in the graph cluster through the graph software.

[0041] The graph database task is a task performed on the graph database, including version upgrade, point and edge statistics of graph data, point and edge schema change, graph data compaction, and graph cluster creation.

[0042] The above Figure 1 is only one implementation scenario. In actual applications, the present application can also be applied in other implementation scenarios, for example, the graph platform can be implemented through one node device, and the database can be located outside the graph platform.

[0043] When the graph platform runs the graph database task, the running time of different types of tasks is long or short, and the time consumed by the same type of task for different graph data is also long or short. For example, the data volume of some graph data is large, and the data import and export action is frequent when performing the point and edge schema change task, so the task execution time is long. The execution time of the version upgrade task is generally short.

[0044] In order to know the task execution completion more quickly, a periodic detection of task state information can be used. However, in this way, if the time interval of periodic detection is set to be short, frequent task state detection will occupy more system resources. If the time interval of periodic detection is set to be long, for some tasks with short execution time, the task execution completion cannot be found in time.

[0045] In order to quickly determine the task state and reduce the excessive occupation of system resources caused by frequent detection of the task state, an embodiment of the present application provides a state detection method for a graph database task. The method can be applied in the scenario shown in Figure 1 but is not limited to the scenario shown in Figure 2The embodiment is described in detail.

[0046] Figure 2 A flowchart of a state detection method for a graph database task is provided for the embodiment. The method is executed by a graph platform. The node devices in the graph platform and the node devices in the graph cluster can be implemented by any device, equipment, platform, equipment cluster, etc. with computing and processing capabilities. A node device can be a container (Pod) or a physical machine, etc. The method includes the following steps.

[0047] In step S210, a first detection task d-task1 for a first task task1 is created before the first task task1 is run for the graph database.

[0048] The first task task1 and the first detection task d-task1 are both a piece of program containing running logic, used to implement their respective tasks and functions. The first task task1 is any database task. For example, when the first task task1 is a graph database version upgrade task, the first task task1 contains the running logic required to implement the graph database version upgrade operation. When the graph platform manages multiple graph clusters, the running logic of the first task task1 contains communication interaction logic with the corresponding graph cluster, and logic for instructing a number of node devices in the graph cluster to perform corresponding processing on the graph database therein.

[0049] The first detection task d-task1 is used to detect the first task task1, specifically to detect the state information thereof. The running logic of the first detection task d-task1 contains a detection gradient, which contains a number of time intervals arranged in sequence and gradually increasing, and their corresponding detection times.

[0050] The detection gradient is illustrated below. For example, the default detection gradient can include time intervals of 5s, 60s, and 120s, and corresponding detection times of k1 times, k2 times, and unlimited times. That is, the first detection task d-task1 first detects at a period of 5s, a total of k1 times, then detects at a period of 60s, a total of k2 times, and then detects at a period of 120s, a total of unlimited times. Among them, the time intervals of 5s, 60s, and 120s are also called gradient values, and k1 times, k2 times, and unlimited times are called detection times. The detection gradient contains multiple gradient values arranged in sequence and gradually increasing.

[0051] In creating the first detection task d-task1, a default detection gradient can be set in the running logic for the first detection task d-task1. The default detection gradient can also be modified according to different task types, that is, the corresponding detection gradient can be customized for different task types. Whether the default detection gradient is modified or the corresponding detection gradient is customized, the gradient quantity, gradient value and corresponding detection times in the detection gradient are set. The priority of the customized detection gradient is higher than that of the default detection gradient.

[0052] In order to improve the efficiency during execution, a plurality of task types and corresponding detection gradients can also be pre-set and stored. When the first detection task d-task1 needs to be created, the detection gradient corresponding to the first task type to which the first task task1 belongs can be determined from the plurality of stored task types and corresponding detection gradients.

[0053] The task type can include a version upgrade type, a point-edge statistics type, a graph cluster creation type, a point-edge model change type and a graph data merging type, etc. The first task type can be any one of the plurality of task types.

[0054] After the detection gradient is determined, the detection gradient can be set in the running logic of the first detection task d-task1. Specifically, the running logic of the first detection task d-task1 can be generated based on the detection gradient. The running logic can also include a verification logic for verifying the running result of the task.

[0055] For example, when the first task task1 is a graph database version upgrade task, for example, the target version is 2.0 version, the verification logic can be used to verify whether the graph database version in the corresponding node device has become the target version 2.0 when it is confirmed that the first task task1 is completed. The target version 2.0 can be pre-set in the verification logic.

[0056] When the first task task1 is a graph cluster creation task, the verification logic can be used to verify whether the corresponding plurality of node devices have created a graph cluster, that is, whether the corresponding files have been installed, when it is confirmed that the first task task1 is completed. The addresses of the newly created plurality of node devices can be obtained from the state information of the first task task1.

[0057] In step S220, the first detection task d-task1 is run when the first task task1 is run. This step can be understood as running the first task task1 and the first detection task d-task1 at the same time.

[0058] The running of the first detection task d-task1 specifically includes periodically detecting state information of the first task task1 in a current time interval in the detection gradient, updating the state information of the first task task1 based on the detected state information, and storing the updated state information. When the corresponding number of times of detection is reached and the first task task1 has not ended, the state information of the first task task1 is periodically detected in the next time interval; when the corresponding number of times of detection is reached and it is determined that the state of the first task task1 is an end state, the running of the first detection task d-task1 ends. That is, when the first task task1 is hung, the running of the first detection task d-task1 also ends.

[0059] During the running of the first detection task d-task1, the time interval of periodic detection is gradually changed according to the detection gradient, so that the detection frequency is gradually reduced.

[0060] During the running of the first task task1, the first task task1 can store state information of the first task task1, for example, the state information can be written into a database of the graph platform. The database is used to store the state information of the first task task1. When the state information is detected, it can be read from the database. In this way, no matter where the first task task1 is specifically routed to the node device contained in the graph platform, the task state seen by the user through the graph platform is consistent, and the task state comes from the database.

[0061] The above state information includes heartbeat data of the first task task1, and the first task task1 can report its heartbeat data to the database at a fixed time interval.

[0062] The first detection task d-task1 can detect the heartbeat data of the first task task1 in the database, and can determine, according to the recorded heartbeat data, that the first task task1 is still in a running state or that the heartbeat data has timed out. When the heartbeat data times out, it is considered that the first task task1 has ended (i.e., hung). When the time stamp of the detected heartbeat data is not more than a preset time interval from the current time, it is considered that the first task is in an unended state and is still running. When the time stamp of the detected heartbeat data is greater than the preset time interval from the current time, it is determined that the first task task1 has entered an end state. At this time, the end state of the first task task1 can be written in the database. The preset time interval can be determined according to the time interval of the heartbeat data of the first task task1. In order to make the state detection more accurate, the preset time interval may, for example, be the time interval of the heartbeat data of the first task task1 plus a certain time length.

[0063] Figure 3 The first detection task provided for the embodiment is compared with a schematic diagram of a running process of the first task. In the first detection task d-task1, the detection gradient includes time intervals of 5s, 60s and 120s, and the detection times are k1, k2 and unlimited times, respectively. The first detection task d-task1 and the first task start running at 0 time on the time axis. When the first task is detected according to the gradient value and the detection times in the detection gradient, the task detection times are 5s, 10s, 70s, 130s, 250s and 370s, etc., and the time intervals in the detection gradient corresponding to these task detection times are 5s, 5s, 60s, 60s, 120s and 120s, respectively, as shown in the left part of FIG. 1. Figure 3 The middle red dashed box in FIG. 1 shows the situation when the first task task1 is hung up at different lengths (8s, 85s and 350s).

[0064] Figure 3 The middle of FIG. 1 also shows the situation when the first task task1 is hung up at different lengths (8s, 85s and 350s). When the first task task1 is hung up at the 8s, the first detection task d-task1 can detect the end state of the first task task1 in the task detection at the 10s, with a detection state lag of 2s. When the first task task1 is hung up at the 85s, the first detection task d-task1 can detect the end state of the first task task1 in the task detection at the 130s, with a detection state lag of 45s. When the first task task1 is hung up at the 350s, the first detection task d-task1 can detect the end state of the first task task1 in the task detection at the 370s, with a detection state lag of 20s. See Table 1 for details.

[0065] Table 1

[0066]

[0067] In this example, the total lag time = 2s + 45s + 20s = 67s, and the total detection times of the first detection task d-task1 are 7 times.

[0068] Suppose that the detection is not performed according to the detection gradient, but is performed periodically according to a fixed time interval, for example, periodically performed with a time interval of 60s, and the task detection time is 60s, 120s, 180s, 240s, 300s and 360s, etc. When the first task task1 is hung up at the 8th second, the detection task detects the end state of the first task task1 in the task detection at the 60th second, and the detection state lags behind by 52s. When the first task task1 is hung up at the 85th second, the detection task detects the end state of the first task task1 in the task detection at the 120th second, and the detection state lags behind by 35s. When the first task task1 is hung up at the 350th second, the detection task can detect the end state of the first task task1 in the task detection at the 360th second, and the detection state lags behind by 10s. See Table 2 for details.

[0069] Table 2

[0070]

[0071] In this example, the total lag time = 52s + 35s + 10s = 97s, and the total detection number of the detection task is 6 times.

[0072] It can be seen that in the two examples, the total detection number of the detection task (6 times and 7 times) is comparable, but the total lag time of the fixed period detection 97s is significantly greater than the total lag time of the gradient period detection 67s. If the time interval of the fixed period detection is reduced, the total detection number will increase significantly.

[0073] In addition, for a task with a very short running time, the gradient detection can more timely detect the hung-up state of the task. For a task with a very long running time, the gradient detection can reduce the total detection number and save system computing resources.

[0074] The foregoing mentions that the corresponding detection gradient can be determined according to the task type, and the first detection task d-task1 is created based on the determined detection gradient. According to the task type, the range of the running time of the task can be roughly determined, so that a more reasonable detection gradient for the task type is determined. However, different tasks of the same task type also have different running times, and the running time is uncertain. For example, for point-edge statistical tasks, the time consumed by point-edge statistics performed on different sizes of graph clusters is also different. That is, whether it is different tasks of the same type or different tasks of different types, the running time is uncertain. Therefore, the detection performed by the detection gradient on any first task task1 can take into account both short-time tasks and long-time tasks.

[0075] The specific running logic of the first task task1 and the first detection task d-task1 will be further described below in combination with specific examples. In an implementation scenario of the graph platform and the graph cluster thereof, the first task task1 and the first detection task d-task1 can be run in the graph platform. Specifically, running the first task task1 includes communicating with a plurality of node devices in the graph cluster, so that the plurality of node devices perform the processing indicated by the first task task1 for the graph database in the plurality of node devices.

[0076] The first task task1 is taken as an example of a point-edge statistics task. The running logic in the first task task1 includes sending a point-edge statistics instruction to a plurality of node devices in the graph cluster to be counted, and receiving the statistics results fed back by the plurality of node devices. The plurality of node devices perform corresponding processing according to the point-edge statistics instruction, and send the statistics results to the first task task1 respectively.

[0077] The state information reported by the first task task1 to the database during running can further include task progress information, which is used in the verification process of the first task task1. The running logic in the first detection task d-task1 further includes preset verification logic. During running of the first detection task d-task1, when it is determined that the task progress information indicates that the task has been completed, the task result of the first task task1 is verified according to the verification logic, and the task progress information is updated based on the verification result, that is, the verification result can be written into the database as the task progress information.

[0078] The first detection task d-task1 can communicate with a plurality of node devices in the graph cluster according to the verification logic during running, to verify the task result of the first task task1, and can write the verification result into the database.

[0079] For example, when the first task is a version upgrade task, the task progress information can include information of successful upgrade. The first detection task d-task1 can send a version verification request to the node devices in the corresponding graph cluster during running, and determine whether the upgrade is successful based on the feedback data of the node devices.

[0080] When the first task is a task of creating a graph cluster, when the first task task1 completes the creation of the graph cluster, the addresses of the node devices in the newly created graph cluster can be reported to the database. That is, the task progress information includes the address information of the newly created graph cluster. The first detection task d-task1 can read the address information in the task progress information from the database during running, send a verification request to the node devices in the corresponding graph cluster based on the address information, determine whether the graph cluster is successfully created based on the feedback data of the node devices, and write the result of successful or unsuccessful creation into the database.

[0081] In order to realize high availability of task detection, the first task task1 and the first detection task d-task1 can be respectively run in different node devices of the graph platform. In this way, when the node device running the first task task1 hangs up, the first detection task d-task1 can still run normally, so that it can be determined that the first task task1 hangs up according to the heartbeat data timeout of the first task task1 in the database.

[0082] In actual application, the first task task1 and the first detection task d-task1 can be realized by corresponding threads. Figure 4 A schematic diagram of the principle of a state detection method provided for an embodiment. In the graph platform, the following definitions are made: define the task type of the graph database, define the detection gradient: the longest 120s, the gradient is 3, i.e. 5s, 60s and 120s, and the detection times are 2, 4 and unlimited times respectively. The task type of the graph database includes the task type of creating a graph cluster and the task type of changing a point-edge model, etc. When the graph platform initiates a database task, the graph platform initiates a corresponding running task thread, i.e. an executor thread, in a certain node device, and simultaneously starts a watcher thread in another node device of the graph platform to detect the running of the executor thread. The watcher thread and the executor thread for the task of creating a graph cluster are respectively run in the left two node devices, and the watcher thread and the executor thread for the task of changing a point-edge model are respectively run in the right two node devices. The detection gradient and the corresponding times of the two watcher threads are the same.

[0083] The watcher thread detects the running of the executor thread every 5s for the first two times after the watcher thread is run, and if the task ends, the task state is updated and the watcher thread ends. In this example, the task of changing a point-edge model ends in the process of the watcher thread detecting once every 5s, and the state of the executor thread can be updated in time.

[0084] If the executor thread is running in the first two detection times of the watcher thread, the detection task is started again for 2 times, and the task state is detected every 60s. If the task ends, the task state is updated and the watcher thread ends.

[0085] If the executor thread is running in all 4 detections of the watcher thread, the watcher thread detects the task status every 120s. Until the task ends, the task status is updated, and the watcher thread ends. In this example, the create graph cluster task ends in the process of the watcher thread detecting every 120s, and the state of the executor thread can be updated without detecting many times. The create graph cluster task can also be referred to as a create graph database cluster task.

[0086] The executor thread writes its task process information and heartbeat data to the database, and the watcher thread writes the updated task status to the database. The executor thread communicates with the node devices in the graph cluster to complete the execution of the database task. The watcher thread communicates with the node devices in the graph cluster to verify the task status.

[0087] In this specification, the "first" in the words of the first task, the first detection task, and the like, and the corresponding "second" (if any) in the text, are only for the convenience of distinguishing and describing, and do not have any limiting meaning.

[0088] The above describes specific embodiments of the present specification, and other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims can be performed in an order different from that in the embodiments, and the desired results can still be achieved. In addition, the processes depicted in the accompanying drawings do not necessarily have to be implemented in the specific order or continuous order shown to achieve the desired results. In some embodiments, multi-task processing and parallel processing are possible or can be advantageous.

[0089] Figure 5 A schematic block diagram of a state detection device for a graph database task is provided for an embodiment. The graph database is located in a plurality of node devices of a graph cluster. The device embodiment corresponds to the method embodiment shown. Figure 2 The device 500 is deployed in a graph platform, including:

[0090] The task creation module 510 is configured to create a first detection task for a first task before running the first task for the graph database; wherein the running logic of the first detection task contains a detection gradient, and the detection gradient contains a plurality of time intervals arranged in sequence and gradually increasing and their corresponding detection times;

[0091] The task running module 520 is configured to run the first detection task when running the first task;

[0092] The running of the first task specifically includes: communicating with a plurality of node devices in the graph cluster, so that the plurality of node devices perform the processing indicated by the first task for the graph database therein. The running of the first task also includes: storing the state information of the first task. The running of the first detection task specifically includes: periodically detecting the state information of the first task in a current time interval in a detection gradient, and updating the state information of the first task based on the detected state information of the first task; after detecting for a corresponding number of times, if the first task has not ended, periodically detecting the state information of the first task in a next time interval.

[0093] In an implementation manner, the task running module 520 includes a detection submodule 521, an updating submodule 522, and a storage submodule 523. The detection submodule 521 is specifically configured to periodically detect the state information of the first task in a current time interval in a detection gradient, and periodically detect the state information of the first task in a next time interval after detecting for a corresponding number of times if the first task has not ended. The updating submodule 522 is specifically configured to update the state information of the first task based on the detected state information of the first task, and store the updated state information. The storage submodule 523 is specifically configured to store the state information of the first task in the process of running the first task.

[0094] In an implementation manner, the task creating module 510 is specifically configured to set a default detection gradient in the running logic for the first detection task.

[0095] In an implementation manner, the task creating module 510 is specifically configured to determine a detection gradient corresponding to a first task type to which the first task belongs from a preset corresponding relationship between a plurality of task types and detection gradients, and set the determined detection gradient in the running logic for the first detection task.

[0096] In an implementation manner, the apparatus 500 is executed by a graph platform, and the graph platform includes a plurality of node devices. The task running module 520 is specifically configured to run the first task and the first detection task in different node devices of the graph platform, respectively.

[0097] In an implementation manner, the graph platform further includes a database for storing the state information of the first task. The storage submodule 523 is specifically configured to write the state information of the first task into the database. In this embodiment, when the task running module 520 detects the state information of the first task, it specifically includes: reading the state information of the first task from the database.

[0098] In an implementation manner, the state information comprises heartbeat data of the first task. The updating submodule 522 is specifically configured to determine that the first task has been in the end state when a time stamp of the detected heartbeat data is greater than a preset time interval from a current time.

[0099] In an implementation manner, the state information comprises task progress information of the first task. The updating submodule 522 is specifically configured to verify the task result of the first task according to a preset verification logic when the task progress information indicates that the task has been completed, and update the task progress information based on a verification result.

[0100] In an implementation manner, when verifying the task result of the first task according to the preset verification logic, the updating submodule 522 comprises: communicating with a plurality of node devices in the graph cluster according to the preset verification logic to verify the task result of the first task.

[0101] In an implementation manner, the apparatus 500 further comprises an ending running module 530 configured to end running the first detection task when it is determined that the state of the first task is the end state by running the first detection task.

[0102] The apparatus embodiments correspond to the method embodiments, and specific descriptions can be referred to the descriptions of the method embodiments, which will not be repeated here. The apparatus embodiments are based on the corresponding method embodiments and have the same technical effects as the corresponding method embodiments. Specific descriptions can be referred to the corresponding method embodiments.

[0103] The embodiments of the present specification also provide a computer readable storage medium having a computer program stored thereon, when the computer program is executed in a computer, the computer program causes the computer to execute Figures 1 to 4 The method of any one of the preceding method embodiments.

[0104] The embodiments of the present specification also provide a computing device comprising a memory and a processor, the memory has executable code stored therein, and the processor executes the executable code to implement Figures 1 to 4 The method of any one of the preceding method embodiments.

[0105] Each of the embodiments in the present specification is described in a progressive manner, and the same or similar parts of each embodiment can be referred to each other. Each embodiment focuses on the difference from other embodiments. In particular, the storage medium and the computing device embodiments are described more simply because they are basically similar to the method embodiments. The relevant parts can be referred to the part of the description of the method embodiments.

[0106] Those skilled in the art should be aware that, in the above one or more examples, the functions described in the embodiments of the present application can be implemented in hardware, software, firmware or any combination thereof. When implemented in software, the functions can be stored in a computer readable medium or transmitted as one or more instructions or codes on a computer readable medium.

[0107] The above description is merely a specific implementation of the present application. It should be understood that the above description is merely a specific implementation of the present application and is not intended to limit the protection scope of the present application. Any modification, equivalent replacement, improvement, etc. made on the basis of the technical solutions of the present application shall be included in the protection scope of the present application.

Claims

1. A state detection method for a graph database task, the graph database being located in a plurality of node devices of a graph cluster; the method comprising: creating a first detection task for a first task before running the first task for the graph database; wherein the running logic of the first detection task contains a detection gradient, the detection gradient containing a plurality of time intervals arranged in sequence and gradually increasing and their corresponding detection times; running the first detection task while running the first task; wherein running the first task specifically comprises communicating with the plurality of node devices in the graph cluster to cause the plurality of node devices to execute the processing indicated by the first task for the graph database therein; running the first task further comprises storing the state information of the first task; running the first detection task specifically comprises periodically detecting the state information with the current time interval in the detection gradient, determining new state information of the first task based on the detected state information, and storing the new state information; when the corresponding number of times is detected, if the first task has not ended, the state information is periodically detected with the next time interval. 2.The method of claim 1, wherein the step of creating a detection task for the first task comprises: setting a default detection gradient in the running logic of the first detection task.

3. The method of claim 1, the step of creating a first detection task for the first task comprising: determining the detection gradient corresponding to the first task type to which the first task belongs from the preset correspondence between a plurality of task types and detection gradients; setting the determined detection gradient in the running logic of the first detection task. 4.The method of claim 1, wherein the method is executed by a graph platform containing a plurality of node devices; and the step of running the first detection task while running the first task comprises: respectively running the first task and the first detection task in different node devices of the graph platform.

5. The method of claim 4, wherein the graph platform further comprises a database for storing the state information; and the storing the state information of the first task comprises: writing the state information of the first task into the database; the step of detecting the state information comprises reading the state information of the first task from the database. 6.The method of claim 1, wherein the state information comprises heartbeat data of the first task; the step of determining new state information of the first task based on the detected state information comprises: when the time stamp of the detected heartbeat data is greater than the preset time interval from the current time, determining that the first task has ended, and taking the end state as the new state information. 7.The method of claim 1, wherein the state information comprises task progress information of the first task; and the step of determining new state information of the first task based on the detected state information comprises: when the task progress information indicates that the task has been completed, verifying the task result of the first task according to a preset verification logic, and taking the verification result as the new task progress information. 8.The method of claim 7, wherein the step of verifying the task result of the first task according to the preset verification logic comprises: According to preset check logic, communicate with a plurality of node devices in the graph cluster to check the task result of the first task. 9.The method of claim 1, further comprising: when it is determined that the first task is in an end state by running the first detection task, ending running the first detection task. 10.A device for detecting a state of a graph database task, the graph database being located in a plurality of node devices of a graph cluster; the device comprising: a task creation module configured to create a first detection task for a first task before running the first task for a graph database; wherein a detection gradient is included in a running logic of the first detection task, the detection gradient including a plurality of time intervals arranged in sequence and gradually increasing and corresponding detection times; a task running module configured to run the first detection task when the first task is running; wherein running the first task specifically includes communicating with a plurality of node devices in the graph cluster to enable the plurality of node devices to execute processing indicated by the first task for a graph database therein; running the first task further includes storing state information of the first task; running the first detection task specifically includes periodically detecting the state information with a current time interval in the detection gradient, determining new state information of the first task based on the detected state information, and storing the new state information; when the first task has not ended after detecting for a corresponding number of times, periodically detecting the state information with a next time interval. 11.A computer readable storage medium having stored thereon a computer program, which, when executed in a computer, causes the computer to perform the method of any one of claims 1-9. 12.A computing device comprising a memory and a processor, the memory having stored therein executable code, the processor, when executing the executable code, implementing the method of any one of claims 1-9.

Citation Information

Patent Citations

  • Method, device and system for monitoring running of task threads of cluster

    CN106940671A

  • Method and device for executing data processing task

    CN113127158A