CN115580555A - Distributed task canceling method, device and system and electronic equipment - Google Patents

Distributed task canceling method, device and system and electronic equipment Download PDF

Info

Publication number
CN115580555A
CN115580555A CN202211576420.5A CN202211576420A CN115580555A CN 115580555 A CN115580555 A CN 115580555A CN 202211576420 A CN202211576420 A CN 202211576420A CN 115580555 A CN115580555 A CN 115580555A
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.)
Granted
Application number
CN202211576420.5A
Other languages
Chinese (zh)
Other versions
CN115580555B (en
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.)
Yunli Intelligent Technology Co ltd
Original Assignee
Yunli Intelligent Technology Co ltd
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 Yunli Intelligent Technology Co ltd filed Critical Yunli Intelligent Technology Co ltd
Priority to CN202211576420.5A priority Critical patent/CN115580555B/en
Publication of CN115580555A publication Critical patent/CN115580555A/en
Application granted granted Critical
Publication of CN115580555B publication Critical patent/CN115580555B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • 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
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements 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/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • 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
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • H04L67/143Termination or inactivation of sessions, e.g. event-controlled end of session
    • H04L67/145Termination 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
    • YGENERAL 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
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE 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/00Energy 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 canceling method, a distributed task canceling device, a distributed task canceling system and electronic equipment, and belongs to the technical field of data communication. The method comprises the following steps: monitoring a connection state of a long connection established with a client of a client terminal; 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 the distributed task corresponding to the disconnected long connection, and the distributed task cancellation request is used for indicating the execution engine to cancel execution of the distributed task. The method can cancel the distributed tasks in time in the process of executing the distributed tasks, thereby playing a role in saving execution engine resources.

Description

Distributed task canceling method, device and system and electronic equipment
Technical Field
The invention relates to the technical field of data communication, in particular to a distributed task canceling method, a distributed task canceling device, a distributed task canceling system and electronic equipment.
Background
In a distributed scenario, the start and execution of tasks are often distributed on each execution node, and after a complex distributed task is run, it takes a long time to process the complex task.
At present, a large amount of data (possibly higher than a server memory) is required to be returned after a complex distributed task is executed, which requires that an interface is gradually released in a data stream mode, while a general http protocol (short connection) interface has no characteristic of a connection state, which makes it difficult to cancel the complex task in the process of executing the complex task, and especially in a large data analysis and calculation scene, the task is difficult to cancel midway, which causes resource waste.
Disclosure of Invention
The invention provides a distributed task canceling method, a distributed task canceling device, a distributed task canceling system and electronic equipment, which are used for solving the defect that a complex distributed task in the prior art is difficult to cancel in the execution process and realizing the cancellation of the distributed task in the execution process of the complex distributed task.
The invention provides a distributed task canceling method, which comprises the following steps:
monitoring a connection state of a long connection established with a client of a 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 execution of the distributed task.
According to a distributed task canceling method provided by the present invention, before monitoring a connection state of a long connection with a client of a client terminal, the method further includes:
establishing a plurality of the long connections with the client based on a 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 the 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 a distributed task canceling method provided by the present invention, when it is monitored that the long connection is in a disconnected state, a distributed task canceling request is sent to an execution engine based on a distributed task corresponding to the disconnected long connection, where the distributed task canceling request is used to instruct the execution engine to cancel execution of the distributed task, and the method includes:
when the long connection is monitored to be in a disconnected state, acquiring a task ID corresponding to the distributed task request received through the long connection before disconnection;
sending a corresponding distributed task suspension request to the execution engine according to the task ID, wherein the distributed task suspension request is used for indicating the execution engine to suspend executing the distributed task corresponding to the task ID;
continuously monitoring the connection state of the long connection established with the client of the client terminal;
and 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 execution of 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 within 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 and execute the distributed task corresponding to the task ID.
According to a distributed task canceling method provided by the present invention, the acquiring a 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 the Session.
The present invention also provides a distributed task canceling device, including:
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 execution of the distributed task.
According to the distributed task canceling device provided by the invention, the distributed task canceling device further comprises:
a connection establishing module for establishing a plurality of the 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;
a second sending module, configured to send the distributed task requests to the execution engine, where the distributed task requests are used to instruct the execution engine to execute the distributed task.
The present invention also provides a distributed task cancellation system, including any one of the above described distributed task cancellation devices, further including:
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, which comprises a memory, a processor and a computer program stored on the memory and capable of running on the processor, wherein the processor executes the program to realize the distributed task cancellation method.
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 one of the above.
The present invention also provides a computer program product comprising a computer program which, when executed by a processor, implements the distributed task cancellation method as described in any one of the above.
According to the distributed task canceling method, the distributed task canceling device, the distributed task canceling system and the electronic equipment, the heartbeat of the client is monitored in a mode of establishing long connection with the client which issues the distributed task, so that the heartbeat can be known in time when the long connection is disconnected, a task canceling request is sent to the execution engine to cancel execution of the distributed task, the distributed task can be canceled in time in the execution process of the distributed task, and therefore the effect of saving execution engine resources is achieved.
Drawings
In order to more clearly illustrate the present invention or the technical solutions in the prior art, the drawings used in the embodiments or the description of the prior art will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and other drawings can be obtained by those skilled in the art without creative efforts.
FIG. 1 is a schematic flow diagram of a distributed task cancellation method provided by the present invention;
FIG. 2 is a second flowchart of the distributed task cancellation method according to the present invention;
FIG. 3 is a schematic flowchart of a distributed task cancellation method after a disconnection state is monitored according to the present invention;
FIG. 4 is a schematic structural diagram of a distributed task cancellation apparatus provided in the present invention;
FIG. 5 is a second schematic structural diagram of a distributed task cancellation apparatus provided in the present invention;
FIG. 6 is a schematic structural diagram of a distributed task cancellation system provided by the present invention
Fig. 7 is a schematic structural diagram of an electronic device provided by the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention clearer, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings, and it is obvious that the described embodiments are some, but not all embodiments of the present invention. All other embodiments, which can be obtained by a person skilled in the art without inventive step based on the embodiments of the present invention, are within the scope of protection of the present 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: 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 the distributed task corresponding to the disconnected long connection, and the distributed task cancellation request is used for indicating the execution engine to cancel execution of the distributed task.
Specifically, a long connection means that multiple data packets can be continuously transmitted over one connection, and during the connection holding period, if no data packet is transmitted, a link detection packet needs to be transmitted in both directions. In the process of executing the distributed task 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. When the connection state of the long connection is monitored to be in the disconnection state, the connection state indicates that the 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 any more.
In order to cancel the distributed task which does not need to be executed continuously, a distributed task cancellation request needs to be sent to the execution engine, so that the execution engine cancels the distributed task issued by the client through the long connection before the long connection is disconnected.
For example, the disconnection state may be realized by actively disconnecting the long connection through the client, or may be realized by passively disconnecting the long connection through the client under special conditions 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 the distributed tasks.
According to the distributed task canceling method, the heartbeat of the client is monitored in a mode of establishing long connection with the client issuing the distributed task, so that the heartbeat can be known in time when the long connection is disconnected, a task canceling request is sent to the execution engine to cancel execution of the distributed task, the distributed task can be canceled in time in the distributed task execution process, and accordingly resources of the execution engine are saved.
In one embodiment, referring to fig. 2, before listening to the connection status of the long connection with the client of the client terminal, the method further includes:
s201: establishing a plurality of the 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: sending a plurality of the 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, the method further includes establishing a plurality of long connections with the client, where the long connections are established based on connection requests of the client, and when a 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, for example, when 5 distributed task requests need to be issued, the user needs to establish 5 long connections to issue the 5 distributed task requests respectively.
Illustratively, the long connection is implemented through a Websocket interface or a Socket interface. WebSocket is a protocol for full-duplex communication over a single TCP connection that facilitates data exchange between a client and a server, 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 persistent connection, namely long connection, can be directly established between the browser and the server, and bidirectional data transmission is carried out. Socket interface is a set of interface used to communicate between different devices and different processes.
When receiving a plurality of distributed task requests sent by a client, task IDs of the distributed task requests need to be stored, so that after a long connection is disconnected, the task IDs of the distributed tasks can be known based on the long connection sending the distributed task requests. Illustratively, the task ID may be the Sq1 execution handle of the record.
After receiving the distributed task requests, sending the received distributed task requests sent by the client to an execution engine, so that the execution engine can execute the corresponding distributed tasks.
In one embodiment, referring to fig. 3, when it is monitored that the long connection is in a disconnected state, sending 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 execution of the distributed task, where the method includes:
s301: and when the long connection is monitored to be in a disconnected 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 the 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 long connection is disconnected may not need to be executed any more.
At this time, it is necessary to know which long connection is in the disconnected state.
It can be understood that, after knowing which long connection is in the disconnected state, the task ID corresponding to the distributed task request sent before the disconnection of the long connection is acquired for the disconnected long connection.
S302: and sending a corresponding distributed task suspension request to the execution engine according to the task ID, wherein the distributed task suspension request is used for indicating the execution engine to suspend executing the distributed task corresponding to the task ID.
And sending a suspension request of the distributed task corresponding to the task ID to an execution engine according to the task ID obtained in the step, and suspending the execution of the distributed task corresponding to the task ID by the execution engine according to the suspension 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: and 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 the execution of the distributed task corresponding to the task ID.
Illustratively, the preset time is preset according to a task requirement or a user requirement, and the preset time is a time period, for example, 30 seconds, 1 minute, five minutes, and the like, and is not limited specifically herein.
And when the long connection is continuously disconnected in the monitoring process of one minute, sending a cancellation request of the distributed task corresponding to the task ID to the 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, so that the continuous execution of the distributed task is prevented, and the resources of the execution engine are saved.
The method does not cancel the distributed task when the long connection is disconnected, but cancels the distributed task when the long connection is disconnected for a long time after monitoring for a period of time, thereby reserving the process of the distributed task under the condition that the long connection is disconnected for a short time due to network instability.
In one embodiment, the distributed task cancellation method further includes:
and when the long connection is in the connection state again within 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 and execute the distributed task corresponding to the task ID.
Illustratively, the preset time is preset according to a task requirement or a user requirement, and the preset time is a time period, for example, 30 seconds, 1 minute, five minutes, and the like, and is not limited specifically herein. The method comprises the steps that after a long connection established with a client side of a client terminal is disconnected, the preset time is monitored continuously, and if the long connection is in a connection state again within the preset time, a distributed task recovery request can be sent to an execution engine, so that the execution engine can recover to execute the distributed task.
According to the method, under the condition that the long connection is disconnected for a short time due to poor network conditions, the execution of the distributed tasks can be quickly recovered after the long connection is recovered, the tasks do not need to be restarted, and resources of an execution engine are saved.
In an embodiment, the obtaining a 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 the Session.
In particular, session is a special object created by the server to save the user state.
The distributed task canceling device provided by the present invention is 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 in correspondence with each other. The distributed task canceling device comprises:
a monitoring module 401, configured to monitor a connection state of a long connection established with a client of a client terminal;
a first sending module 402, configured to send a distributed task cancellation request to an execution engine based on a distributed task corresponding to the disconnected long connection when it is monitored that the long connection is in a disconnected state, where the distributed task cancellation request is used to instruct the execution engine to cancel execution of the distributed task.
Specifically, a long connection means that multiple data packets can be continuously transmitted over one connection, and during the connection holding period, if no data packet is transmitted, a link detection packet needs to be transmitted by two parties. In the process of executing the distributed task by the execution engine, the monitoring module 401 needs to monitor the connection state of the long connection established with the client in real time, and may monitor the connection state of the long connection through, for example, the after connection closed monitoring logic. When the connection state of the long connection is monitored to be in the disconnection state, the connection state indicates that the 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 any more.
In order to cancel the distributed task that does not need to be executed continuously, 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 delivered by the client through the long connection before the long connection is disconnected.
For example, the above-mentioned disconnection state may be implemented such that the client disconnects the long connection through active operation, or the client disconnects the long connection passively based on special conditions 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 the distributed tasks. The distributed task canceling device may be a business service layer, and includes the foregoing listening module 401 and the first sending module 402.
The distributed task cancellation device provided by the invention monitors the heartbeat of the client by establishing the long connection with the client which issues the distributed task, so that the heartbeat can be known in time 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 cancelled in time 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. 5, the distributed task canceling device further includes:
a connection establishing 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 the distributed task requests to the execution engine, where the distributed task requests are used to instruct the execution engine to execute the distributed tasks.
Specifically, before monitoring the connection state of the long connection with the client, the method further includes establishing a plurality of long connections with the client, where the long connections are established based on connection requests of the client through the connection establishment module 501, and when a 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 a long connection is disconnected, the task IDs of the distributed tasks can be known based on the long connection sending the distributed task requests. Illustratively, the task ID may be the Sq1 execution handle of the record.
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 canceling system provided by the present invention is described below with reference to fig. 6, where the system includes the distributed task canceling device according to any of the above embodiments, and the system further includes:
the client terminal 601 is configured to send a connection request and a distributed task request.
And the execution engine 603 is configured to receive the distributed task request and execute the distributed task, and is further configured to receive a distributed task cancellation request and cancel execution of the distributed task.
Specifically, the distributed task cancellation device 602 is connected to the client of the client terminal 601 and the execution engine 603, respectively, where a long connection is established with the client of the client terminal 601. The execution engine 603 is configured to receive a request issued by the distributed task canceling device 602 and execute the request, and the execution engine 603 may include a plurality of execution servers configured to execute the distributed task.
The distributed task canceling system provided by the invention monitors the heartbeat of the client in a mode of establishing long connection with the client issuing the distributed task, so that the heartbeat can be known in time 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 canceled in time in the execution process of the distributed task, and the effect of saving the resources of the execution engine is achieved.
Fig. 7 illustrates a physical structure diagram of an electronic device, and as shown in fig. 7, the electronic device may include: a processor (processor) 710, a communication Interface (Communications Interface) 720, a memory (memory) 730, and a communication bus 740, wherein the processor 710, the communication Interface 720, and the memory 730 communicate with each other via the communication bus 740. Processor 710 may call logical instructions in memory 730 to perform a distributed task cancellation method comprising: monitoring the connection state of the long connection established with the client; 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 disconnected distributed task corresponding to the long connection, so that the execution engine cancels execution of the distributed task.
In addition, the logic instructions in the memory 730 can be implemented in the form of software functional units and stored in a computer readable storage medium when the software functional units are sold or used as independent products. Based on such understanding, the technical solution of the present invention or a part thereof which substantially contributes to the prior art may be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute 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), a magnetic disk, or an optical disk, and various media capable of storing program codes.
In another aspect, the present invention also provides a computer program product, the computer program product including a computer program, the computer program being storable on a non-transitory computer-readable storage medium, the computer program being capable of executing, when executed by a processor, the distributed task cancellation method provided by the above methods, the method including: monitoring the connection state of the long connection established with the client; 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 disconnected distributed task corresponding to the long connection, so that the execution engine cancels execution of the distributed task.
In yet another aspect, the present invention also provides a non-transitory computer-readable storage medium, on which a computer program is stored, the computer program being implemented by a processor to perform the distributed task cancellation method provided by the above methods, the method including: monitoring the connection state of the long connection established with the client; 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 disconnected distributed task corresponding to the long connection, so that the execution engine cancels execution of the distributed task.
The above-described embodiments of the apparatus are merely illustrative, and the units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one position, or may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware. Based on the understanding, the above technical solutions substantially or otherwise contributing to the prior art may be embodied in the form of a software product, which may be stored in a computer-readable storage medium, such as ROM/RAM, magnetic disk, optical disk, etc., and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method according to the various embodiments or some parts of the embodiments.
Finally, it should be noted that: the above examples are only intended to illustrate the technical solution of the present invention, and not to limit it; although the present 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 solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.

Claims (10)

1. A distributed task cancellation method, comprising:
monitoring a connection state of a long connection established with a client of a client terminal;
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 the distributed task corresponding to the disconnected long connection, and the distributed task cancellation request is used for indicating the execution engine to cancel execution of the distributed task.
2. The distributed task cancellation method according to claim 1, wherein, before listening to a connection status of a long connection with a client of the client terminal, the method further comprises:
establishing a plurality of the long connections with the client based on a 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 the distributed task requests to the execution engine, wherein the distributed task requests are used for instructing the execution engine to execute the distributed tasks.
3. The distributed task cancellation method according to claim 2, wherein when it is monitored that the long connection is 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 execution of the distributed task, and includes:
when the long connection is monitored to be in a disconnected state, acquiring a task ID corresponding to the distributed task request received through the long connection before disconnection;
sending a corresponding distributed task suspension request to the execution engine according to the task ID, wherein the distributed task suspension request is used for indicating the execution engine to suspend executing the distributed task corresponding to the task ID;
continuously monitoring the connection state of the long connection established with the client of the client terminal;
and 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 execution of the distributed task corresponding to the task ID.
4. The distributed task cancellation method according to claim 3, wherein the distributed task cancellation method further includes:
and when the long connection is in the connection state again within 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.
5. The distributed task canceling method according to claim 3, wherein the obtaining of the task ID corresponding to the distributed task request received via 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 the Session.
6. A distributed task cancellation apparatus, 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 fact that the long connection is in the disconnected state is monitored, wherein the distributed task cancellation request is used for indicating the execution engine to cancel execution of the distributed task.
7. The distributed task cancellation apparatus according to claim 6, further comprising:
a connection establishing module for establishing a plurality of said long connections with said client based on a connection request of said 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;
a second sending module, configured to send the distributed task requests to the execution engine, where the distributed task requests are used to instruct the execution engine to execute the distributed task.
8. A distributed task cancellation system comprising the distributed task cancellation apparatus of claim 6 or 7, 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.
9. 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 5 when executing the program.
10. A non-transitory computer-readable storage medium having stored thereon a computer program, wherein the computer program, when executed by a processor, implements the distributed task cancellation method according to any one of claims 1 to 5.
CN202211576420.5A 2022-12-09 2022-12-09 Distributed task cancellation method, device, system and electronic equipment Active CN115580555B (en)

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 true CN115580555A (en) 2023-01-06
CN115580555B 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 (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090300591A1 (en) * 2008-06-02 2009-12-03 Microsoft Corporation Composable and cancelable dataflow continuation passing
CN103401712A (en) * 2013-07-31 2013-11-20 北京华易互动科技有限公司 Content distribution based intelligent high-availability task processing method and system
CN106603701A (en) * 2016-12-29 2017-04-26 北京奇虎科技有限公司 Method and device for sending message based on long connection platform
CN107086940A (en) * 2017-03-31 2017-08-22 北京奇艺世纪科技有限公司 A kind of single service operation method and device
CN114553936A (en) * 2022-02-18 2022-05-27 北京达佳互联信息技术有限公司 Connection method, connection device, electronic equipment and computer-readable storage medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090300591A1 (en) * 2008-06-02 2009-12-03 Microsoft Corporation Composable and cancelable dataflow continuation passing
CN103401712A (en) * 2013-07-31 2013-11-20 北京华易互动科技有限公司 Content distribution based intelligent high-availability task processing method and system
CN106603701A (en) * 2016-12-29 2017-04-26 北京奇虎科技有限公司 Method and device for sending message based on long connection platform
CN107086940A (en) * 2017-03-31 2017-08-22 北京奇艺世纪科技有限公司 A kind of single service operation method and device
CN114553936A (en) * 2022-02-18 2022-05-27 北京达佳互联信息技术有限公司 Connection method, connection device, electronic equipment and computer-readable storage medium

Also Published As

Publication number Publication date
CN115580555B (en) 2023-07-28

Similar Documents

Publication Publication Date Title
US7958247B2 (en) HTTP push to simulate server-initiated sessions
JP5097671B2 (en) Systems and methods for seamless host migration
CN107135279B (en) Method and device for processing long connection establishment request
CN105516640B (en) A kind of detection method and system of video communication session exception
CN107528891B (en) Websocket-based automatic clustering method and system
CN106685748B (en) Heartbeat information sending method, server and terminal
US20150071143A1 (en) Method and apparatus for managing pdn connection
EP2119184A1 (en) Virtualization and high availability of network connections
CN111083177B (en) Cross-domain collaborative interaction method based on collaborative gateway
CN116048538B (en) Service grid deployment method and device for DPU
US20080071914A1 (en) Session control system
CN1980232A (en) Telnet session maitenance method, telnet proxy and computer network system
CN105554150A (en) Network logging-in method and apparatus
CN113783961A (en) Remote terminal management method and device, computer equipment and storage medium
CN115580555B (en) Distributed task cancellation method, device, system and electronic equipment
CN109067509B (en) Distributed node signaling transmission method and system, shared computing node and signaling gateway
CN114691364A (en) Future community digital twin engine flexible deployment system
CN114328216A (en) Vulnerability mining method and device
CN113965495A (en) Method and device for detecting activity of terminal application program, electronic equipment and storage medium
CN114363899A (en) Agent isolation-based 5G network element receiving and managing method and system
JP2581476B2 (en) Information processing device
CN114363204A (en) Request monitoring method, network device and storage medium
CN113301103A (en) Data processing system, method and device
CN105992177B (en) Method, device and system for improving usability of mobile proxy server
JPH10116257A (en) Decentralized media processing server, and communication network using the same

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