CN116599828A - Task execution method and device, storage medium and electronic equipment - Google Patents

Task execution method and device, storage medium and electronic equipment Download PDF

Info

Publication number
CN116599828A
CN116599828A CN202310702153.XA CN202310702153A CN116599828A CN 116599828 A CN116599828 A CN 116599828A CN 202310702153 A CN202310702153 A CN 202310702153A CN 116599828 A CN116599828 A CN 116599828A
Authority
CN
China
Prior art keywords
task
node device
node
communication connection
registry
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310702153.XA
Other languages
Chinese (zh)
Inventor
闫明阳
程鹏
陈中渊
张杭俊
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Industrial and Commercial Bank of China Ltd ICBC
Original Assignee
Industrial and Commercial Bank of China Ltd ICBC
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Industrial and Commercial Bank of China Ltd ICBC filed Critical Industrial and Commercial Bank of China Ltd ICBC
Priority to CN202310702153.XA priority Critical patent/CN116599828A/en
Publication of CN116599828A publication Critical patent/CN116599828A/en
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/06Management of faults, events, alarms or notifications
    • H04L41/0654Management of faults, events, alarms or notifications using network fault recovery
    • H04L41/0663Performing the actions predefined by failover planning, e.g. switching to standby network elements
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/08Configuration management of networks or network elements
    • H04L41/0803Configuration setting
    • H04L41/0823Configuration setting characterised by the purposes of a change of settings, e.g. optimising configuration for enhancing reliability
    • H04L41/0836Configuration setting characterised by the purposes of a change of settings, e.g. optimising configuration for enhancing reliability to enhance reliability, e.g. reduce downtime
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/08Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters
    • H04L43/0805Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters by checking availability
    • H04L43/0811Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters by checking availability by checking connectivity
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/10Active monitoring, e.g. heartbeat, ping or trace-route
    • H04L43/106Active monitoring, e.g. heartbeat, ping or trace-route using time related information in packets, e.g. by adding timestamps
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1001Protocols in which an application is distributed across nodes in the network for accessing one among a plurality of replicated servers
    • H04L67/1004Server selection for load balancing
    • H04L67/1014Server selection for load balancing based on the content of a request

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Environmental & Geological Engineering (AREA)
  • Health & Medical Sciences (AREA)
  • Cardiology (AREA)
  • General Health & Medical Sciences (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The application discloses a task execution method and device, a storage medium and electronic equipment, and relates to the field of cloud computing, wherein the method comprises the following steps: under the condition that the first node equipment is registered in a registry, acquiring a task list stored in the registry, wherein a task set registered in the registry is recorded in the task list; acquiring a first task state of a first task in a task set recorded in a task list; determining a communication connection state of a second node device, which is a device that has been registered in a registry, in a case where the first task state indicates that the first task is in a state in which it is being executed by the second node device; in the case where the communication connection state of the second node device indicates that the communication connection is not maintained between the second node device and the registry, the first task is switched from being performed by the second node device to being performed by the first node device. The application solves the problem of lower success rate of task execution in the related technology.

Description

Task execution method and device, storage medium and electronic equipment
Technical Field
The present application relates to the field of cloud computing, and in particular, to a task execution method and apparatus, a storage medium, and an electronic device.
Background
With the vigorous development of cloud computing technology, a host lower platform is selected for cost saving, rapid expansion and contraction, high availability, and many challenges are brought along therewith. On the one hand, sharing of resources on the cloud causes easier restarting of the nodes, and when the timed task system is migrated to the cloud for management, problems such as task execution interruption or task execution failure may be caused by abnormal restarting of the nodes. On the other hand, components introduced to implement the distributed scheduling function are high in economic cost and maintenance cost.
Aiming at the problem of low success rate of task execution in the related technology, no effective solution is proposed at present.
Disclosure of Invention
The application mainly aims to provide a task execution method and device, a storage medium and electronic equipment, so as to solve the problem of low success rate of task execution in the related technology.
In order to achieve the above object, according to one aspect of the present application, there is provided a task execution method. The method comprises the following steps: acquiring a task list stored on a registry under the condition that first node equipment is registered in the registry, wherein a task set registered in the registry is recorded in the task list; acquiring a first task state of a first task in the task set recorded in the task list; determining a communication connection state of a second node device, where the second node device is a device that has been registered in a registry, in a case where the first task state represents that the first task is in a state being executed by the second node device; and switching the first task to be executed by the second node device to be executed by the first node device when the communication connection state of the second node device indicates that the communication connection between the second node device and the registration center is not maintained.
Optionally, the determining the communication connection state of the second node device includes: acquiring target sending time of the second node equipment for sending heartbeat information to the registry; and determining the communication connection state of the second node equipment according to the target sending time.
Optionally, the determining, according to the target sending time, the communication connection state of the second node device includes: under the condition that a first sending time of the heartbeat information sent to the registration center by the second node equipment for the last time is obtained, determining whether the interval duration between the current time of the first sending time interval is greater than or equal to a preset duration, wherein the target sending time comprises the first sending time; and under the condition that the interval time length is greater than or equal to a first preset time length, determining the communication connection state of the second node equipment to be indicative that communication connection is not maintained between the second node equipment and the registration center.
Optionally, the determining, according to the target sending time, the communication connection state of the second node device includes: under the condition that N sending times of heartbeat information are obtained from the second node equipment for last N times and sent to the registration center, determining interval duration between two adjacent sending times in the N sending times to obtain N-1 interval duration, wherein the target sending time comprises the N-1 interval duration, and N is more than or equal to 3; and under the condition that the N-1 interval duration is greater than or equal to a second preset duration, determining the communication connection state of the second node equipment to be indicative that communication connection is not maintained between the second node equipment and the registry.
Optionally, the determining, according to the target sending time, the communication connection state of the second node device includes: under the condition that N sending times of heartbeat information are obtained from the second node equipment for last N times and sent to the registration center, determining interval duration between two adjacent sending times in the N sending times to obtain N-1 interval duration, wherein the target sending time comprises the N-1 interval duration, and N is more than or equal to 3; under the condition that the N-1 interval duration is greater than or equal to a second preset duration, determining the communication connection state of the second node equipment to be unstable in communication connection maintained between the second node equipment and the registry; the method further comprises the steps of: and switching the execution of part of sub-tasks in the first task by the second node device to the execution of the first node device under the condition that the communication connection state of the second node device indicates that the communication connection kept between the second node device and the registration center is unstable.
Optionally, the switching the first task performed by the second node device to the first node device is performed when the communication connection state of the second node device indicates that the communication connection between the second node device and the registry is not maintained, including: determining, in a case where a third node device and the first node device simultaneously request replacement of the second node device to execute the first task, the first task to be executed by the third node device or the first task to be executed by the first node device according to device information of the first node device and device information of the third node device, wherein the third node device is a device that has been registered in a registry, the device information of the first node device is used for indicating that resources in the first node device are allowed for executing the first task, and the device information of the third node device is used for indicating that resources in the third node device are allowed for executing the first task; and switching the execution of the first task by the second node device to the execution of the first task by the first node device under the condition that the first task is determined to be executed by the first node device.
Optionally, the determining, according to the device information of the first node device and the device information of the third node device, the first task to be performed by the third node device or the first task to be performed by the first node device includes: determining to execute the first task by the first node device in the case that more resources are allowed in the first node device to execute the first task than in the third node device; or if the difference between the resource allowed to execute the first task in the first node device and the resource allowed to execute the first task in the third node device is less than or equal to a preset threshold, randomly selecting one node device from the first node device and the third node device to execute the first task.
Optionally, the switching the first task performed by the second node device to the first task performed by the first node device includes: switching the first task from the second node device to the first node device; or, acquiring progress information of the first task executed by the second node device; and switching the execution of the first task by the second node equipment to the continuous execution of the first node equipment according to the progress information.
In order to achieve the above object, according to another aspect of the present application, there is provided a task performing device. The device comprises: the first acquisition module is used for acquiring a task list stored on a registry under the condition that first node equipment is registered in the registry, wherein a task set registered in the registry is recorded in the task list; the second acquisition module is used for acquiring a first task state of a first task in the task set recorded in the task list; a determining module configured to determine a communication connection state of a second node device in a case where the first task state indicates that the first task is in a state of being executed by the second node device, wherein the second node device is a device that has been registered in a registry; and the first switching module is used for switching the first task executed by the second node equipment to the first node equipment under the condition that the communication connection state of the second node equipment indicates that the communication connection between the second node equipment and the registration center is not maintained.
According to the application, the following steps are adopted: under the condition that the first node equipment is registered in a registry, acquiring a task list stored in the registry, wherein a task set registered in the registry is recorded in the task list; acquiring a first task state of a first task in a task set recorded in a task list; determining a communication connection state of a second node device, which is a device that has been registered in a registry, in a case where the first task state indicates that the first task is in a state in which it is being executed by the second node device; under the condition that the communication connection state of the second node equipment indicates that communication connection is not kept between the second node equipment and the registry, the first task is executed by the second node equipment and is executed by the first node equipment, namely whether communication connection is kept between the node equipment which is currently executing the task and the registry is determined, under the condition that communication connection is not kept between the node equipment which is currently executing the task and the registry, the condition that the node equipment which is currently executing the task possibly fails to execute the task can be indicated, under the condition that the node equipment which is executed the task is switched, the task is prevented from being executed by the node equipment which is kept in communication connection with the registry, the success rate of task execution is improved, and the problem that the success rate of task execution in the related art is lower is solved. Thereby achieving the effect of improving the success rate of task execution.
Drawings
The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this specification, illustrate embodiments of the application and together with the description serve to explain the application. In the drawings:
FIG. 1 is a schematic illustration of an application scenario of an alternative task execution method according to an embodiment of the present application;
FIG. 2 is a flow chart of a task execution method provided according to an embodiment of the present application;
FIG. 3 is a schematic diagram of determining a communication connection status of a node device according to an embodiment of the present application;
FIG. 4 is a schematic diagram of an alternative switching node device performing a portion of the sub-tasks in a first task in accordance with an embodiment of the application;
FIG. 5 is a schematic diagram of a node device and a registry according to an embodiment of the present application;
FIG. 6 is a schematic diagram of a method of task execution according to an embodiment of the present application;
FIG. 7 is a schematic diagram of a task performing device according to an embodiment of the present application;
fig. 8 is a schematic diagram of an electronic device according to an embodiment of the present application.
Detailed Description
It should be noted that, without conflict, the embodiments of the present application and features of the embodiments may be combined with each other. The application will be described in detail below with reference to the drawings in connection with embodiments.
In order that those skilled in the art will better understand the present application, a technical solution in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in which it is apparent that the described embodiments are only some embodiments of the present application, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the present application without making any inventive effort, shall fall within the scope of the present application.
It should be noted that the terms "first," "second," and the like in the description and the claims of the present application and the above figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate in order to describe the embodiments of the application herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
In order to better understand the application scenario of the task execution method in the embodiment of the present application, the following explanation and description of the application scenario of the task execution method in the embodiment of the present application may be, but are not limited to, applicable to the embodiment of the present application.
Fig. 1 is a schematic view of an application scenario of an alternative task execution method according to an embodiment of the present application, as shown in fig. 1, and may be, but not limited to, that a node device 1, a node device 2, and a node device 3 are already registered in a registry 102, and a registered task set may be, but not limited to, including a task 1, a task 2, and a task 3, where a task state of the task 1 is being executed by the node device 3, a task state of the task 2 is being executed by the node device 2, and a task state of the task 3 is being executed by the node device 3. The task execution method in the embodiment of the present application may be explained and illustrated by taking the node device 1 as a first node device and the node device 3 as a second node device as an example, but is not limited to. Task 1 may be switched to node device 1 for execution by, but is not limited to:
step S101, in the case where the node device 1 has been registered in the registry 102, acquiring a task list stored in the registry 102, wherein a task set registered in the registry 102 is recorded in the task list;
Step S102, acquiring a first task state of a task 1 in a task set recorded in a task list;
step S103 of determining a communication connection state of the node device 3 in a case where the first task state indicates that the task 1 is in a state being executed by the node device 3, wherein the node device 3 is a device that has been registered in the registry 102;
step S104 of switching execution of task 1 by node device 3 to execution by node device 1 in the case where the communication connection state of node device 3 indicates that communication connection is not maintained between node device 3 and registry 102.
Through the steps, whether communication connection is kept between the node equipment for executing the task and the registry is determined, and under the condition that communication connection is not kept between the node equipment for executing the task and the registry, the node equipment for executing the task can possibly fail to execute the task, and under the condition, the node equipment for executing the task is switched, so that the task execution through the node equipment for keeping the communication connection with the registry is avoided, the success rate of task execution is improved, and the problem of lower success rate of task execution in the related technology is solved. Thereby achieving the effect of improving the success rate of task execution.
The present application will be described with reference to preferred implementation steps, and fig. 2 is a flowchart of a task execution method according to an embodiment of the present application, and as shown in fig. 2, the method includes the following steps:
step S201, when a first node device is registered in a registry, acquiring a task list stored in the registry, wherein a task set registered in the registry is recorded in the task list;
step S202, a first task state of a first task in the task set recorded in the task list is obtained;
step S203 of determining a communication connection state of a second node device, which is a device that has been registered in a registry, in a case where the first task state indicates that the first task is in a state of being executed by the second node device;
step S204, when the communication connection state of the second node device indicates that the communication connection is not maintained between the second node device and the registry, performing a handover from the second node device to the first node device.
In the technical solution provided in the step S201, the registry may be, but is not limited to, registered with one or more node devices, and may be, but is not limited to, registered with the registry when the node device is started; and de-registering with the registration center under the condition that the node equipment is stopped.
Optionally, in the task execution method provided by the embodiment of the present application, the programs deployed in each node device may be the same or different, and the tasks allowed to be executed by each node device may be the same or different, for example: node devices deployed with the same program may be, but are not limited to, allowed to perform the same task, and node devices deployed with different programs may be, but are not limited to, allowed to perform different tasks.
Optionally, in the task execution method provided by the embodiment of the present application, one or more tasks registered in the registry are recorded in a task list stored in the registry, where the tasks may include, but are not limited to, tasks that are executed regularly, tasks that are irrelevant to manual interaction, and the like, such as: reconciliation tasks in cloud computing, report generation tasks, payroll tasks, and so forth.
In the technical solution provided in step S202, the task list may, but is not limited to, record each task registered in the registry and the task state of each task, where the task state of the task in the task set may be that the task has been executed by the node device and is completed, is being executed by the node device or is waiting to be executed by the node device, and the task state may be that the task that has been executed by the node device and is completed may be that the execution is successful, may also be that the execution is failed, and the task state may, but is not limited to, include that the task has not been executed by the node device at present.
Optionally, in the task execution method provided by the embodiment of the present application, in a case that a task state of a task in the task set is completed by execution of the node device or is being executed by the node device, a task list may also, but is not limited to, a node device that records execution of the task, for example: the name, code number, ID (Identity Document, identification number) of the node device, etc.
Optionally, in the task execution method provided by the embodiment of the application, each task in the task set in the task list can be traversed in turn, and the task states of each task in the task set in the task list are acquired one by one.
In the technical solution provided in step S203, in the case where the first task state indicates that the first task is in a state waiting for being executed by the node device, it may indicate that the first task is not currently executed by any node device, and in this case, the first task may be executed by the first node device, but not limited to, by this way, the task that the node device actively selects to execute is implemented, and efficiency of task allocation is improved.
Optionally, in the task execution method provided by the embodiment of the present application, the communication connection state of the second node device may, but is not limited to, include a communication connection state between the second node device and the registry, which is equivalent to whether the second node device and the registry maintain a communication connection. The communication connection state between the second node device and the registration center may indicate the probability that the first task is successfully executed by the second node device, and in this way, the possibility of determining whether the second node device currently executing the first task is capable of successfully executing the first task is achieved.
In one exemplary embodiment, the communication connection status of the second node device may be determined, but is not limited to, by: acquiring target sending time of the second node equipment for sending heartbeat information to the registry; and determining the communication connection state of the second node equipment according to the target sending time.
Optionally, in the task execution method provided by the embodiment of the present application, the node device registered in the registry may initiate heartbeat information to the registry (for example, every 1 minute, every 30 seconds, every 2 hours, etc., which is not limited by the present application), and determine whether the communication connection between the registry and the node device is maintained according to the reply condition of the registry. The preset interval duration may be, but is not limited to, determined according to timeliness of the task, such as: the preset interval duration of sending heartbeat information by the node equipment box registry and the like can be determined according to the execution period of the tasks which are executed regularly.
Optionally, in the task execution method provided by the embodiment of the present application, the registry may, but not limited to, record, in the registry, a transmission time of the heartbeat information transmitted by each node device when the heartbeat information transmitted by the node device is received, and in this case, may, but not limited to, determine a communication connection state between the node device and the registry by the transmission time of the heartbeat information.
Optionally, in the task execution method provided by the embodiment of the present application, a target receiving time when the registry receives heartbeat information sent by the second node device to the registry is obtained; and determining the communication connection state of the second node equipment according to the target receiving time.
In one exemplary embodiment, the communication connection status of the second node device may be determined from the target transmission time by, but not limited to: under the condition that a first sending time of the heartbeat information sent to the registration center by the second node equipment for the last time is obtained, determining whether the interval duration between the current time of the first sending time interval is greater than or equal to a preset duration, wherein the target sending time comprises the first sending time; and under the condition that the interval time length is greater than or equal to a first preset time length, determining the communication connection state of the second node equipment to be indicative that communication connection is not maintained between the second node equipment and the registration center.
Optionally, in the task execution method provided by the embodiment of the present application, the current time may, but is not limited to, include determining a time of a communication connection state of the second node device, and determining, when a time interval between current times of a first transmission time interval of the heartbeat information transmitted by the second node device to the registry last time is greater than or equal to a preset time length, the communication connection state of the second node device as indicating that no communication connection is maintained between the second node device and the registry. In this way, as long as the interval time length between the current time of the transmission time interval of the heartbeat information sent by the node device to the registration center at the last time is greater than or equal to the first preset time length, it may be indicated that the node device may fail to perform the task. By the method, the real-time performance of determining the communication connection state of the node equipment is improved.
Optionally, in the task execution method provided by the embodiment of the present application, when the interval duration between the current time of the first transmission time interval of the heartbeat information sent to the registry by the second node device last time is less than the preset duration, the communication connection state of the second node device is determined to indicate that communication connection is maintained between the second node device and the registry.
In one exemplary embodiment, the communication connection status of the second node device may be determined from the target transmission time by, but not limited to: under the condition that N sending times of heartbeat information are obtained from the second node equipment for last N times and sent to the registration center, determining interval duration between two adjacent sending times in the N sending times to obtain N-1 interval duration, wherein the target sending time comprises the N-1 interval duration, and N is more than or equal to 3; and under the condition that the N-1 interval duration is greater than or equal to a second preset duration, determining the communication connection state of the second node equipment to be indicative that communication connection is not maintained between the second node equipment and the registry.
Optionally, in the task execution method provided by the embodiment of the present application, the communication connection state of the second node device may be good before the heartbeat information is reported last time, that is, the second node device maintains the communication connection between the registries before the heartbeat information is reported last time, in this case, but not limited to, N sending times of the heartbeat information sent by the second node device to the registries last N times may be obtained, the interval duration between two adjacent sending times in the N sending times may be determined, so as to obtain N-1 interval durations, and in the case that the N-1 interval durations are all greater than or equal to the second preset duration, it may be indicated that the communication connection between the second node device and the registries is not maintained.
Optionally, in the task execution method provided by the embodiment of the present application, when the target number of interval durations in the N-1 interval durations is smaller than the second preset duration, it may indicate that some communication delay or jitter occurs suddenly in the second node device, but communication connection is still maintained between the second node device and the registry. By the method, the communication connection state of the node equipment is comprehensively determined according to the sending time of the last and last times of the heartbeat information reported by the node equipment, and the comprehensiveness of determining the communication connection state of the node equipment is improved.
In order to better understand the communication connection status of the determining node device in the embodiment of the present application, the following explanation and explanation of the communication connection status of the determining node device in the embodiment of the present application are applicable to, but not limited to, the embodiment of the present application.
Fig. 3 is a schematic diagram of determining a communication connection state of a node device according to an embodiment of the present application, as shown in fig. 3, in a registry 102, a transmission time of each node device that has been registered in the registry 102 to transmit heartbeat information to the registry 102 is recorded, for example: the transmission time of the heartbeat information from the node device 1, the node device 2 and the node device 3 to the registry is specifically t2, the transmission time of the heartbeat information from the node device 2 to the registry 102 is t5, the transmission time of the heartbeat information from the node device 3 to the registry 102 is t1, t3 and t4, respectively, the transmission time of the heartbeat information from the node device 1 (corresponding to the second node device) to the registry 102 for the last 3 (i.e. explanation and explanation taking N equal to 3 as an example) is t1, t3 and t4, and t1 is earlier than t3 and t3 is earlier than t4.
Determining an interval duration T1 between T1 and T3, and determining an interval duration T2 between T3 and T4; the communication connection state of the second node device may be determined to indicate that the communication connection is not maintained between the second node device and the registry 102, but is not limited to, in the case where both the interval duration T1 and the interval duration T2 are greater than or equal to the second preset duration.
In an exemplary embodiment, the above method further comprises: the determining, according to the target sending time, the communication connection state of the second node device includes: under the condition that N sending times of heartbeat information are obtained from the second node equipment for last N times and sent to the registration center, determining interval duration between two adjacent sending times in the N sending times to obtain N-1 interval duration, wherein the target sending time comprises the N-1 interval duration, and N is more than or equal to 3; under the condition that the N-1 interval duration is greater than or equal to a second preset duration, determining the communication connection state of the second node equipment to be unstable in communication connection maintained between the second node equipment and the registry; the method further comprises the steps of: and switching the execution of part of sub-tasks in the first task by the second node device to the execution of the first node device under the condition that the communication connection state of the second node device indicates that the communication connection kept between the second node device and the registration center is unstable.
Optionally, in the task execution method provided by the embodiment of the present application, in the case where the N-1 interval durations are all greater than or equal to the second preset duration, the communication connection state of the second node device is determined to indicate that the communication connection maintained between the second node device and the registry is unstable, and in this case, it may be indicated that the communication connection is maintained between the second node device and the registry, but the communication connection is unstable, and may be suddenly disconnected or abnormal, and so on. In such a case, the switching of the execution of a portion of the subtasks in the first task by the second node device to the execution by the first node device may be performed, but is not limited to.
Fig. 4 is a schematic diagram of an alternative node device for performing a part of the subtasks in the first task in a handover manner according to an embodiment of the present application, as shown in fig. 4, where the first task may include, but is not limited to, subtask 1, subtask 2, subtask 3, and subtask 4, and subtask 1, subtask 2, subtask 3, and subtask 4 are all performed by node device 1 (corresponding to a second node device), and where a communication connection state of the second node device (such as: node device 1) indicates that a communication connection maintained between the second node device and a registry is unstable, the subtask 1 may be performed by the second node device to be performed by the first node device (such as: node device 2). By the method, resources of the node equipment which is used for executing the tasks are comprehensively utilized, part of the subtasks are switched to other node equipment for execution, and the utilization rate of the resources of the node equipment is improved.
In the technical solution provided in step S204, in the case where the communication connection state of the second node device indicates that the communication connection is maintained between the second node device and the registry, the second node device may continue to execute the first task, where the first node device may acquire, but is not limited to, a second task state of a second task in the task set other than the first task, and where the second task state indicates that the second task is in a state of being executed by the fourth node device, determining the communication connection state of the fourth node device, where the fourth node device is a device that has been registered in the registry; in the case where the communication connection state of the fourth node device indicates that the communication connection is not maintained between the fourth node device and the registry, the second task is switched from being performed by the fourth node device to being performed by the first node device.
Optionally, in the task execution method provided in the embodiment of the present application, in a case where the communication connection state of the second node device indicates that no communication connection is maintained between the second node device and the registry, in such a case, executing the first task by the second node device may cause failure in executing the first task, for example: the second node device may suddenly disconnect from the registry, resulting in interruption of the execution of the first task, and thus failure of the execution of the first task. In such a case, the task execution success rate is improved by switching the execution of the first task by the second node device to the execution of the first node device, but not limited to.
In one exemplary embodiment, the first task may be switched from being performed by the second node device to being performed by the first node device by, but not limited to: determining, in a case where a third node device and the first node device simultaneously request replacement of the second node device to execute the first task, the first task to be executed by the third node device or the first task to be executed by the first node device according to device information of the first node device and device information of the third node device, wherein the third node device is a device that has been registered in a registry, the device information of the first node device is used for indicating that resources in the first node device are allowed for executing the first task, and the device information of the third node device is used for indicating that resources in the third node device are allowed for executing the first task; and switching the execution of the first task by the second node device to the execution of the first task by the first node device under the condition that the first task is determined to be executed by the first node device.
Optionally, in the task execution method provided in the embodiment of the present application, when the third node device and the first node device request to replace the second node device to execute the first task at the same time, the first task may be determined to be executed by the third node device or executed by the first node device according to the device information of the first node device and the device information (such as a performance resource, a memory resource, etc.) of the third node device, and when the first task is determined to be executed by the third node device, the first task may be switched from being executed by the second node device to being executed by the third node device.
In an exemplary embodiment, determining that the first task is performed by the third node device or the first task is performed by the first node device according to the device information of the first node device and the device information of the third node device may, but is not limited to, include one of the following:
mode one: in a case where more resources are allowed in the first node device for performing the first task than in the third node device for performing the first task, determining that the first task is performed by the first node device.
Optionally, in the task execution method provided in the embodiment of the present application, in a case where the first node device allows more resources for executing the first task than the third node device, it may be indicated that the first node device allows more resources for executing the first task than the third node device, and in this case, it may be determined, but not limited to, that the first node device executes the first task, thereby improving the success rate of executing the first task.
Mode two: and when the difference value between the resources allowed to execute the first task in the first node device and the resources allowed to execute the first task in the third node device is smaller than or equal to a preset threshold value, randomly selecting one node device from the first node device and the third node device to execute the first task.
Optionally, in the task execution method provided in the embodiment of the present application, in the case where a difference between a resource allowed to execute the first task in the first node device and a resource allowed to execute the first task in the third node device is smaller than or equal to a preset threshold, it may indicate that a success rate of executing the first task by the first node device or the third node device is about the same, and in this case, but not limited to, one node device may be randomly selected in the first node device and the third node device to execute the first task, by this way, flexibility of selecting the node device for executing the task is improved.
In one exemplary embodiment, the first task may be switched from being performed by the second node device to being performed by the first node device by, but not limited to: switching the first task from the second node device to the first node device; or, acquiring progress information of the first task executed by the second node device; and switching the execution of the first task by the second node equipment to the continuous execution of the first node equipment according to the progress information.
Optionally, in the task execution method provided by the embodiment of the present application, in the case that the node device for executing the task changes, the task may be restarted on the node device after the task is switched, or the task may be executed on the node device after the task is switched according to the progress information (such as the execution progress, the execution result, and the execution parameter) of the task on the node device before the task is switched, so that the task is executed continuously. By the mode, resources consumed by the task execution of the switched node equipment are saved, and the utilization rate of the resources of the node equipment is improved.
Optionally, in the task execution method provided by the embodiment of the present application, the first node device may, but is not limited to, obtain third task states of all tasks in the task set; acquiring target communication connection states of all node devices of a fifth task under the condition that the third task state is used for representing the task state of the fifth task in the task set to be executed by the node devices; modifying the task state of the sixth task to be expected to be executed by the first node device in a case where the target communication connection state is used to indicate that the node device of the sixth task of the fifth task does not remain in communication connection with the registry; and determining at least part of the sixth tasks as tasks to be executed by the first node equipment according to the equipment information of the first node equipment, wherein the equipment information of the first node equipment is used for representing resources allowed to be used for executing the tasks in the first node equipment, and the states of the tasks are the tasks expected to be executed by the first node equipment.
In order to better understand the task execution method in the embodiment of the present application, the task execution method in the embodiment of the present application is explained and illustrated below in conjunction with an alternative embodiment, which may be, but is not limited to, applicable to the embodiment of the present application.
FIG. 5 is a schematic diagram of a node device and a registry according to an embodiment of the present application, where, as shown in FIG. 5, a heartbeat reporting module 104, a task contention module 106, and a task execution module 108 are deployed in the node device, where the heartbeat reporting module 104 may also, but is not limited to, generate a node global unique ID to distinguish from other nodes; the heartbeat reporting module 104 may also be configured to register and de-register the current node with a registry, and in detail, register with the registry during a graceful start-up phase of the node; during the graceful shutdown stage of the node, de-registering the node with a registration center; the heartbeat report module 104 may, but is not limited to, be configured to report, in real time (or at intervals), the survival state (corresponding to the communication connection state) of the node corresponding to the current node device to the registry 102, and in detail, report, in real time, the heartbeat information to the registry 102. Reporting time or increasing reporting records by updating the node last heartbeat in fixed intervals (interval time depends on timeliness of the task), and so on. The task confliction module 106 may be, but is not limited to, configured to conflicte tasks from the registry 102 and schedule the task execution module 108 to execute tasks. The task execution module 108 may be, but is not limited to, for execution of tasks, primarily responsible for logging, updating task status, execution of tasks, and the like.
FIG. 6 is a schematic diagram of a task execution method according to an embodiment of the present application, as shown in FIG. 6, which may be implemented, but is not limited to, by:
step S601 traverses the task list already registered in the registry 102.
Step S602, checking whether the task is running, in detail, checking whether the current task (corresponding to the first task) has been contended by other node devices, and if so, executing step S603; otherwise, step S604 is performed.
Step S603, checking whether the interval length between the last time of the heartbeat information reporting time interval (corresponding to the current time) of the node for executing the task reaches a threshold value (the threshold value is corresponding to the preset time length), and if the interval length exceeds the maximum interval length, the node is considered to be out of connection; if the threshold is exceeded, step S604 to step S605 are executed; otherwise, the process goes to step S601.
Step S604 may update the running node of the current task by competing with an optimistic lock (optimistic lock: a concurrency control scheme, which may query whether the data has been changed before updating the data, if not, then updating, otherwise, not updating) to take over the execution of the task. If the update is successful, step S605 is executed; otherwise, jumping to the step S601 for execution;
Step S605, the task is distributed to the task execution module corresponding to the first node device for execution.
By the task execution method provided by the embodiment of the application, the task interrupt recovery and the distributed scheduling capability can be introduced into the task system when the host computer is on the platform, so that the high availability of the system is improved, and the high maintenance cost caused by introducing a large-scale distributed framework is avoided.
The task execution method provided by the embodiment of the application determines whether the node equipment for executing the task is in communication connection with the registry or not, and can indicate that the node equipment for executing the task is likely to fail in executing the task under the condition that the node equipment for executing the task is not in communication connection with the registry, under the condition, the node equipment for executing the task is switched, thereby avoiding executing the task through the node equipment which is in communication connection with the registry, improving the success rate of task execution and solving the problem of lower success rate of task execution in the related technology. Thereby achieving the effect of improving the success rate of task execution.
It should be noted that the steps illustrated in the flowcharts of the figures may be performed in a computer system such as a set of computer executable instructions, and that although a logical order is illustrated in the flowcharts, in some cases the steps illustrated or described may be performed in an order other than that illustrated herein.
The embodiment of the application also provides a task execution device, and the task execution device can be used for executing the task execution method provided by the embodiment of the application. The task execution device provided by the embodiment of the application is described below.
FIG. 7 is a schematic diagram of a task execution device according to an embodiment of the present application, as shown in FIG. 7, the device includes:
a first obtaining module 702, configured to obtain, when a first node device is registered in a registry, a task list stored on the registry, where a task set registered in the registry is recorded in the task list;
a second obtaining module 704, configured to obtain a first task state of a first task in the task set recorded in the task list;
a determining module 706, configured to determine a communication connection state of a second node device, where the second node device is a device that has been registered in a registry, in a case where the first task state indicates that the first task is in a state that is being performed by the second node device;
a first switching module 708, configured to switch the first task from being executed by the second node device to being executed by the first node device, in a case where the communication connection state of the second node device indicates that the communication connection is not maintained between the second node device and the registry.
Optionally, in the task execution device provided in the embodiment of the present application, the determining module includes: an obtaining unit, configured to obtain a target sending time of the heartbeat information sent by the second node device to the registry; and the first determining unit is used for determining the communication connection state of the second node equipment according to the target sending time.
Optionally, in the task execution device provided in the embodiment of the present application, the first determining unit is configured to: under the condition that a first sending time of the heartbeat information sent to the registration center by the second node equipment for the last time is obtained, determining whether the interval duration between the current time of the first sending time interval is greater than or equal to a preset duration, wherein the target sending time comprises the first sending time; and under the condition that the interval time length is greater than or equal to a first preset time length, determining the communication connection state of the second node equipment to be indicative that communication connection is not maintained between the second node equipment and the registration center.
Optionally, in the task execution device provided in the embodiment of the present application, the first determining unit is further configured to: under the condition that N sending times of heartbeat information are obtained from the second node equipment for last N times and sent to the registration center, determining interval duration between two adjacent sending times in the N sending times to obtain N-1 interval duration, wherein the target sending time comprises the N-1 interval duration, and N is more than or equal to 3; and under the condition that the N-1 interval duration is greater than or equal to a second preset duration, determining the communication connection state of the second node equipment to be indicative that communication connection is not maintained between the second node equipment and the registry.
Optionally, in the task execution device provided in the embodiment of the present application, the first determining unit is configured to: under the condition that N sending times of heartbeat information are obtained from the second node equipment for last N times and sent to the registration center, determining interval duration between two adjacent sending times in the N sending times to obtain N-1 interval duration, wherein the target sending time comprises the N-1 interval duration, and N is more than or equal to 3; under the condition that the N-1 interval duration is greater than or equal to a second preset duration, determining the communication connection state of the second node equipment to be unstable in communication connection maintained between the second node equipment and the registry; the apparatus further comprises: and the second switching module is used for switching the execution of part of sub-tasks in the first task by the second node equipment to the execution of the first node equipment under the condition that the communication connection state of the second node equipment indicates that the communication connection kept between the second node equipment and the registration center is unstable.
Optionally, in the task execution device provided in the embodiment of the present application, the first switching module includes: a second determining unit configured to determine, in a case where a third node device and the first node device simultaneously request replacement of the second node device to execute the first task, that the first task is executed by the third node device or the first task is executed by the first node device according to device information of the first node device and device information of the third node device, wherein the third node device is a device that has been registered in a registry, the device information of the first node device is used to represent resources in the first node device that are allowed to execute the first task, and the device information of the third node device is used to represent resources in the third node device that are allowed to execute the first task; and the switching unit is used for switching the execution of the first task by the second node device to the execution of the first task by the first node device under the condition that the first task is determined to be executed by the first node device.
Optionally, in the task execution device provided in the embodiment of the present application, the second determining unit is configured to: determining to execute the first task by the first node device in the case that more resources are allowed in the first node device to execute the first task than in the third node device; or if the difference between the resource allowed to execute the first task in the first node device and the resource allowed to execute the first task in the third node device is less than or equal to a preset threshold, randomly selecting one node device from the first node device and the third node device to execute the first task.
Optionally, in the task execution device provided in the embodiment of the present application, the switching unit is configured to: switching the first task from the second node device to the first node device; or, acquiring progress information of the first task executed by the second node device; and switching the execution of the first task by the second node equipment to the continuous execution of the first node equipment according to the progress information.
According to the task execution device provided by the embodiment of the application, by determining whether the communication connection is maintained between the node equipment for executing the task and the registry, the node equipment for executing the task can possibly fail to execute the task under the condition that the communication connection is not maintained between the node equipment for executing the task and the registry, and under the condition, the node equipment for executing the task is switched, so that the task execution success rate is improved, and the problem of lower task execution success rate in the related technology is solved. Thereby achieving the effect of improving the success rate of task execution.
The task execution device comprises a processor and a memory, wherein the units are stored in the memory as program units, and the processor executes the program units stored in the memory to realize corresponding functions.
The processor includes a kernel, and the kernel fetches the corresponding program unit from the memory. The kernel can be provided with one or more than one, and the success rate of task execution is improved by adjusting kernel parameters.
The memory may include volatile memory, random Access Memory (RAM), and/or nonvolatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM), among other forms in computer readable media, the memory including at least one memory chip.
The embodiment of the application provides a computer-readable storage medium having a program stored thereon, which when executed by a processor, implements the task execution method.
The embodiment of the application provides a processor which is used for running a program, wherein the task execution method is executed when the program runs.
Fig. 8 is a schematic diagram of an electronic device according to an embodiment of the present application, and as shown in fig. 8, the embodiment of the present application provides an electronic device, where the device includes a processor, a memory, and a program stored in the memory and executable on the processor, and the processor implements the following steps when executing the program: acquiring a task list stored on a registry under the condition that first node equipment is registered in the registry, wherein a task set registered in the registry is recorded in the task list; acquiring a first task state of a first task in the task set recorded in the task list; determining a communication connection state of a second node device, where the second node device is a device that has been registered in a registry, in a case where the first task state represents that the first task is in a state being executed by the second node device; and in a case where the communication connection state of the second node device indicates that the communication connection is not maintained between the second node device and the registry, performing a handover from the first task by the second node device to the first node device. The device herein may be a server, PC, PAD, cell phone, etc.
Optionally, the following steps may be implemented when the above processor executes a program: acquiring target sending time of the second node equipment for sending heartbeat information to the registry; and determining the communication connection state of the second node equipment according to the target sending time.
Optionally, the following steps may be implemented when the above processor executes a program: under the condition that a first sending time of the heartbeat information sent to the registration center by the second node equipment for the last time is obtained, determining whether the interval duration between the current time of the first sending time interval is greater than or equal to a preset duration, wherein the target sending time comprises the first sending time; and under the condition that the interval time length is greater than or equal to a first preset time length, determining the communication connection state of the second node equipment to be indicative that communication connection is not maintained between the second node equipment and the registration center.
Optionally, the following steps may be implemented when the above processor executes a program: under the condition that N sending times of heartbeat information are obtained from the second node equipment for last N times and sent to the registration center, determining interval duration between two adjacent sending times in the N sending times to obtain N-1 interval duration, wherein the target sending time comprises the N-1 interval duration, and N is more than or equal to 3; and under the condition that the N-1 interval duration is greater than or equal to a second preset duration, determining the communication connection state of the second node equipment to be indicative that communication connection is not maintained between the second node equipment and the registry.
Optionally, the following steps may be implemented when the above processor executes a program: the determining, according to the target sending time, the communication connection state of the second node device includes: under the condition that N sending times of heartbeat information are obtained from the second node equipment for last N times and sent to the registration center, determining interval duration between two adjacent sending times in the N sending times to obtain N-1 interval duration, wherein the target sending time comprises the N-1 interval duration, and N is more than or equal to 3; under the condition that the N-1 interval duration is greater than or equal to a second preset duration, determining the communication connection state of the second node equipment to be unstable in communication connection maintained between the second node equipment and the registry; the method further comprises the steps of: and switching the execution of part of sub-tasks in the first task by the second node device to the execution of the first node device under the condition that the communication connection state of the second node device indicates that the communication connection kept between the second node device and the registration center is unstable.
Optionally, the following steps may be implemented when the above processor executes a program: determining, in a case where a third node device and the first node device simultaneously request replacement of the second node device to execute the first task, the first task to be executed by the third node device or the first task to be executed by the first node device according to device information of the first node device and device information of the third node device, wherein the third node device is a device that has been registered in a registry, the device information of the first node device is used for indicating that resources in the first node device are allowed for executing the first task, and the device information of the third node device is used for indicating that resources in the third node device are allowed for executing the first task; and switching the execution of the first task by the second node device to the execution of the first task by the first node device under the condition that the first task is determined to be executed by the first node device.
Optionally, the following steps may be implemented when the above processor executes a program: determining to execute the first task by the first node device in the case that more resources are allowed in the first node device to execute the first task than in the third node device; or if the difference between the resource allowed to execute the first task in the first node device and the resource allowed to execute the first task in the third node device is less than or equal to a preset threshold, randomly selecting one node device from the first node device and the third node device to execute the first task.
Optionally, the following steps may be implemented when the above processor executes a program: switching the first task from the second node device to the first node device; or, acquiring progress information of the first task executed by the second node device; and switching the execution of the first task by the second node equipment to the continuous execution of the first node equipment according to the progress information.
The application also provides a computer program product adapted to perform, when executed on a data processing device, a program initialized with the method steps of: acquiring a task list stored on a registry under the condition that first node equipment is registered in the registry, wherein a task set registered in the registry is recorded in the task list; acquiring a first task state of a first task in the task set recorded in the task list; determining a communication connection state of a second node device, where the second node device is a device that has been registered in a registry, in a case where the first task state represents that the first task is in a state being executed by the second node device; and switching the first task to be executed by the second node device to be executed by the first node device when the communication connection state of the second node device indicates that the communication connection between the second node device and the registration center is not maintained.
Optionally, the computer program product mentioned above, when executed on a data processing device, is adapted to perform a program initialized with the method steps of: acquiring target sending time of the second node equipment for sending heartbeat information to the registry; and determining the communication connection state of the second node equipment according to the target sending time.
Optionally, the computer program product mentioned above, when executed on a data processing device, is adapted to perform a program initialized with the method steps of: under the condition that a first sending time of the heartbeat information sent to the registration center by the second node equipment for the last time is obtained, determining whether the interval duration between the current time of the first sending time interval is greater than or equal to a preset duration, wherein the target sending time comprises the first sending time; and under the condition that the interval time length is greater than or equal to a first preset time length, determining the communication connection state of the second node equipment to be indicative that communication connection is not maintained between the second node equipment and the registration center.
Optionally, the computer program product mentioned above, when executed on a data processing device, is adapted to perform a program initialized with the method steps of: under the condition that N sending times of heartbeat information are obtained from the second node equipment for last N times and sent to the registration center, determining interval duration between two adjacent sending times in the N sending times to obtain N-1 interval duration, wherein the target sending time comprises the N-1 interval duration, and N is more than or equal to 3; and under the condition that the N-1 interval duration is greater than or equal to a second preset duration, determining the communication connection state of the second node equipment to be indicative that communication connection is not maintained between the second node equipment and the registry.
Optionally, the computer program product mentioned above, when executed on a data processing device, is adapted to perform a program initialized with the method steps of: the determining, according to the target sending time, the communication connection state of the second node device includes: under the condition that N sending times of heartbeat information are obtained from the second node equipment for last N times and sent to the registration center, determining interval duration between two adjacent sending times in the N sending times to obtain N-1 interval duration, wherein the target sending time comprises the N-1 interval duration, and N is more than or equal to 3; under the condition that the N-1 interval duration is greater than or equal to a second preset duration, determining the communication connection state of the second node equipment to be unstable in communication connection maintained between the second node equipment and the registry; the method further comprises the steps of: and switching the execution of part of sub-tasks in the first task by the second node device to the execution of the first node device under the condition that the communication connection state of the second node device indicates that the communication connection kept between the second node device and the registration center is unstable.
Optionally, the computer program product mentioned above, when executed on a data processing device, is adapted to perform a program initialized with the method steps of: determining, in a case where a third node device and the first node device simultaneously request replacement of the second node device to execute the first task, the first task to be executed by the third node device or the first task to be executed by the first node device according to device information of the first node device and device information of the third node device, wherein the third node device is a device that has been registered in a registry, the device information of the first node device is used for indicating that resources in the first node device are allowed for executing the first task, and the device information of the third node device is used for indicating that resources in the third node device are allowed for executing the first task; and switching the execution of the first task by the second node device to the execution of the first task by the first node device under the condition that the first task is determined to be executed by the first node device.
Optionally, the computer program product mentioned above, when executed on a data processing device, is adapted to perform a program initialized with the method steps of: determining to execute the first task by the first node device in the case that more resources are allowed in the first node device to execute the first task than in the third node device; or if the difference between the resource allowed to execute the first task in the first node device and the resource allowed to execute the first task in the third node device is less than or equal to a preset threshold, randomly selecting one node device from the first node device and the third node device to execute the first task.
Optionally, the computer program product mentioned above, when executed on a data processing device, is adapted to perform a program initialized with the method steps of: switching the first task from the second node device to the first node device; or, acquiring progress information of the first task executed by the second node device; and switching the execution of the first task by the second node equipment to the continuous execution of the first node equipment according to the progress information.
It will be appreciated by those skilled in the art that embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In one typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include volatile memory in a computer-readable medium, random Access Memory (RAM) and/or nonvolatile memory, etc., such as Read Only Memory (ROM) or flash RAM. Memory is an example of a computer-readable medium.
Computer readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of storage media for a computer include, but are not limited to, phase change memory (PRAM), static Random Access Memory (SRAM), dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), read Only Memory (ROM), electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium, which can be used to store information that can be accessed by a computing device. Computer-readable media, as defined herein, does not include transitory computer-readable media (transmission media), such as modulated data signals and carrier waves.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article or apparatus that comprises an element.
It will be appreciated by those skilled in the art that embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The foregoing is merely exemplary of the present application and is not intended to limit the present application. Various modifications and variations of the present application will be apparent to those skilled in the art. Any modification, equivalent replacement, improvement, etc. which come within the spirit and principles of the application are to be included in the scope of the claims of the present application.

Claims (11)

1. A method of performing a task, comprising:
acquiring a task list stored on a registry under the condition that first node equipment is registered in the registry, wherein a task set registered in the registry is recorded in the task list;
acquiring a first task state of a first task in the task set recorded in the task list;
Determining a communication connection state of a second node device, where the second node device is a device that has been registered in a registry, in a case where the first task state represents that the first task is in a state being executed by the second node device;
and switching the first task to be executed by the second node device to be executed by the first node device when the communication connection state of the second node device indicates that the communication connection between the second node device and the registration center is not maintained.
2. The method of claim 1, wherein the determining the communication connection status of the second node device comprises:
acquiring target sending time of the second node equipment for sending heartbeat information to the registry;
and determining the communication connection state of the second node equipment according to the target sending time.
3. The method according to claim 2, wherein said determining the communication connection status of the second node device according to the target transmission time comprises:
under the condition that a first sending time of the heartbeat information sent to the registration center by the second node equipment for the last time is obtained, determining whether the interval duration between the current time of the first sending time interval is greater than or equal to a preset duration, wherein the target sending time comprises the first sending time;
And under the condition that the interval time length is greater than or equal to a first preset time length, determining the communication connection state of the second node equipment to be indicative that communication connection is not maintained between the second node equipment and the registration center.
4. The method according to claim 2, wherein said determining the communication connection status of the second node device according to the target transmission time comprises:
under the condition that N sending times of heartbeat information are obtained from the second node equipment for last N times and sent to the registration center, determining interval duration between two adjacent sending times in the N sending times to obtain N-1 interval duration, wherein the target sending time comprises the N-1 interval duration, and N is more than or equal to 3;
and under the condition that the N-1 interval duration is greater than or equal to a second preset duration, determining the communication connection state of the second node equipment to be indicative that communication connection is not maintained between the second node equipment and the registry.
5. The method of claim 2, wherein the step of determining the position of the substrate comprises,
the determining, according to the target sending time, the communication connection state of the second node device includes:
Under the condition that N sending times of heartbeat information are obtained from the second node equipment for last N times and sent to the registration center, determining interval duration between two adjacent sending times in the N sending times to obtain N-1 interval duration, wherein the target sending time comprises the N-1 interval duration, and N is more than or equal to 3; under the condition that the N-1 interval duration is greater than or equal to a second preset duration, determining the communication connection state of the second node equipment to be unstable in communication connection maintained between the second node equipment and the registry;
the method further comprises the steps of: and switching the execution of part of sub-tasks in the first task by the second node device to the execution of the first node device under the condition that the communication connection state of the second node device indicates that the communication connection kept between the second node device and the registration center is unstable.
6. The method of claim 1, wherein the switching the first task performed by the second node device to the first node device if the communication connection state of the second node device indicates that no communication connection is maintained between the second node device and the registry, comprises:
Determining, in a case where a third node device and the first node device simultaneously request replacement of the second node device to execute the first task, the first task to be executed by the third node device or the first task to be executed by the first node device according to device information of the first node device and device information of the third node device, wherein the third node device is a device that has been registered in a registry, the device information of the first node device is used for indicating that resources in the first node device are allowed for executing the first task, and the device information of the third node device is used for indicating that resources in the third node device are allowed for executing the first task;
and switching the execution of the first task by the second node device to the execution of the first task by the first node device under the condition that the first task is determined to be executed by the first node device.
7. The method of claim 6, wherein determining, based on the device information of the first node device and the device information of the third node device, to perform the first task by the third node device or to perform the first task by the first node device comprises:
Determining to execute the first task by the first node device in the case that more resources are allowed in the first node device to execute the first task than in the third node device; or alternatively
And when the difference value between the resources allowed to execute the first task in the first node device and the resources allowed to execute the first task in the third node device is smaller than or equal to a preset threshold value, randomly selecting one node device from the first node device and the third node device to execute the first task.
8. The method according to any of claims 1 to 7, wherein the switching the first task performed by the second node device to the first node device comprises:
switching the first task from the second node device to the first node device; or alternatively, the process may be performed,
acquiring progress information of the first task executed by the second node equipment; and switching the execution of the first task by the second node equipment to the continuous execution of the first node equipment according to the progress information.
9. A task execution device, characterized by comprising:
the first acquisition module is used for acquiring a task list stored on a registry under the condition that first node equipment is registered in the registry, wherein a task set registered in the registry is recorded in the task list;
the second acquisition module is used for acquiring a first task state of a first task in the task set recorded in the task list;
a determining module configured to determine a communication connection state of a second node device in a case where the first task state indicates that the first task is in a state of being executed by the second node device, wherein the second node device is a device that has been registered in a registry;
and the first switching module is used for switching the first task executed by the second node equipment to the first node equipment under the condition that the communication connection state of the second node equipment indicates that the communication connection between the second node equipment and the registration center is not maintained.
10. A processor for running a program, wherein the program when run performs the method of any one of claims 1 to 8.
11. An electronic device comprising one or more processors and memory for storing one or more programs, wherein the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the method of any of claims 1-8.
CN202310702153.XA 2023-06-13 2023-06-13 Task execution method and device, storage medium and electronic equipment Pending CN116599828A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310702153.XA CN116599828A (en) 2023-06-13 2023-06-13 Task execution method and device, storage medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310702153.XA CN116599828A (en) 2023-06-13 2023-06-13 Task execution method and device, storage medium and electronic equipment

Publications (1)

Publication Number Publication Date
CN116599828A true CN116599828A (en) 2023-08-15

Family

ID=87600910

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310702153.XA Pending CN116599828A (en) 2023-06-13 2023-06-13 Task execution method and device, storage medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN116599828A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117667363A (en) * 2024-02-01 2024-03-08 深圳市极限网络科技有限公司 Message processing method, message processing device and storage medium for virtual robot

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117667363A (en) * 2024-02-01 2024-03-08 深圳市极限网络科技有限公司 Message processing method, message processing device and storage medium for virtual robot
CN117667363B (en) * 2024-02-01 2024-05-14 深圳市极限网络科技有限公司 Message processing method, message processing device and storage medium for virtual robot

Similar Documents

Publication Publication Date Title
US9240937B2 (en) Fault detection and recovery as a service
US9535754B1 (en) Dynamic provisioning of computing resources
CN106933672B (en) Distributed environment coordinated consumption queue method and device
CN113067850B (en) Cluster arrangement system under multi-cloud scene
CN104166589A (en) Heartbeat package processing method and device
CN106899654B (en) Sequence value generation method, device and system
CN111314479A (en) Data processing method and equipment
CN106790092B (en) Remote procedure call server control system and method
CN110764963A (en) Service exception handling method, device and equipment
CN116599828A (en) Task execution method and device, storage medium and electronic equipment
CN111064789B (en) Data migration method and system
CN113282649A (en) Distributed task processing method and device and computer equipment
CN111078238A (en) Centralized processing method and device for application configuration in container environment
CN108111630B (en) Zookeeper cluster system and connection method and system thereof
CN110895485A (en) Task scheduling system
CN110298031B (en) Dictionary service system and model version consistency distribution method
CN109032674B (en) Multi-process management method, system and network equipment
CN116185589A (en) Scheduling right acquisition method, equipment, system and storage medium
Wei et al. An agent-based services framework with adaptive monitoring in cloud environments
CN114327835A (en) Distributed task scheduling method and device, processor and electronic equipment
CN105760215A (en) Map-reduce model based job running method for distributed file system
CN111245909B (en) Distributed dynamic scheduling method and device, electronic equipment and storage medium
CN113641493A (en) Task pushing method, device and equipment and computer readable storage medium
CN108255820B (en) Method and device for data storage in distributed system and electronic equipment
US10963375B1 (en) Managing maintenance operations for a distributed system

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination