CN115580555B - Distributed task cancellation method, device, system and electronic equipment - Google Patents
Distributed task cancellation method, device, system and electronic equipment Download PDFInfo
- Publication number
- CN115580555B CN115580555B CN202211576420.5A CN202211576420A CN115580555B CN 115580555 B CN115580555 B CN 115580555B CN 202211576420 A CN202211576420 A CN 202211576420A CN 115580555 B CN115580555 B CN 115580555B
- Authority
- CN
- China
- Prior art keywords
- distributed task
- task
- distributed
- execution engine
- request
- 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.)
- Active
Links
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L43/00—Arrangements for monitoring or testing data switching networks
- H04L43/08—Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters
- H04L43/0805—Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters by checking availability
- H04L43/0811—Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters by checking availability by checking connectivity
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/50—Allocation of resources, e.g. of the central processing unit [CPU]
- G06F9/5005—Allocation of resources, e.g. of the central processing unit [CPU] to service a request
- G06F9/5027—Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L43/00—Arrangements for monitoring or testing data switching networks
- H04L43/10—Active monitoring, e.g. heartbeat, ping or trace-route
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/14—Session management
- H04L67/143—Termination or inactivation of sessions, e.g. event-controlled end of session
- H04L67/145—Termination or inactivation of sessions, e.g. event-controlled end of session avoiding end of session, e.g. keep-alive, heartbeats, resumption message or wake-up for inactive or interrupted session
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Landscapes
- Engineering & Computer Science (AREA)
- Signal Processing (AREA)
- Computer Networks & Wireless Communication (AREA)
- General Health & Medical Sciences (AREA)
- Health & Medical Sciences (AREA)
- Cardiology (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Environmental & Geological Engineering (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Computer And Data Communications (AREA)
- Debugging And Monitoring (AREA)
Abstract
The invention provides a distributed task cancellation method, a distributed task cancellation device, a distributed task cancellation system and electronic equipment, and belongs to the technical field of data communication. The method comprises the following steps: monitoring the connection state of long connection established with the client of the client terminal; and when the long connection is monitored to be in a disconnected state, sending a distributed task cancellation request to an execution engine based on the distributed task corresponding to the disconnected long connection, wherein the distributed task cancellation request is used for indicating the execution engine to cancel executing the distributed task. The method can cancel the distributed task in time in the execution process of the distributed task, thereby playing a role in saving the resource of the execution engine.
Description
Technical Field
The present invention relates to the field of data communications technologies, and in particular, to a method, an apparatus, a system, and an electronic device for canceling a distributed task.
Background
In a distributed scenario, the task is often started and executed on each execution node, and after a complex distributed task is executed, it takes a long time to complete the complex task.
At present, a complex distributed task often needs to return a large amount of data (possibly higher than the memory of a server) after the task is executed, which requires that an interface gradually spits out in a data stream mode, and a common http protocol (short connection) interface is difficult to cancel in the process of executing the complex task due to the characteristic of no connection state, especially in the big data analysis and calculation scene, the task is difficult to cancel halfway, and resource waste is caused.
Disclosure of Invention
The invention provides a distributed task cancellation method, a distributed task cancellation device, a distributed task cancellation system and electronic equipment, which are used for solving the defect that a complex distributed task is difficult to cancel in the execution process of the complex distributed task in the prior art and realizing the cancellation of the distributed task in the execution process of the complex distributed task.
The invention provides a distributed task cancellation method, which comprises the following steps:
monitoring the connection state of long connection established with the client of the client terminal;
and when the long connection is monitored to be in a disconnected state, sending a distributed task cancellation request to an execution engine based on the distributed task corresponding to the disconnected long connection, wherein the distributed task cancellation request is used for indicating the execution engine to cancel executing the distributed task.
According to the distributed task cancellation method provided by the invention, before monitoring the connection state of the long connection with the client of the client terminal, the distributed task cancellation method further comprises the following steps:
establishing a plurality of long connections with the client based on the connection request of the client;
respectively receiving a plurality of distributed task requests sent by the client through a plurality of long connections;
and sending a plurality of distributed task requests to the execution engine, wherein the distributed task requests are used for instructing the execution engine to execute the distributed tasks.
According to the distributed task cancellation method provided by the invention, when the long connection is monitored to be in a disconnection state, a distributed task cancellation request is sent to an execution engine based on the disconnected distributed task corresponding to the long connection, and the distributed task cancellation request is used for indicating the execution engine to cancel executing the distributed task, and the distributed task cancellation method comprises the following steps:
when the long connection is monitored to be in a disconnection state, acquiring a task ID corresponding to the distributed task request received through the long connection before disconnection;
sending a corresponding distributed task pause request to the execution engine according to the task ID, wherein the distributed task pause request is used for indicating the execution engine to pause the execution of the distributed task corresponding to the task ID;
continuing to monitor the connection state of the long connection established with the client of the client terminal;
when monitoring preset time and the long connection is continuously in a disconnected state, sending a corresponding distributed task cancellation request to the execution engine according to the task ID, wherein the distributed task cancellation request is used for indicating the execution engine to cancel executing the distributed task corresponding to the task ID.
According to the distributed task canceling method provided by the invention, the distributed task canceling method further comprises the following steps:
and when the long connection is in the connection state again in the monitoring preset time, sending a corresponding distributed task recovery request to the execution engine according to the task ID, wherein the distributed task recovery request is used for indicating the execution engine to recover to execute the distributed task corresponding to the task ID.
According to the method for canceling the distributed task provided by the invention, the task ID corresponding to the distributed task request received through the long connection before disconnection is obtained, and the method comprises the following steps:
and acquiring a task ID corresponding to the distributed task request received through the long connection before disconnection from Session.
The invention also provides a distributed task canceling device, which comprises:
the monitoring module is used for monitoring the connection state of the long connection established with the client of the client terminal;
and the first sending module is used for sending a distributed task cancellation request to an execution engine based on the distributed task corresponding to the disconnected long connection when the long connection is monitored to be in a disconnected state, wherein the distributed task cancellation request is used for indicating the execution engine to cancel executing the distributed task.
The distributed task canceling device provided by the invention further comprises:
a connection establishing module, configured to establish a plurality of long connections with the client based on a connection request of the client;
the task receiving module is used for respectively receiving a plurality of distributed task requests sent by the client through a plurality of long connections;
and the second sending module is used for sending a plurality of distributed task requests to the execution engine, wherein the distributed task requests are used for instructing the execution engine to execute the distributed tasks.
The invention also provides a distributed task canceling system, which comprises any one of the distributed task canceling devices, and further comprises:
the client terminal is used for sending a connection request and a distributed task request;
and the execution engine is used for receiving the distributed task request and executing the distributed task, and is also used for receiving a distributed task cancellation request and canceling the execution of the distributed task.
The invention also provides an electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the distributed task cancellation method as described in any one of the above when executing the program.
The present invention also provides a non-transitory computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements a distributed task cancellation method as described in any of the above.
The invention also provides a computer program product comprising a computer program which when executed by a processor implements a distributed task cancellation method as described in any one of the above.
According to the distributed task canceling method, device, system and electronic equipment, the heartbeat of the client is monitored in a mode of establishing long connection with the client for issuing the distributed task, so that the heartbeat of the client can be timely acquired when the long connection is disconnected, a task canceling request is sent to an execution engine to cancel execution of the distributed task, the distributed task can be timely canceled in the execution process of the distributed task, and therefore the function of saving the resource of the execution engine is achieved.
Drawings
In order to more clearly illustrate the invention or the technical solutions of the prior art, the following description will briefly explain the drawings used in the embodiments or the description of the prior art, and it is obvious that the drawings in the following description are some embodiments of the invention, and other drawings can be obtained according to the drawings without inventive effort for a person skilled in the art.
FIG. 1 is a schematic flow chart of a distributed task cancellation method provided by the present invention;
FIG. 2 is a second flow chart of the distributed task cancellation method according to the present invention;
FIG. 3 is a schematic flow chart of a distributed task cancellation method after a disconnection state is detected;
FIG. 4 is a schematic diagram of a distributed task cancellation device according to the present invention;
FIG. 5 is a second schematic diagram of a distributed task canceling device according to the present invention;
FIG. 6 is a schematic diagram of a distributed task cancellation system according to the present invention
Fig. 7 is a schematic structural diagram of an electronic device provided by the present invention.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the present invention more apparent, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings, and it is apparent that the described embodiments are some embodiments of the present invention, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
The distributed task cancellation method of the present invention is described below with reference to fig. 1 to 3, and includes:
s201: and monitoring the connection state of the long connection established with the client of the client terminal.
S202: and when the long connection is monitored to be in a disconnected state, sending a distributed task cancellation request to an execution engine based on the distributed task corresponding to the disconnected long connection, wherein the distributed task cancellation request is used for indicating the execution engine to cancel executing the distributed task.
Specifically, a long connection means that a plurality of data packets can be continuously transmitted over one connection, and both sides are required to transmit a link detection packet if no data packet is transmitted during connection maintenance. In the process of executing the distributed tasks by the execution engine, the connection state of the long connection established with the client needs to be monitored in real time, and the connection state of the long connection can be monitored through after connection closed monitoring logic by way of example. When the connection state of the long connection is monitored to be in a disconnection state, the connection state of the long connection is indicated to be disconnected with the client, and at this time, the distributed task issued by the client through the long connection before the long connection is disconnected may not need to be executed again.
In order to cancel the distributed task that does not need to be continuously executed, a distributed task cancellation request needs to be sent to the execution engine, so that the execution engine cancels the distributed task that is issued by the execution client through the long connection before the long connection is disconnected.
The disconnection state may be implemented by actively operating the client to disconnect the long connection, or passively disconnecting the long connection based on special situations such as power outage and disconnection. The execution engine is for executing and canceling distributed tasks, and may include a plurality of execution servers for executing distributed tasks.
According to the distributed task cancellation method, the heartbeat of the client is monitored in a mode of establishing long connection with the client for issuing the distributed task, so that the heartbeat of the client can be timely acquired when the long connection is disconnected, a task cancellation request is sent to the execution engine to cancel the execution of the distributed task, the distributed task can be timely cancelled in the execution process of the distributed task, and the effect of saving the resources of the execution engine is achieved.
In one embodiment, referring to fig. 2, before the monitoring of the connection state of the long connection with the client of the client terminal, the method further includes:
s201: and establishing a plurality of long connections with the client based on the connection request of the client.
S202: and respectively receiving a plurality of distributed task requests sent by the client through a plurality of long connections.
S203: and sending a plurality of distributed task requests to the execution engine, wherein the distributed task requests are used for instructing the execution engine to execute the distributed tasks.
Specifically, before monitoring the connection state of the long connection with the client, a plurality of long connections are established with the client, the long connections are established based on the connection request of the client, when a user needs to issue a plurality of distributed task requests, a plurality of long connections are established corresponding to the plurality of distributed task requests, for example, when 5 distributed task requests need to be issued, 5 long connections need to be established to issue the 5 distributed task requests respectively.
The long connection is illustratively implemented through a Websocket interface or Socket interface. WebSocket is a protocol that enables full duplex communication over a single TCP connection, which makes the exchange of data between a client and a server simpler, allowing the server to actively push data to the client. In the WebSocket interface, the browser and the server only need to complete one handshake, and a persistent connection, namely a long connection, can be directly established between the browser and the server, and bidirectional data transmission is performed. Socket interfaces are a set of interfaces used for enabling different devices to communicate with each other between different processes.
When a plurality of distributed task requests sent by a client are received, task IDs of the distributed task requests need to be stored, so that after long connection is disconnected, the task IDs of the distributed tasks can be obtained based on the long connection sending the distributed task requests. By way of example, the task ID may be the recorded Sq1 execution handle.
After receiving the distributed task requests, the received multiple distributed task requests sent by the client are sent to an execution engine so that the execution engine can execute the corresponding distributed tasks.
In one embodiment, referring to fig. 3, when the long connection is monitored to be in a disconnected state, a distributed task cancellation request is sent to an execution engine based on a distributed task corresponding to the disconnected long connection, where the distributed task cancellation request is used to instruct the execution engine to cancel executing the distributed task, and the method includes:
s301: and when the long connection is monitored to be in a disconnection state, acquiring a task ID corresponding to the distributed task request received through the long connection before disconnection.
Specifically, when the connection state of the long connection is monitored to be in a disconnection state, it indicates that a certain long connection established with the client is disconnected, and at this time, the distributed task issued by the client through the long connection before the disconnection of the long connection may not need to be executed again.
At this time, it is necessary to know which long connection is in a disconnected state.
It can be understood that, based on the above knowledge of which long connection is in the disconnected state, the task ID corresponding to the distributed task request sent before the long connection is disconnected is obtained for the disconnected long connection.
S302: and sending a corresponding distributed task pause request to the execution engine according to the task ID, wherein the distributed task pause request is used for indicating the execution engine to pause the execution of the distributed task corresponding to the task ID.
And sending a pause request of the distributed task corresponding to the task ID to an execution engine according to the task ID obtained in the steps, wherein the execution engine pauses the execution of the distributed task corresponding to the task ID according to the pause request of the distributed task, so that the continuous execution of the distributed task is prevented, and the resources of the execution engine are saved.
S303: and continuing to monitor the connection state of the long connection established with the client of the client terminal.
Further, after the distributed task is suspended, the connection state of the long connection is continuously monitored.
S304: when monitoring preset time and the long connection is continuously in a disconnected state, sending a corresponding distributed task cancellation request to the execution engine according to the task ID, wherein the distributed task cancellation request is used for indicating the execution engine to cancel executing the distributed task corresponding to the task ID.
The preset time is preset according to task requirements or user requirements, and the preset time is a time period, for example, 30 seconds, 1 minute, five minutes, and the like, and is not limited in detail herein.
And continuously monitoring the connection state of the long connection for a preset time, for example, 1 minute, and when the long connection is continuously in a disconnection state in the monitoring process of the minute, sending a cancellation request of the distributed task corresponding to the task ID to an execution engine according to the task ID obtained in the step, and canceling the execution of the distributed task corresponding to the task ID by the execution engine according to the distributed task cancellation request, thereby preventing the continuous execution of the distributed task and saving the resources of the execution engine.
According to the method, the distributed task is canceled when the long connection is disconnected, but the distributed task is canceled when the long connection is disconnected for a long time after monitoring for a period of time, so that the process of the distributed task under the condition of short disconnection of the long connection caused by unstable network is reserved.
In one embodiment, the distributed task cancellation method further includes:
and when the long connection is in the connection state again in the monitoring preset time, sending a corresponding distributed task recovery request to the execution engine according to the task ID, wherein the distributed task recovery request is used for indicating the execution engine to recover to execute the distributed task corresponding to the task ID.
The preset time is preset according to task requirements or user requirements, and the preset time is a time period, for example, 30 seconds, 1 minute, five minutes, and the like, and is not limited in detail herein. And continuously monitoring preset time after the long connection established with the client of the client terminal is disconnected, and enabling the execution engine to resume executing the distributed task by sending a distributed task resume request to the execution engine if the long connection is in a connection state again within the preset time.
Under the condition of short disconnection of long connection caused by poor network condition, the method can quickly resume the execution of the distributed task after the connection is resumed by the long connection, and the task is not required to be restarted, thereby saving the resources of an execution engine.
In one embodiment, the obtaining the task ID corresponding to the distributed task request received through the long connection before disconnection includes:
and acquiring a task ID corresponding to the distributed task request received through the long connection before disconnection from Session.
Specifically, session is a special object created by the server to save the user state.
The distributed task canceling device provided by the present invention will be described below with reference to fig. 4 and 5, and the distributed task canceling device described below and the distributed task canceling method described above may be referred to correspondingly to each other. The distributed task cancellation device includes:
a monitoring module 401, configured to monitor a connection state of a long connection established with a client of the client terminal;
a first sending module 402, configured to send, when it is monitored that the long connection is in a disconnected state, a distributed task cancellation request to an execution engine based on a distributed task corresponding to the disconnected long connection, where the distributed task cancellation request is used to instruct the execution engine to cancel executing the distributed task.
Specifically, a long connection means that a plurality of data packets can be continuously transmitted over one connection, and both sides are required to transmit a link detection packet if no data packet is transmitted during connection maintenance. In the process of executing the distributed task by the execution engine, the listening module 401 needs to monitor the connection state of the long connection established with the client in real time, and for example, may monitor the connection state of the long connection through after connection closed listening logic. When the connection state of the long connection is monitored to be in a disconnection state, the connection state of the long connection is indicated to be disconnected with the client, and at this time, the distributed task issued by the client through the long connection before the long connection is disconnected may not need to be executed again.
In order to cancel the distributed task that does not need to be continuously executed, the first sending module 402 needs to send a distributed task cancellation request to the execution engine, so that the execution engine cancels the distributed task that is issued by the client through the long connection before the long connection is disconnected.
The implementation of the disconnection state may enable the client to disconnect the long connection through active operation, or may enable the client to disconnect the long connection passively based on special situations such as power failure and network disconnection. The execution engine is for executing and canceling distributed tasks, and may include a plurality of execution servers for executing distributed tasks. The distributed task cancellation device may be a business service layer, including the above-mentioned listening module 401 and the first sending module 402.
The distributed task canceling device monitors the heartbeat of the client in a mode of establishing long connection with the client for issuing the distributed task, so that the heartbeat of the client can be timely acquired when the long connection is disconnected, a task canceling request is sent to the execution engine to cancel the execution of the distributed task, the distributed task can be timely canceled in the execution process of the distributed task, and the function of saving the resource of the execution engine is achieved.
In one embodiment, referring to fig. 5, the distributed task canceling apparatus further includes:
a connection establishment module 501, configured to establish a plurality of long connections with the client based on a connection request of the client;
a task receiving module 502, configured to receive, through a plurality of long connections, a plurality of distributed task requests sent by the client respectively;
a second sending module 503, configured to send a plurality of distributed task requests to the execution engine, where the distributed task requests are used to instruct the execution engine to execute the distributed task.
Specifically, before monitoring the connection state of the long connection with the client, a plurality of long connections are established with the client, the long connection is established through the connection establishment module 501 based on the connection request of the client, and when the user needs to issue a plurality of distributed task requests, the user needs to establish a plurality of long connections corresponding to the plurality of distributed task requests.
When receiving a plurality of distributed task requests sent by a client, the task receiving module 502 needs to store task IDs of the distributed task requests, so that after the long connection is disconnected, the task IDs of the distributed tasks can be obtained based on the long connection sending the distributed task requests. By way of example, the task ID may be the recorded Sq1 execution handle.
The second sending module 503 sends the received multiple distributed task requests sent by the client to the execution engine, so that the execution engine executes the corresponding distributed tasks.
The distributed task cancellation system provided by the present invention is described below with reference to fig. 6, where the system includes the distributed task cancellation device according to any one of the foregoing embodiments, and the system further includes:
a client terminal 601 for sending a connection request and a distributed task request.
The execution engine 603 is configured to receive the distributed task request and execute a distributed task, and further configured to receive a distributed task cancellation request, and cancel execution of the distributed task.
Specifically, the distributed task canceling device 602 is connected to the client of the client terminal 601 and the execution engine 603, respectively, wherein a long connection is established with the client of the client terminal 601. The execution engine 603 is configured to receive and execute a request issued by the distributed task cancellation device 602, and the execution engine 603 may include a plurality of execution servers for executing distributed tasks.
The distributed task canceling system monitors the heartbeat of the client in a mode of establishing long connection with the client for issuing the distributed task, so that the heartbeat of the client can be timely acquired when the long connection is disconnected, a task canceling request is sent to the execution engine to cancel the execution of the distributed task, the distributed task can be timely canceled in the execution process of the distributed task, and the function of saving the resource of the execution engine is achieved.
Fig. 7 illustrates a physical schematic diagram of an electronic device, as shown in fig. 7, which may include: processor 710, communication interface (Communications Interface) 720, memory 730, and communication bus 740, wherein processor 710, communication interface 720, memory 730 communicate with each other via communication bus 740. Processor 710 may invoke logic instructions in memory 730 to perform a distributed task cancellation method comprising: monitoring the connection state of long connection established with the client; and when the long connection is monitored to be in a disconnected state, sending a distributed task cancel request to an execution engine based on the distributed task corresponding to the disconnected long connection, so that the execution engine cancels the execution of the distributed task.
Further, the logic instructions in the memory 730 described above may be implemented in the form of software functional units and may be stored in a computer readable storage medium when sold or used as a stand alone product. Based on this understanding, the technical solution of the present invention may be embodied essentially or in a part contributing to the prior art or in a part of the technical solution, in the form of a software product stored in a storage medium, comprising several instructions for causing a computer device (which may be a personal computer, a server, a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
In another aspect, the present invention also provides a computer program product, the computer program product comprising a computer program, the computer program being storable on a non-transitory computer readable storage medium, the computer program, when executed by a processor, being capable of performing the distributed task cancellation method provided by the above methods, the method comprising: monitoring the connection state of long connection established with the client; and when the long connection is monitored to be in a disconnected state, sending a distributed task cancel request to an execution engine based on the distributed task corresponding to the disconnected long connection, so that the execution engine cancels the execution of the distributed task.
In yet another aspect, the present invention also provides a non-transitory computer readable storage medium having stored thereon a computer program which, when executed by a processor, is implemented to perform the distributed task cancellation method provided by the above methods, the method comprising: monitoring the connection state of long connection established with the client; and when the long connection is monitored to be in a disconnected state, sending a distributed task cancel request to an execution engine based on the distributed task corresponding to the disconnected long connection, so that the execution engine cancels the execution of the distributed task.
The apparatus embodiments described above are merely illustrative, wherein the elements illustrated as separate elements may or may not be physically separate, and the elements shown as elements may or may not be physical elements, may be located in one place, or may be distributed over a plurality of network elements. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment. Those of ordinary skill in the art will understand and implement the present invention without undue burden.
From the above description of the embodiments, it will be apparent to those skilled in the art that the embodiments may be implemented by means of software plus necessary general hardware platforms, or of course may be implemented by means of hardware. Based on this understanding, the foregoing technical solution may be embodied essentially or in a part contributing to the prior art in the form of a software product, which may be stored in a computer readable storage medium, such as ROM/RAM, a magnetic disk, an optical disk, etc., including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method described in the respective embodiments or some parts of the embodiments.
Finally, it should be noted that: the above embodiments are only for illustrating the technical solution of the present invention, and are not limiting; although the invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims (7)
1. A distributed task cancellation method, comprising:
monitoring the connection state of long connection established with the client of the client terminal;
when the long connection is monitored to be in a disconnected state, sending a distributed task cancellation request to an execution engine based on the distributed task corresponding to the disconnected long connection, wherein the distributed task cancellation request is used for indicating the execution engine to cancel executing the distributed task;
before monitoring the connection state of the long connection with the client of the client terminal, the method further comprises the following steps:
establishing a plurality of long connections with the client based on the connection request of the client;
respectively receiving a plurality of distributed task requests sent by the client through a plurality of long connections;
sending a plurality of distributed task requests to the execution engine, wherein the distributed task requests are used for instructing the execution engine to execute the distributed tasks;
when the long connection is monitored to be in a disconnected state, sending a distributed task cancellation request to an execution engine based on the distributed task corresponding to the disconnected long connection, wherein the distributed task cancellation request is used for indicating the execution engine to cancel executing the distributed task, and the distributed task cancellation request comprises the following steps:
when the long connection is monitored to be in a disconnection state, acquiring a task ID corresponding to the distributed task request received through the long connection before disconnection;
sending a corresponding distributed task pause request to the execution engine according to the task ID, wherein the distributed task pause request is used for indicating the execution engine to pause the execution of the distributed task corresponding to the task ID;
continuing to monitor the connection state of the long connection established with the client of the client terminal;
when monitoring preset time and the long connection is continuously in a disconnected state, sending a corresponding distributed task cancellation request to the execution engine according to the task ID, wherein the distributed task cancellation request is used for indicating the execution engine to cancel executing the distributed task corresponding to the task ID.
2. The distributed task cancellation method according to claim 1, characterized in that the distributed task cancellation method further comprises:
and when the long connection is in the connection state again in the monitoring preset time, sending a corresponding distributed task recovery request to the execution engine according to the task ID, wherein the distributed task recovery request is used for indicating the execution engine to recover to execute the distributed task corresponding to the task ID.
3. The distributed task cancellation method according to claim 1, wherein the acquiring the task ID corresponding to the distributed task request received through the long connection before disconnection includes:
and acquiring a task ID corresponding to the distributed task request received through the long connection before disconnection from Session.
4. A distributed task cancellation device, comprising:
the monitoring module is used for monitoring the connection state of the long connection established with the client of the client terminal;
the first sending module is used for sending a distributed task cancellation request to an execution engine based on a distributed task corresponding to the disconnected long connection when the long connection is monitored to be in a disconnected state, wherein the distributed task cancellation request is used for indicating the execution engine to cancel executing the distributed task;
a connection establishing module, configured to establish a plurality of long connections with the client based on a connection request of the client;
the task receiving module is used for respectively receiving a plurality of distributed task requests sent by the client through a plurality of long connections;
the second sending module is used for sending a plurality of distributed task requests to the execution engine, wherein the distributed task requests are used for instructing the execution engine to execute the distributed tasks;
when the long connection is monitored to be in a disconnected state, sending a distributed task cancellation request to an execution engine based on the distributed task corresponding to the disconnected long connection, wherein the distributed task cancellation request is used for indicating the execution engine to cancel executing the distributed task, and the distributed task cancellation request comprises the following steps:
when the long connection is monitored to be in a disconnection state, acquiring a task ID corresponding to the distributed task request received through the long connection before disconnection;
sending a corresponding distributed task pause request to the execution engine according to the task ID, wherein the distributed task pause request is used for indicating the execution engine to pause the execution of the distributed task corresponding to the task ID;
continuing to monitor the connection state of the long connection established with the client of the client terminal;
when monitoring preset time and the long connection is continuously in a disconnected state, sending a corresponding distributed task cancellation request to the execution engine according to the task ID, wherein the distributed task cancellation request is used for indicating the execution engine to cancel executing the distributed task corresponding to the task ID.
5. A distributed task cancellation system comprising the distributed task cancellation device of claim 4, further comprising:
the client terminal is used for sending a connection request and a distributed task request;
and the execution engine is used for receiving the distributed task request and executing the distributed task, and is also used for receiving a distributed task cancellation request and canceling the execution of the distributed task.
6. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the distributed task cancellation method of any one of claims 1 to 3 when the program is executed by the processor.
7. A non-transitory computer readable storage medium having stored thereon a computer program, which when executed by a processor implements a distributed task cancellation method according to any one of claims 1 to 3.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211576420.5A CN115580555B (en) | 2022-12-09 | 2022-12-09 | Distributed task cancellation method, device, system and electronic equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211576420.5A CN115580555B (en) | 2022-12-09 | 2022-12-09 | Distributed task cancellation method, device, system and electronic equipment |
Publications (2)
Publication Number | Publication Date |
---|---|
CN115580555A CN115580555A (en) | 2023-01-06 |
CN115580555B true CN115580555B (en) | 2023-07-28 |
Family
ID=84590071
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202211576420.5A Active CN115580555B (en) | 2022-12-09 | 2022-12-09 | Distributed task cancellation method, device, system and electronic equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN115580555B (en) |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103401712A (en) * | 2013-07-31 | 2013-11-20 | 北京华易互动科技有限公司 | Content distribution based intelligent high-availability task processing method and system |
CN107086940A (en) * | 2017-03-31 | 2017-08-22 | 北京奇艺世纪科技有限公司 | A kind of single service operation method and device |
Family Cites Families (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US9772887B2 (en) * | 2008-06-02 | 2017-09-26 | Microsoft Technology Learning, LLC | Composable and cancelable dataflow continuation passing |
CN106603701A (en) * | 2016-12-29 | 2017-04-26 | 北京奇虎科技有限公司 | Method and device for sending message based on long connection platform |
CN114553936B (en) * | 2022-02-18 | 2024-01-30 | 北京达佳互联信息技术有限公司 | Connection method, device, electronic apparatus, and computer-readable storage medium |
-
2022
- 2022-12-09 CN CN202211576420.5A patent/CN115580555B/en active Active
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103401712A (en) * | 2013-07-31 | 2013-11-20 | 北京华易互动科技有限公司 | Content distribution based intelligent high-availability task processing method and system |
CN107086940A (en) * | 2017-03-31 | 2017-08-22 | 北京奇艺世纪科技有限公司 | A kind of single service operation method and device |
Also Published As
Publication number | Publication date |
---|---|
CN115580555A (en) | 2023-01-06 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US10649866B2 (en) | Method and apparatus for indirectly assessing a status of an active entity | |
JP5097671B2 (en) | Systems and methods for seamless host migration | |
CN105516640B (en) | A kind of detection method and system of video communication session exception | |
CN110266810B (en) | Message receiving method, device and storage medium based on MQTT protocol | |
US20080071914A1 (en) | Session control system | |
CN111083177A (en) | Cross-domain collaborative interaction method based on collaborative gateway | |
CN110691398A (en) | Network interaction method, system, equipment and storage medium of intelligent equipment | |
CN114328115A (en) | Cloud monitoring and edge operation and maintenance method and system | |
CN108092993B (en) | Network data transmission control method and system | |
CN107257496A (en) | A kind of live control method, device and mobile terminal | |
CN113301103B (en) | Data processing system, method and device | |
CN115580555B (en) | Distributed task cancellation method, device, system and electronic equipment | |
CN105554150A (en) | Network logging-in method and apparatus | |
CN112839106A (en) | Communication method and apparatus, electronic device, and medium | |
US9288277B2 (en) | Communication device, method for communication and relay system | |
CN111885203A (en) | Method for remote management based on CMSP | |
CN104378230A (en) | System and method for improving stability of Telnet server | |
CN114328216A (en) | Vulnerability mining method and device | |
CN113965495A (en) | Method and device for detecting activity of terminal application program, electronic equipment and storage medium | |
CN109905419A (en) | A kind of method and apparatus of data transmission | |
CN114363204A (en) | Request monitoring method, network device and storage medium | |
CN110890989A (en) | Channel connection method and device | |
CN105992177B (en) | Method, device and system for improving usability of mobile proxy server | |
CN112738187B (en) | Safe connection method and device of equipment, electronic equipment and storage medium | |
CN105045759B (en) | Control communication method of financial self-service equipment |
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 | ||
GR01 | Patent grant | ||
GR01 | Patent grant |