CN111338797B - Task processing method, device, electronic equipment and computer readable storage medium - Google Patents

Task processing method, device, electronic equipment and computer readable storage medium Download PDF

Info

Publication number
CN111338797B
CN111338797B CN202010102459.8A CN202010102459A CN111338797B CN 111338797 B CN111338797 B CN 111338797B CN 202010102459 A CN202010102459 A CN 202010102459A CN 111338797 B CN111338797 B CN 111338797B
Authority
CN
China
Prior art keywords
task
processed
processing
tasks
node
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
Application number
CN202010102459.8A
Other languages
Chinese (zh)
Other versions
CN111338797A (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.)
Wanghai Kangxin Beijing Technology Co ltd
Original Assignee
Wanghai Kangxin Beijing 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 Wanghai Kangxin Beijing Technology Co ltd filed Critical Wanghai Kangxin Beijing Technology Co ltd
Priority to CN202010102459.8A priority Critical patent/CN111338797B/en
Publication of CN111338797A publication Critical patent/CN111338797A/en
Application granted granted Critical
Publication of CN111338797B publication Critical patent/CN111338797B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • 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
    • 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/54Interprogram communication
    • G06F9/546Message passing systems or structures, e.g. queues
    • 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)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The invention provides a task processing method, a device, electronic equipment and a computer readable storage medium, wherein the method comprises the following steps: receiving task acquisition requests sent by all service nodes, wherein the task processing requests comprise node identifiers of the service nodes; based on the identifiers of the nodes, acquiring target tasks to be processed corresponding to the service nodes from the tasks to be processed stored in the task storage space; and sending each target task to be processed to each corresponding service node so that each service node sends each target task to be processed to the corresponding task processing node according to the task identification in each target task to be processed. In the scheme, the service node actively transmits the task acquisition request to the server, and the service node transmitting the request can transmit the target task to be processed to the corresponding task processing node in the service nodes corresponding to the task acquisition request, so that it is not required to determine which service node can process the task to be processed from a plurality of service nodes, and the data processing efficiency is improved.

Description

Task processing method, device, electronic equipment and computer readable storage medium
Technical Field
The present invention relates to the field of data processing technologies, and in particular, to a task processing method, a task processing device, an electronic device, and a computer readable storage medium.
Background
In the prior art, in an interactive service system, a corresponding service node is generally selected for a task to be processed, and in the first aspect, one service node is randomly selected from a plurality of service nodes, and the task to be processed is sent to the service node, so that the service node processes the task to be processed. Second, it is determined from a plurality of service nodes which service node can process the task to be processed, and then the task to be processed is sent to the service node capable of processing the task to be processed, so that the service node processes the task to be processed.
However, the following problems still exist based on the above manner, and in the first case, after a service node is randomly selected, the service node may not be able to process the task to be processed, and then the service node needs to be selected again, which affects the data processing efficiency. Second, it is necessary to determine which service node can process the task to be processed from a plurality of service nodes, thereby affecting the inefficiency of data processing.
Disclosure of Invention
The present invention aims to solve at least one of the above technical drawbacks and improve the data processing efficiency. The technical scheme adopted by the invention is as follows:
in a first aspect, the present invention provides a task processing method, including:
receiving task acquisition requests sent by all service nodes, wherein the task processing requests comprise node identifiers of the service nodes;
based on the identifiers of the nodes, acquiring target tasks to be processed corresponding to the service nodes from the tasks to be processed stored in the task storage space;
and sending each target task to be processed to each corresponding service node, so that each service node sends each target task to be processed to the corresponding task processing node according to the task identifier in each target task to be processed, wherein the task identifier comprises a task request end identifier and a task processing node identifier.
In an embodiment of the first aspect of the present invention, the task to be processed stored in the task storage space is obtained by:
receiving a task processing request of each task request end, wherein the task processing request comprises an initial task, and the initial task comprises a task identifier and task data;
generating a corresponding task to be processed from the initial task according to a designated message format, and storing the corresponding task to be processed in a task storage space;
The message format-designated task to be processed comprises a message header, a message body and a message tail, wherein the message header is used for representing task identifiers of all the tasks to be processed, the message body is used for representing task data of all the tasks to be processed, and the message tail is used for representing the current processing state of all the tasks to be processed.
In an embodiment of the first aspect of the present invention, if the task processing nodes corresponding to the task to be processed include at least two task processing nodes;
generating a corresponding task to be processed from the initial task according to a specified message format, including:
splitting an initial task into a corresponding number of subtasks based on the number of task processing nodes corresponding to the task to be processed, wherein each subtask comprises a subtask identifier and subtask data, and the subtask identifier comprises a task request end identifier and a processing node identifier of the task processing node corresponding to each subtask;
generating corresponding tasks to be processed according to the designated message format by each subtask;
the message header characterizes subtask identifiers of the subtasks, the message body characterizes subtask data of the subtasks, and the message tail characterizes the current processing state of the subtasks.
In an embodiment of the first aspect of the present invention, after storing the task to be processed in the specified message format in the task storage space, the method further includes:
Setting an initial mark of a lock state of each task to be processed, wherein the initial mark is in an unlocked state;
based on the identifiers of the nodes, acquiring target tasks to be processed corresponding to the service nodes from the tasks to be processed stored in the task storage space, wherein the target tasks to be processed comprise:
based on the identifiers of the nodes, acquiring the task to be processed with the lock state being the unlocked state from the task to be processed stored in the task storage space as a target task to be processed corresponding to each service node.
In an embodiment of the first aspect of the present invention, after sending each target task to be processed to each corresponding service node, the method further includes:
and updating the lock state of the target task to be processed from the unlocked state to the locked state.
In an embodiment of the first aspect of the present invention, if the task to be processed includes at least two sub-tasks having a hierarchical relationship, after storing the task to be processed in the task storage space in the specified message format, the method further includes:
setting initial identifiers of lock states of at least two subtasks corresponding to each task to be processed, wherein the initial identifier of the lock state of an upper subtask is an unlocked state, and the initial identifier of the lock state of a lower subtask is a locked state;
Based on the identifiers of the nodes, acquiring target tasks to be processed corresponding to the service nodes from the tasks to be processed stored in the task storage space, wherein the target tasks to be processed comprise:
based on the identifiers of the nodes, acquiring an upper-level subtask with an unlocked lock state from the tasks to be processed stored in the task storage space as a target task to be processed corresponding to each service node;
after receiving the processing completion identification of processing the upper-level subtask, the method further comprises:
and updating the locking state of the lower-level subtask corresponding to the upper-level subtask from the locking state to the unlocking state.
In an embodiment of the first aspect of the present invention, the current processing state includes a processing completion and an unprocessed completion, and when receiving processing success response information sent by the service node, the method further includes:
and updating the current processing state of the target task to be processed into processing completion.
In an embodiment of the first aspect of the present invention, after storing the task to be processed in the specified message format in the task storage space, the method further includes:
setting task types of each task to be processed, wherein the task types comprise single-instance tasks and non-single-instance tasks, the single-instance tasks refer to one task to be processed corresponding to one task processing node, and the non-single-instance tasks refer to one task to be processed corresponding to at least two task processing nodes;
If the target task to be processed is a single-instance task, deleting the target task to be processed when the current processing state of the target task to be processed is processing completion;
if the target task to be processed is a non-single-instance task, deleting the target task to be processed when the current processing states of at least two subtasks corresponding to the target task to be processed are processing completion.
In a second aspect, the present invention provides a task processing device, comprising:
the request acquisition module is used for receiving task acquisition requests sent by all the service nodes, and the task processing requests comprise node identifiers of the service nodes;
the task determining module is used for acquiring target tasks to be processed corresponding to each service node from the tasks to be processed stored in the task storage space based on the identifiers of the nodes;
the task processing module is used for sending each target task to be processed to each corresponding service node so that each service node can send each target task to be processed to the corresponding task processing node according to the task identifier in each target task to be processed, and the task identifier comprises a task request end identifier and a task processing node identifier.
In an embodiment of the second aspect of the present invention, the task to be processed stored in the task storage space summary is obtained by:
Receiving a task processing request of each task request end, wherein the task processing request comprises an initial task, and the initial task comprises a task identifier and task data;
generating a corresponding task to be processed from the initial task according to a designated message format, and storing the corresponding task to be processed in a task storage space;
the message format-designated task to be processed comprises a message header, a message body and a message tail, wherein the message header is used for representing task identifiers of all the tasks to be processed, the message body is used for representing task data of all the tasks to be processed, and the message tail is used for representing the current processing state of all the tasks to be processed.
In an embodiment of the second aspect of the present invention, if the task processing nodes corresponding to the task to be processed include at least two task processing nodes;
the task processing module is specifically used for generating a corresponding task to be processed according to a specified message format when the initial task is generated:
splitting an initial task into a corresponding number of subtasks based on the number of task processing nodes corresponding to the task to be processed, wherein each subtask comprises a subtask identifier and subtask data, and the subtask identifier comprises a task request end identifier and a processing node identifier of the task processing node corresponding to each subtask;
Generating corresponding tasks to be processed according to the designated message format by each subtask;
the message header characterizes subtask identifiers of the subtasks, the message body characterizes subtask data of the subtasks, and the message tail characterizes the current processing state of the subtasks.
In an embodiment of the second aspect of the present invention, after storing the task to be processed in the specified message format in the task storage space, the apparatus further includes:
the lock state setting module is used for setting initial identifiers of the lock states of the tasks to be processed, wherein the initial identifiers are in an unlocked state;
the task determining module is specifically configured to, when acquiring a target task to be processed corresponding to each service node from the tasks to be processed stored in the task storage space based on each node identifier:
based on the identifiers of the nodes, acquiring the task to be processed with the lock state being the unlocked state from the task to be processed stored in the task storage space as a target task to be processed corresponding to each service node.
In an embodiment of the second aspect of the present invention, the apparatus further comprises:
and the lock state updating module is used for updating the lock state of the target task to be processed from the unlocked state to the locked state after sending the target task to be processed to the corresponding service nodes.
In an embodiment of the second aspect of the present invention, if the task to be processed includes at least two sub-tasks having a hierarchical relationship, after storing the task to be processed in the task storage space in the specified message format, the apparatus further includes:
the subtask lock state setting module is used for setting initial identifiers of lock states of at least two subtasks corresponding to each task to be processed, wherein the initial identifier of the lock state of the upper subtask is an unlocked state, and the initial identifier of the lock state of the lower subtask is a locked state;
the task determining module is specifically configured to, when acquiring a target task to be processed corresponding to each service node from the tasks to be processed stored in the task storage space based on each node identifier:
based on the identifiers of the nodes, acquiring an upper-level subtask with an unlocked lock state from the tasks to be processed stored in the task storage space as a target task to be processed corresponding to each service node;
the apparatus further comprises:
and the subtask lock state updating module is used for updating the lock state of the lower subtask corresponding to the upper subtask from the locking state to the unlocking state after receiving the processing completion identification of the processed upper subtask.
In an embodiment of the second aspect of the present invention, the current processing state includes a processing completion and an unprocessed completion, and when receiving processing success response information sent by the service node, the apparatus further includes:
and the processing state updating module is used for updating the current processing state of the target task to be processed into processing completion.
In an embodiment of the second aspect of the present invention, the apparatus further comprises:
the task type setting module is used for setting task types of each task to be processed after the task to be processed in the appointed message format is stored in the task storage space, wherein the task types comprise single-instance tasks and non-single-instance tasks, the single-instance tasks refer to one task to be processed corresponding to one task processing node, and the non-single-instance tasks refer to one task to be processed corresponding to at least two task processing nodes;
the task processing module is used for deleting the target task to be processed when the target task to be processed is a single-instance task and the current processing state of the target task to be processed is processing completion; and deleting the target task to be processed when the target task to be processed is a non-single-case task and the current processing states of at least two subtasks corresponding to the target task to be processed are processed.
In a third aspect, the present invention provides an electronic device comprising:
a processor and a memory;
a memory for storing computer operating instructions;
a processor for performing the method as shown in any of the embodiments of the first aspect of the invention by invoking computer operating instructions.
In a fourth aspect, the present invention provides a computer readable storage medium storing at least one computer program loaded and executed by a processor to implement a method as shown in any embodiment of the first aspect of the invention.
The technical scheme provided by the embodiment of the invention has the beneficial effects that:
according to the task processing method, the device, the electronic equipment and the computer storage medium, the service node can actively send the task acquisition request to the server, when the task acquisition request sent by the service node is acquired, the service node sending the task acquisition request can process the task, and then the target task to be processed corresponding to the node identification can be acquired from the task to be processed stored in the task storage space based on the node identification of the service node, and then each target task to be processed is sent to each corresponding service node, so that each service node sends each target task to be processed to the corresponding task processing node according to the task identification of each target task to be processed, and each task processing node processes the corresponding task. According to the scheme, as the service nodes can actively send the task acquisition requests to the server, any one service node can send the target task to be processed to the corresponding task processing node in the service nodes corresponding to the task acquisition requests, and the determination of which service node can process the target task to be processed from a plurality of service nodes is not needed, so that the data processing efficiency can be improved.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings that are required to be used in the description of the embodiments of the present invention will be briefly described below.
FIG. 1 is a flow chart of a task processing method according to an embodiment of the present invention;
FIG. 2 is a message structure diagram of a message specifying a message format in an example provided by an embodiment of the present invention;
FIG. 3 is a schematic flow chart of processing tasks to be processed based on a cache server according to an example provided by the embodiment of the invention;
FIG. 4 is a flow chart of a task processing method according to an embodiment of the present invention;
FIG. 5 is a schematic diagram of a task processing device according to an embodiment of the present invention;
fig. 6 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
Embodiments of the present invention are described in detail below, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to like or similar elements or elements having like or similar functions throughout. The embodiments described below by referring to the drawings are exemplary only for explaining the technical solution of the present invention and are not to be construed as limiting the present invention.
As used herein, the singular forms "a", "an" and "the" are intended to include the plural forms as well, unless expressly stated otherwise, as understood by those skilled in the art. It will be further understood that the terms "comprises" and/or "comprising," when used in this specification, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof. It will be understood that when an element is referred to as being "connected" or "coupled" to another element, it can be directly connected or coupled to the other element or intervening elements may also be present. Further, "connected" or "coupled" as used herein may include wirelessly connected or wirelessly coupled. The term "and/or" as used herein includes all or any element and all combination of one or more of the associated listed items.
The following describes the technical scheme of the present invention and how the technical scheme of the present invention solves the above technical problems in detail with specific embodiments. The following embodiments may be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments. Embodiments of the present invention will be described below with reference to the accompanying drawings.
json (JavaScript Object Notation, JS object numbered musical notation) is a lightweight data exchange format.
In view of the above technical problems, a task processing method according to an embodiment of the present invention, as shown in a flow chart of a task processing method in fig. 1, may include:
step S110, receiving a task acquisition request sent by each service node, wherein the task processing request comprises a node identifier of the service node.
When the service node has the capability of processing the task, a task acquisition request is sent to a server (which may be called a management server), and accordingly, the management server receives the task acquisition request sent by the service node, or the management server may acquire the task acquisition request sent by the service node in a polling manner.
The service node may be a server in a service cluster, the node identifier is used for identifying the identity of the service node, one service node corresponds to one node identifier, and the node identifier may be a combination of at least two of a character, a number, a letter and a combination of at least two of the character, the number and the letter. It can be understood that the service node may be one service node or a plurality of service nodes, and if the service node is a plurality of service nodes, the corresponding acquired task processing requests are also a plurality of service nodes.
Step S120, based on the node identifiers, acquiring target tasks to be processed corresponding to the service nodes from the tasks to be processed stored in the task storage space.
The task storage space may be a storage space in a management server or a storage space in another server, which is not limited in the scheme of the present invention.
Step S130, each target task to be processed is sent to each corresponding service node, so that each service node sends each target task to be processed to each corresponding task processing node according to task identifiers in each target task to be processed, and the task identifiers comprise task request end identifiers and task processing node identifiers.
In the scheme of the invention, the service node distributes each target task to be processed to the corresponding task processing node mainly based on the acquired task identification of the target task to be processed, and one service node can correspond to a plurality of task processing nodes. The task identification comprises a task request end identification and a task processing node identification, wherein the task request end identification is used for identifying a task to be processed of which user terminal, and the task processing node identification is used for identifying which task processing node is required to process the target task to be processed. Wherein the task processing node may be a user terminal.
It may be understood that the task processing node corresponding to the target task to be processed may be one or a plurality of task processing nodes, that is, the target task to be processed may be a task processed by one task processing node, or may be a task processed by a plurality of task processing nodes. The task processing node may be a terminal of a user processing a target task to be processed.
In an alternative scheme of the invention, the processing capacity of each service node can be different, the performance can also be different, and if the number of service nodes sending the task acquisition requests is greater than the number of target tasks to be processed, the processing capacity of the service nodes and the service nodes with relatively better performance can be distributed to the corresponding task processing nodes for the target tasks to be processed.
According to the scheme in the embodiment of the invention, the service node can actively send the task acquisition request to the server, when the task acquisition request sent by the service node is acquired, the service node sending the task acquisition request can process the task, and then the target task to be processed corresponding to the node identification can be acquired from the task to be processed stored in the task storage space based on the node identification of the service node, and then the target tasks to be processed are sent to the corresponding service nodes, so that the service nodes can send the target tasks to be processed to the corresponding task processing nodes according to the task identification of the target tasks to be processed, and the task processing nodes can process the corresponding tasks. According to the scheme, as the service nodes can actively send the task acquisition requests to the server, any one service node can send the target task to be processed to the corresponding task processing node in the service nodes corresponding to the task acquisition requests, and the determination of which service node can process the target task to be processed from a plurality of service nodes is not needed, so that the data processing efficiency can be improved.
In the embodiment of the invention, the task to be processed which is summarized and stored in the task storage space is obtained by the following steps:
receiving a task processing request of each task request end, wherein the task processing request comprises an initial task, and the initial task comprises a task identifier and task data;
generating a corresponding task to be processed from the initial task according to a designated message format, and storing the corresponding task to be processed in a task storage space;
the message format-designated task to be processed comprises a message header, a message body and a message tail, wherein the message header is used for representing task identifiers of all the tasks to be processed, the message body is used for representing task data of all the tasks to be processed, and the message tail is used for representing the current processing state of all the tasks to be processed.
Wherein, the initial task refers to the task which is respectively and jointly completed by different people for achieving the specified target. The initial task comprises task identifications and task data of tasks required to be completed by different people, the task identifications are used for identifying the identities of the tasks, namely, which task request end initiates the tasks, which task processing nodes are required to process the tasks, one task corresponds to one task identification, the task identifications can be words, numbers, letters, combinations of at least two words, numbers and letters, and the specific expression forms of the task identifications are not limited and are all within the protection scope of the invention.
Tasks in business process data may be divided according to different task types, for example, according to people involved in the business process, and tasks handled by each person are divided into one type. The initial task data may also include a task type.
The task data of each task refers to specific corresponding task information of each task, for example, if the task is a leave task, the task data is specific content of the leave task. The current processing state refers to whether the task is processed by a corresponding person, and the current processing state may include processing completion and unprocessed completion, for example, if the leave-on task has been approved, the current processing state of the task is indicated as processing completion.
Generating corresponding tasks to be processed from the initial tasks according to the appointed message format, wherein the specific information of each initial task, the relation among the initial tasks and the current processing state of each initial task can be reflected by the information of the appointed message format, and when the target tasks to be processed are determined, the query efficiency can be improved based on the tasks to be processed of the appointed message format, and the target tasks to be processed corresponding to the node identifiers can be rapidly determined from the tasks to be processed.
The message with the appointed message format comprises three parts, namely a message header, a message body and a message tail, wherein the message header is used for defining the task identification of each task to be processed, the message body is used for defining the task data of each task to be processed, and the message tail is used for defining the current processing state of each task to be processed.
In the alternative scheme of the invention, the current processing state can be represented by a callback identifier, wherein the callback identifier refers to a processing result identifier obtained after a task is processed, and the processing result of the task can be represented by the identifier, such as processing completion, unprocessed completion and the like.
It should be noted that, the cache server (the server corresponding to the task storage space) and the management server may communicate with each other, that is, the management server may obtain the target task to be processed from the cache server. Alternatively, in an alternative aspect of the present invention, the management server and the cache server may be the same server.
In the embodiment of the invention, the message format is designated as an object numbered musical notation json format.
The json format is a lightweight data exchange format. The JSON format is easy for people to read and write, and the JSON format can effectively improve the network transmission efficiency.
In the embodiment of the invention, if the task processing nodes corresponding to the task to be processed comprise at least two task processing nodes;
generating the initial task into a corresponding task to be processed according to the designated message format can comprise:
splitting an initial task into a corresponding number of subtasks based on the number of task processing nodes corresponding to the task to be processed, wherein each subtask comprises a subtask identifier and subtask data, and the subtask identifier comprises a task request end identifier and a processing node identifier of the task processing node corresponding to each subtask;
generating corresponding tasks to be processed according to the designated message format by each subtask;
the message header characterizes subtask identifiers of the subtasks, the message body characterizes subtask data of the subtasks, and the message tail characterizes the current processing state of the subtasks.
The task to be processed can be split into sub-tasks corresponding to the number of task processing nodes, each sub-task corresponds to one task processing node, and accordingly task data corresponding to the task to be processed corresponds to sub-task data of each task processing node, namely one sub-task corresponds to one sub-task data.
In the scheme of the invention, the task processing node corresponding to one task to be processed comprises at least two task processing nodes, and the at least two subtasks corresponding to the task to be processed can be in parallel relationship or in hierarchical relationship.
In an embodiment of the present invention, after storing the task to be processed in the specified message format in the task storage space, the method further includes:
setting an initial mark of a lock state of each task to be processed, wherein the initial mark is in an unlocked state;
based on the identifiers of the nodes, acquiring the target task to be processed corresponding to each service node from the tasks to be processed stored in the task storage space can comprise:
based on the identifiers of the nodes, acquiring the task to be processed with the lock state being the unlocked state from the task to be processed stored in the task storage space as a target task to be processed corresponding to each service node.
The lock state is used for representing the lock state of the task to be processed, and the lock state is a locking state or an unlocking state. Each task to be processed can have a corresponding lock state, when the task to be processed is in the lock state, the task is not allowed to be processed, when the task is in the unlock state, the task is allowed to be processed, and the initial identification bit is in the lock state, so that each task to be processed in the initial task can be processed. When the target task to be processed corresponding to the node identifier is acquired based on the node identifier, the task to be processed with the lock state not locked corresponding to the node identifier can be used as the target task to be processed.
The initial mark may be a combination of at least two of a letter, a number and a letter, and the specific expression form of the initial mark is not limited in the invention and is within the protection scope of the invention. Different lock states may be indicated by different initial identifiers, for example, when an initial identifier is 1, the lock state is a locked state, and when an initial identifier is 0, the lock state is an unlocked state.
In an embodiment of the present invention, after sending each target task to be processed to each corresponding service node, the method may further include:
and updating the lock state of the target task to be processed from the unlocked state to the locked state.
After sending each target task to be processed to each corresponding service node, the management server indicates that the task processing node is processing the target task to be processed, and then the target task to be processed cannot be processed by other task processing nodes.
The mode of locking the task to be processed may be implemented by a scheme in the prior art, which is not described herein.
In an embodiment of the present invention, if the task to be processed includes at least two sub-tasks having a hierarchical relationship, after storing the task to be processed in the designated message format in the task storage space, the method may further include:
setting initial identifiers of lock states of at least two subtasks corresponding to each task to be processed, wherein the initial identifier of the lock state of the upper subtask is an unlocked state, and the initial identifier of the lock state of the lower subtask is a locked state.
If at least two subtasks corresponding to the task to be processed have a hierarchical relationship, the initial identification of the lock state of the upper subtask in the at least two subtasks is an unlocked state, and the initial identification of the lock state of the lower subtask is a locked state, when the task to be processed is processed, the lower subtask can be processed after the processing of the upper subtask is completed.
And, based on the identifiers of the nodes, acquiring the target task to be processed corresponding to each service node from the tasks to be processed stored in the task storage space may include:
And based on the identifiers of the nodes, acquiring an upper-level subtask with an unlocked lock state from the tasks to be processed stored in the task storage space as a target task to be processed corresponding to each service node.
When the target task to be processed is obtained, if the task to be processed includes at least two sub-tasks with hierarchical relationship, the lock state can be used as the target task to be processed of the unlocked upper sub-task, and after receiving the processing completion identification of the processed upper sub-task, the lock state of the lower sub-task corresponding to the upper sub-task is updated from the locking state to the unlocking state. So that the service node can acquire the subordinate subtasks, and the task processing node can process the subordinate subtasks.
In the embodiment of the invention, the current processing state comprises processing completion and unprocessed completion, and when receiving the processing success response information sent by the service node, the method further comprises the following steps:
and updating the current processing state of the target task to be processed into processing completion.
When the target task to be processed is processed by the task processing node, processing success response information is sent to the corresponding service node, the information indicates that the target task to be processed is completed, the service node sends the information to the management server, and when the management server receives the information, the current processing state of the target task to be processed is updated to be processed, and the target task to be processed does not need to be processed.
In an embodiment of the present invention, after storing the task to be processed in the specified message format in the task storage space, the method further includes:
setting task types of each task to be processed, wherein the task types comprise single-instance tasks and non-single-instance tasks, the single-instance tasks refer to one task to be processed corresponding to one task processing node, and the non-single-instance tasks refer to one task to be processed corresponding to at least two task processing nodes;
if the target task to be processed is a single-instance task, deleting the target task to be processed when the current processing state of the target task to be processed is processing completion;
if the target task to be processed is a non-single-instance task, deleting the target task to be processed when the current processing states of at least two subtasks corresponding to the target task to be processed are processing completion.
Wherein, a single instance task refers to a task which can be processed and completed by one task processing node, and a non-single instance task refers to a task which comprises at least two subtasks and can be processed and completed by at least two task processing nodes. If the target task to be processed is a single task, the management server can delete the target task to be processed after knowing that the target task to be processed is already processed, i.e. the current processing state of the target task to be processed is processing completion. If the task to be processed is a non-single-instance task, the target task to be processed is only indicated to be processed when the management server knows that at least two subtasks are processed to be completed, namely, the current processing states of the at least two subtasks are processed to be completed, and at this time, the target task to be processed can be deleted.
When the target task to be processed includes at least two subtasks, whether to delete the target task to be processed may be determined by the current processing state of the target task to be processed, or may be directly determined based on the current processing states of the at least two subtasks included in the target task to be processed. If the target task to be processed can be determined by the current processing state of the target task to be processed, the current processing state of the target task to be processed can be determined by the current processing states of the at least two subtasks, the current processing state of the target task to be processed is determined to be processing completion when the current processing states of the at least two subtasks are processing completion, otherwise, the current processing state of one subtask is unprocessed completion among the current processing states of the at least two subtasks, and the current processing state of the target task to be processed is unprocessed completion.
As an example, the target task to be processed is a single task, and the single task is a leave task that needs to be approved by the teacher a, and after the leave task is approved by the teacher a, the management server receives that the current processing state of the target task to be processed is processing completion, and then the task can be deleted. The task to be processed is a non-single-case task, the non-single-case task is a leave-on task requiring simultaneous approval by a teacher A and a teacher B, namely, the task is indicated to be processed when the approval by the teacher A and the teacher B passes, and if only one of the teachers is approved, the current processing state of the task is not processed. After the lead A and the lead B pass the leave task, the management server receives the current processing state of the target task to be processed as processing completion, and at the moment, the leave task can be deleted.
The current processing state can be represented by a processing completion identifier, the processing completion identifier can be a combination of at least two of a character, a number and a letter, and the specific expression form of the processing completion identifier is not limited in the invention and is within the protection scope of the invention.
In the embodiment of the present invention, if the target task to be processed is not processed by the task processing node within the set time period, the method may further include:
and sending a prompt message to a task processing node corresponding to the task identifier based on the task identifier of the target task to be processed.
The task processing node may be a terminal device of a user, such as a mobile phone, a computer, etc., that processes the target task to be processed. One service node may manage a plurality of task processing nodes correspondingly.
The set duration may be configured based on actual requirements, for example, 1 day, and when the user does not process the target task to be processed in one day, a prompt message is sent to the terminal device of the user, so as to remind the user to process the task to be processed in time.
The following students select lessons as application scenes, and the task processing method of the invention is described with reference to fig. 2 to 4:
Based on the initial task corresponding to the course selection, generating a corresponding task to be processed according to a specified information format, wherein the task to be processed in a specified message format comprises a message header, a message body and a message tail. The initial task comprises a task identifier (which can be called as basic attribute information) and task data; in this example, each initial task refers to a teacher approval task corresponding to each course.
The task data includes flow data, node data, and task information (task data shown in the figure). The process data may specifically refer to a course selection notification sent to the student terminal, where the notification may include content related to course selection, for example, a time range of a selectable course, information of a teacher corresponding to each course, and the like. Node data refers to course related information, such as course identification, and a course may correspond to a node data. The task information refers to a task corresponding to each course, for example, an approval task of a teacher, one course may correspond to an approval task of a plurality of teachers, and the plurality of approval tasks may also be cascaded tasks, that is, each task is performed based on an approval result of a previous stage task, after the previous stage approval, an approval process of a next stage task may be performed, and through the approval task, the teacher may approve whether a student may select the course.
The message header is used for defining task identification (task request end identification and task processing node identification) of the message (task), and also can be used for defining task type identification, lock state of task to be processed and child node. The child nodes are used for identifying flow nodes corresponding to each task to be processed, for example, flow nodes initiating course selection, and in the flow nodes, course selection notification needs to be sent to terminals of all students. And a course selecting flow node for students, wherein the students can select courses which the students want to select based on the node data. And the corresponding flow node is approved by the course, and at the flow node, the teacher can approve the course selected by the student, namely whether the student agrees to select the course.
In this example, the tasks to be processed may be cascaded together by a lock state (the locking state shown in fig. 2), i.e., the lock state corresponding to the previous stage flow node controls the lock state corresponding to the next stage flow node, and each flow node may have a corresponding lock state. As shown in fig. 2, each flow node corresponding to each task to be processed has a corresponding lock, each lock has a corresponding lock state, the lock corresponding to the flow data is a flow lock, the lock corresponding to the node data is a node lock, and the lock corresponding to the task information is a task lock. The lock state comprises a locked state and an unlocked state, when the lock state of a certain flow node is the locked state, the task corresponding to the flow node is processed or is being processed, and when the lock state of the certain flow node is the unlocked state, the task corresponding to the flow node to be processed is not processed. For example, after the course selection notification is transmitted to the terminals of the respective students, the flow lock corresponding to the flow data is in a locked state.
The message body is used to define the content to be processed (task data) of the task to be processed, and the content to be processed refers to the task data.
The message tail is used for defining the current processing state of the task to be processed, the current processing state can be represented by a callback identifier, the callback identifier refers to a processing result obtained after one task to be processed is processed, the processing result of the task to be processed can be represented by the callback identifier, for example, the processing is completed, the task to be processed is not processed yet, if the callback identifier represents that the processing is completed, the processing of the next-stage task can be performed, and if the callback identifier represents that the processing is not processed yet, a message for reminding the task to be processed can be sent to the terminal equipment of a user (a guide operator) corresponding to the task processing node corresponding to the task to be processed, so that the user can process the task in time based on the message for reminding the task to be processed.
When the process is running, for example, when the teaching task initiates a course selection process, a task to be processed in the above specified message format (in this example, the specified message format is JSON format) is constructed according to the process tree structure, and the task to be processed in the JSON format is stored in a cache server (a server corresponding to the task storage space) (corresponding to the process message (task to be processed) constructed according to the format shown in fig. 4 is stored in the cache server). Based on the above-described tasks to be processed in the specified message format, the time sequence between each task to be processed can be known.
Based on the above-described scheme, the service node (background service, service 1, service 2, and service 3 shown in fig. 3 and 4) may initiate a task acquisition request to the cache server, and the service node that initiates the task acquisition request may process a task to be processed, where the task to be processed may be a task of a teacher to approve a student to select a class.
When the management server receives a task acquisition request sent by at least one service node, it may first determine whether there are tasks to be processed (to-be-processed tasks) based on the lock state corresponding to the message header of each to-be-processed task, that is, the lock state is an unlocked state to-be-processed task, if there are to-be-processed tasks in the unlocked state to-be-processed tasks, the management server may acquire target to-be-processed tasks corresponding to each service node from the to-be-processed tasks stored in the task storage space, and send each target to each corresponding service node (corresponding to the asynchronous message processing attempt acquisition message shown in fig. 4), so that each service node sends each target to-be-processed task to the corresponding task processing node according to the task identifier in each target to-be-processed task.
After each target task to be processed is sent to each corresponding service node, the lock state of the task to be processed is updated from the unlocked state to the locked state. The target pending task is being processed by the lock state (the lock state is changed corresponding to the acquire message shown in fig. 3, the message shown in fig. 4 is locked).
After the task processing node processes the target task to be processed in the unlocked state, a callback identifier (corresponding to the message body resolved according to the tree json structure and shown in fig. 4, and a message (callback identifier)) is sent to a corresponding service node, through the identifier, the management server can know the current processing state of the target task to be processed, for example, the processing is completed, the task is not yet processed, if the identifier indicates that the processing is completed, and the target task to be processed contains at least two subtasks with a hierarchical relationship, the callback identifier is an identifier corresponding to an upper subtask, the management server can select a lower subtask of the target task to be processed, if the callback identifier indicates that the callback identifier is not yet processed, the management server can send a message for reminding the task to be processed to the terminal device of the user (a guide) corresponding to the target task, so that the user can process the task in time based on the message of the reminding task to be processed. The message body can be analyzed according to the tree-shaped JSON structure, the specific content of the target task to be processed is determined, and a callback identifier is returned after the task to be processed is processed.
After the task processing node processes the target task to be processed in the unlocked state, a callback identifier is sent to the corresponding service node, after receiving the identifier, the management server can delete the target task to be processed (corresponding to the delete message shown in fig. 4) based on the message type (task type) of the target task to be processed, where the message type is a single-instance message (may be called a single-instance task) or a non-single-instance message (may be called a non-single-instance task), if the message type is a single-instance message, after the target task to be processed is processed, i.e. after the management server receives the callback identifier. Then, it is determined whether or not this target task to be processed has a cascade of lower-level tasks (corresponds to whether or not the lower-level associated lock is unlocked as shown in fig. 4), and if not, the flow is ended, and if so, the lower-level Guan Liansuo is unlocked (the lock state corresponding to the lower-level task is changed to the unlocked state) (corresponds to the unlock child node as shown in fig. 4), so that the lower-level task (corresponds to the acquire lock (the lock state corresponding to the lower-level task is changed to the unlocked state) and the message (the lower-level task) are processed. The management server can re-receive the task acquisition request sent by the service node, and repeat the above process to process the subordinate task.
If the message is a non-single case message, when one task processing node finishes processing the upper sub-task in the target task to be processed, the processing of the lower sub-task corresponding to the target task to be processed is required to be completed (the processing of the waiting message shown in fig. 4 is completed), that is, after at least two task processing nodes corresponding to the target task to be processed all process the corresponding sub-tasks, the processing of the target task to be processed is completed, and the target task to be processed can be deleted. Specifically, the message (task to be processed) may be processed according to the message header and the message body, and the current processing state of the target task to be processed (task to be processed) may be updated according to the message tail, that is, when the processing of the upper subtasks corresponding to the target task to be processed is completed, a callback identifier (corresponding to the service callback cache server after processing shown in fig. 4) is returned to the corresponding service node. At this time, this means that the upper sub-task processing is completed. After the processing of the upper subtask is completed, it can also be determined whether the upper subtask has a cascade of lower subtasks to process the lower subtask.
And based on the processing flow of the target task to be processed, ending the whole flow until all subtasks related in the target task to be processed are processed by the task processing node.
It will be appreciated that the task processing request may be a concurrent request, i.e. a plurality of task processing requests may be processed simultaneously by the present solution.
Based on the same principle as the method shown in fig. 1, there is also provided a service request processing apparatus 20 in an embodiment of the present invention, and as shown in fig. 5, the service request processing apparatus 20 may include: a request acquisition module 210, a task determination module 220, and a task processing module 230, wherein,
a request acquisition module 210, configured to receive a task acquisition request sent by each service node, where the task processing request includes a node identifier of the service node;
the task determining module 220 is configured to obtain, based on the identifiers of the nodes, a target task to be processed corresponding to each service node from the tasks to be processed stored in the task storage space;
the task processing module 230 is configured to send each target task to be processed to each corresponding service node, so that each service node sends each target task to be processed to the corresponding task processing node according to a task identifier in each target task to be processed, where the task identifier includes a task request end identifier and a task processing node identifier.
According to the scheme, the service node can actively send a task acquisition request to the server, when the task acquisition request sent by the service node is acquired, the service node sending the task acquisition request can process the task, and then the target task to be processed corresponding to the node identification can be acquired from the task to be processed stored in the task storage space based on the node identification of the service node, and then the target tasks to be processed are sent to the corresponding service nodes, so that the service nodes can send the target tasks to be processed to the corresponding task processing nodes according to the task identification of the target tasks to be processed, and the task processing nodes can process the corresponding tasks. According to the scheme, as the service nodes can actively send the task acquisition requests to the server, any one service node can send the target task to be processed to the corresponding task processing node in the service nodes corresponding to the task acquisition requests, and the determination of which service node can process the target task to be processed from a plurality of service nodes is not needed, so that the data processing efficiency can be improved.
Optionally, the task storage space gathers stored tasks to be processed by:
receiving a task processing request of each task request end, wherein the task processing request comprises an initial task, and the initial task comprises a task identifier and task data;
generating a corresponding task to be processed from the initial task according to a designated message format, and storing the corresponding task to be processed in a task storage space;
the message format-designated task to be processed comprises a message header, a message body and a message tail, wherein the message header is used for representing task identifiers of all the tasks to be processed, the message body is used for representing task data of all the tasks to be processed, and the message tail is used for representing the current processing state of all the tasks to be processed.
Optionally, if the task processing node corresponding to the task to be processed includes at least two task processing nodes;
the task processing module is specifically used for generating a corresponding task to be processed according to a specified message format when the initial task is generated:
splitting an initial task into a corresponding number of subtasks based on the number of task processing nodes corresponding to the task to be processed, wherein each subtask comprises a subtask identifier and subtask data, and the subtask identifier comprises a task request end identifier and a processing node identifier of the task processing node corresponding to each subtask;
Generating corresponding tasks to be processed according to the designated message format by each subtask;
the message header characterizes subtask identifiers of the subtasks, the message body characterizes subtask data of the subtasks, and the message tail characterizes the current processing state of the subtasks.
Optionally, after storing the task to be processed in the specified message format in the task storage space, the apparatus further includes:
the lock state setting module is used for setting initial identifiers of the lock states of the tasks to be processed, wherein the initial identifiers are in an unlocked state;
the task determining module is specifically configured to, when acquiring a target task to be processed corresponding to each service node from the tasks to be processed stored in the task storage space based on each node identifier:
based on the identifiers of the nodes, acquiring the task to be processed with the lock state being the unlocked state from the task to be processed stored in the task storage space as a target task to be processed corresponding to each service node.
Optionally, the apparatus further comprises:
and the lock state updating module is used for updating the lock state of the target task to be processed from the unlocked state to the locked state after sending the target task to be processed to the corresponding service nodes.
Optionally, if the task to be processed includes at least two subtasks having a hierarchical relationship, after storing the task to be processed in the task storage space in the specified message format, the apparatus further includes:
the subtask lock state setting module is used for setting initial identifiers of lock states of at least two subtasks corresponding to each task to be processed, wherein the initial identifier of the lock state of the upper subtask is an unlocked state, and the initial identifier of the lock state of the lower subtask is a locked state;
the task determining module is specifically configured to, when acquiring a target task to be processed corresponding to each service node from the tasks to be processed stored in the task storage space based on each node identifier:
based on the identifiers of the nodes, acquiring an upper-level subtask with an unlocked lock state from the tasks to be processed stored in the task storage space as a target task to be processed corresponding to each service node;
the apparatus further comprises:
and the subtask lock state updating module is used for updating the lock state of the lower subtask corresponding to the upper subtask from the locking state to the unlocking state after receiving the processing completion identification of the processed upper subtask.
Optionally, the current processing state includes processing completion and unprocessed completion, and when receiving processing success response information sent by the service node, the apparatus further includes:
And the processing state updating module is used for updating the current processing state of the target task to be processed into processing completion.
Optionally, the apparatus further comprises:
the task type setting module is used for setting task types of each task to be processed after the task to be processed in the appointed message format is stored in the task storage space, wherein the task types comprise single-instance tasks and non-single-instance tasks, the single-instance tasks refer to one task to be processed corresponding to one task processing node, and the non-single-instance tasks refer to one task to be processed corresponding to at least two task processing nodes;
the task processing module is used for deleting the target task to be processed when the target task to be processed is a single-instance task and the current processing state of the target task to be processed is processing completion; and deleting the target task to be processed when the target task to be processed is a non-single-case task and the current processing states of at least two subtasks corresponding to the target task to be processed are processed.
The task processing device according to the embodiments of the present invention may execute a task processing method shown in fig. 1, and its implementation principle is similar, and actions executed by each module in the task processing device according to each embodiment of the present invention correspond to steps in the task processing method according to each embodiment of the present invention, and detailed functional descriptions of each module of the task processing device may be specifically referred to the descriptions in the corresponding task processing method shown in the foregoing, which are not repeated herein.
Based on the same principle as the task processing method in the embodiment of the present invention, the present invention provides an electronic device including a processor and a memory; a memory for storing operation instructions; and a processor for executing the method as shown in any one of the embodiments of the service request processing method of the present invention by calling the operation instruction.
Based on the same principle as the task processing method in the embodiments of the present invention, the present invention provides a computer-readable storage medium storing at least one instruction, at least one program, a code set, or an instruction set, which is loaded and executed by a processor to implement the method as shown in any one of the data processing methods of the present invention.
In an embodiment of the present invention, as shown in fig. 6, a schematic diagram of a structure of an electronic device 50 (e.g., a management server implementing the method shown in fig. 1) suitable for implementing an embodiment of the present invention is shown. The electronic device in the embodiment of the present invention may include, but is not limited to, a mobile terminal such as a mobile phone, a notebook computer, a digital broadcast receiver, a PDA (personal digital assistant), a PAD (tablet computer), a PMP (portable multimedia player), a car-mounted terminal (e.g., car navigation terminal), etc., and a stationary terminal such as a digital TV, a desktop computer, etc. The electronic device shown in fig. 6 is only an example and should not be construed as limiting the functionality and scope of use of the embodiments of the invention.
As shown in fig. 6, the electronic device 50 may include a processing means (e.g., a central processing unit, a graphics processor, etc.) 501, which may perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 502 or a program loaded from a storage means 508 into a Random Access Memory (RAM) 503. In the RAM 503, various programs and data required for the operation of the electronic device 30 are also stored. The processing device 501, the ROM 502, and the RAM 503 are connected to each other via a bus 504. An input/output (I/O) interface 505 is also connected to bus 504.
In general, the following devices may be connected to the I/O interface 505: input devices 506 including, for example, a touch screen, touchpad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; an output device 507 including, for example, a Liquid Crystal Display (LCD), a speaker, a vibrator, and the like; storage 508 including, for example, magnetic tape, hard disk, etc.; and communication means 509. The communication means 509 may allow the electronic device 50 to communicate with other devices wirelessly or by wire to exchange data. While fig. 4 shows an electronic device 50 having various means, it is to be understood that not all of the illustrated means are required to be implemented or provided. More or fewer devices may be implemented or provided instead.
In particular, according to embodiments of the present invention, the processes described above with reference to flowcharts may be implemented as computer software programs. For example, embodiments of the present invention include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method shown in the flowcharts. In such an embodiment, the computer program may be downloaded and installed from a network via the communication means 509, or from the storage means 508, or from the ROM 502. The above-described functions defined in the method of the embodiment of the present invention are performed when the computer program is executed by the processing means 501.
The computer readable medium of the present invention may be a computer readable signal medium or a computer readable storage medium, or any combination of the two. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples of the computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present invention, however, the computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, with the computer-readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, fiber optic cables, RF (radio frequency), and the like, or any suitable combination of the foregoing.
The computer readable medium may be contained in the electronic device; or may exist alone without being incorporated into the electronic device.
The computer-readable medium carries one or more programs that, when executed by the electronic device, cause the electronic device to perform the method shown in the method embodiments described above; alternatively, the computer-readable medium carries one or more programs, which when executed by the electronic device, cause the electronic device to perform the method shown in the method embodiments.
Computer program code for carrying out operations of the present invention may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, smalltalk, C ++ and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computer (for example, through the Internet using an Internet service provider).
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units involved in the embodiments of the present invention may be implemented in software or in hardware. Wherein the names of the units do not constitute a limitation of the units themselves in some cases.
The above description is only illustrative of the preferred embodiments of the present invention and of the principles of the technology employed. It will be appreciated by persons skilled in the art that the scope of the invention referred to in the present invention is not limited to the specific combinations of the technical features described above, but also covers other technical features formed by any combination of the technical features described above or their equivalents without departing from the inventive concept described above. Such as the above-mentioned features and the features having similar functions (but not limited to) of the invention.

Claims (9)

1. A method of task processing, comprising:
the method comprises the steps that a server receives task acquisition requests sent by service nodes, wherein the task acquisition requests comprise node identifiers of the service nodes;
based on the node identifiers, acquiring target tasks to be processed corresponding to the service nodes from the tasks to be processed stored in the task storage space;
transmitting each target task to be processed to each corresponding service node, so that each service node transmits each target task to be processed to each corresponding task processing node according to a task identifier in each target task to be processed, wherein the task identifier comprises a task request end identifier and a task processing node identifier;
The task storage space gathers the stored tasks to be processed, and the tasks to be processed are obtained through the following modes:
the method comprises the steps that the server receives task processing requests of task request ends, wherein the task processing requests comprise initial tasks, and the initial tasks comprise task identifiers and task data;
generating a corresponding task to be processed from the initial task according to a specified message format, and storing the task to the task storage space;
the message header is used for representing task identifiers of the tasks to be processed, the message body is used for representing task data of the tasks to be processed, and the message tail is used for representing the current processing state of the tasks to be processed;
if the task processing nodes corresponding to the tasks to be processed comprise at least two task processing nodes;
the generating the corresponding task to be processed according to the initial task and the appointed message format comprises the following steps:
splitting the initial task into a corresponding number of subtasks based on the number of task processing nodes corresponding to the task to be processed, wherein each subtask comprises a subtask identifier and subtask data, and the subtask identifier comprises the task request end identifier and a processing node identifier of the task processing node corresponding to each subtask;
Generating corresponding tasks to be processed from the subtasks according to the appointed message format;
the message header characterizes subtask identifiers of the subtasks, the message body characterizes subtask data of the subtasks, and the message tail characterizes current processing states of the subtasks.
2. The method of claim 1, wherein after storing the task to be processed in the specified message format in the task storage space, the method further comprises:
setting an initial identifier of a lock state of each task to be processed, wherein the initial identifier is an unlocked state;
based on the node identifiers, acquiring a target task to be processed corresponding to each service node from the tasks to be processed stored in the task storage space, including:
and based on the node identifiers, acquiring the task to be processed with the lock state being the unlocked state from the task to be processed stored in the task storage space as a target task to be processed corresponding to each service node.
3. The method of claim 2, wherein after said sending each of said target pending tasks to a corresponding one of said service nodes, said method further comprises:
And updating the locking state of the target task to be processed from the unlocking state to the locking state.
4. The method of claim 1, wherein if the task to be processed includes at least two sub-tasks having a hierarchical relationship, after storing the task to be processed in a specified message format in the task storage space, the method further comprises:
setting initial identifiers of the lock states of the at least two subtasks corresponding to each task to be processed, wherein the initial identifier of the lock state of the upper subtask is an unlocked state, and the initial identifier of the lock state of the lower subtask is a locked state;
based on the node identifiers, acquiring a target task to be processed corresponding to each service node from the tasks to be processed stored in the task storage space, including:
based on the node identifiers, acquiring an upper-level subtask with an unlocked lock state from the tasks to be processed stored in the task storage space as a target task to be processed corresponding to each service node;
after receiving a processing completion identifier that the upper-level subtasks are processed, the method further includes:
and updating the locking state of the lower-level subtask corresponding to the upper-level subtask from the locking state to the unlocking state.
5. The method according to any one of claims 1 to 4, wherein the current processing state includes processing completion and unprocessed completion, and upon receiving processing success response information sent by the service node, the method further comprises:
and updating the current processing state of the target task to be processed into processing completion.
6. The method of claim 5, wherein after storing the task to be processed in the specified message format in the task storage space, the method further comprises:
setting task types of the tasks to be processed, wherein the task types comprise single-instance tasks and non-single-instance tasks, the single-instance tasks refer to a task processing node corresponding to one task to be processed, and the non-single-instance tasks refer to at least two task processing nodes corresponding to one task to be processed;
if the target task to be processed is a single-instance task, deleting the target task to be processed when the current processing state of the target task to be processed is processing completion;
and if the target task to be processed is a non-single-instance task, deleting the target task to be processed when the current processing states of at least two subtasks corresponding to the target task to be processed are processed.
7. A task processing device, comprising:
the system comprises a request acquisition module, a task acquisition module and a task processing module, wherein the request acquisition module is used for receiving a task acquisition request sent by each service node by a server, and the task acquisition request comprises a node identifier of the service node;
the task determining module is used for acquiring target tasks to be processed corresponding to the service nodes from the tasks to be processed stored in the task storage space based on the node identifiers; the task storage space gathers the stored tasks to be processed, and the tasks to be processed are obtained through the following modes: the method comprises the steps that the server receives task processing requests of task request ends, wherein the task processing requests comprise initial tasks, and the initial tasks comprise task identifiers and task data; generating a corresponding task to be processed from the initial task according to a specified message format, and storing the task to the task storage space; the message header is used for representing task identifiers of the tasks to be processed, the message body is used for representing task data of the tasks to be processed, and the message tail is used for representing the current processing state of the tasks to be processed; if the task processing nodes corresponding to the tasks to be processed comprise at least two task processing nodes; the generating the corresponding task to be processed according to the initial task and the appointed message format comprises the following steps: splitting the initial task into a corresponding number of subtasks based on the number of task processing nodes corresponding to the task to be processed, wherein each subtask comprises a subtask identifier and subtask data, and the subtask identifier comprises the task request end identifier and a processing node identifier of the task processing node corresponding to each subtask; generating corresponding tasks to be processed from the subtasks according to the appointed message format; the message header represents the subtask identification of each subtask, the message body is used for representing the subtask data of each subtask, and the message tail is used for representing the current processing state of each subtask;
The task processing module is used for sending each target task to be processed to each corresponding service node so that each service node can send each target task to be processed to the corresponding task processing node according to the task identifier in each target task to be processed, and the task identifier comprises a task request end identifier and a task processing node identifier.
8. An electronic device, comprising:
a processor and a memory;
the memory is used for storing computer operation instructions;
the processor is configured to perform the method of any one of claims 1 to 6 by invoking the computer operating instructions.
9. A computer readable storage medium, characterized in that it stores at least one computer program that is loaded and executed by a processor to implement the method of any one of claims 1 to 6.
CN202010102459.8A 2020-02-19 2020-02-19 Task processing method, device, electronic equipment and computer readable storage medium Active CN111338797B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010102459.8A CN111338797B (en) 2020-02-19 2020-02-19 Task processing method, device, electronic equipment and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010102459.8A CN111338797B (en) 2020-02-19 2020-02-19 Task processing method, device, electronic equipment and computer readable storage medium

Publications (2)

Publication Number Publication Date
CN111338797A CN111338797A (en) 2020-06-26
CN111338797B true CN111338797B (en) 2023-09-05

Family

ID=71184167

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010102459.8A Active CN111338797B (en) 2020-02-19 2020-02-19 Task processing method, device, electronic equipment and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN111338797B (en)

Families Citing this family (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112346886B (en) * 2020-10-23 2021-10-22 上海优方信息科技服务股份有限公司 Transaction data processing method and device, storage medium and server
CN112231108A (en) * 2020-11-02 2021-01-15 网易(杭州)网络有限公司 Task processing method and device, computer readable storage medium and server
CN112416552A (en) * 2020-11-19 2021-02-26 中国建设银行股份有限公司 Main task processing method, device, server and storage medium
CN112596865A (en) * 2020-12-22 2021-04-02 航天信息股份有限公司企业服务分公司 System for pushing to-do message based on workflow affair
CN113159521A (en) * 2021-03-26 2021-07-23 珠海大横琴科技发展有限公司 Service scheduling method and device
CN113360258B (en) * 2021-05-28 2024-07-09 北京百度网讯科技有限公司 Data processing method, device, electronic equipment and storage medium
CN114003384B (en) * 2021-11-01 2023-07-18 北京深演智能科技股份有限公司 Task management method, device and equipment
CN115378975B (en) * 2022-08-23 2024-02-02 索思(苏州)医疗科技有限公司 Signal real-time processing method and device, electronic equipment and storage medium

Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CA2824178A1 (en) * 2011-01-10 2012-07-19 Storone Ltd. Large scale storage system
CN104281970A (en) * 2014-10-13 2015-01-14 中国外汇交易中心 Message processing method, message processing device and server platform
CN106713504A (en) * 2017-02-17 2017-05-24 平安科技(深圳)有限公司 Task processing method and system
CN108156194A (en) * 2016-12-02 2018-06-12 航天星图科技(北京)有限公司 A kind of form data processing method
CN109447411A (en) * 2018-09-26 2019-03-08 平安普惠企业管理有限公司 Business Process Control method, apparatus, computer equipment and storage medium
CN109614209A (en) * 2018-10-26 2019-04-12 阿里巴巴集团控股有限公司 A kind of task processing method, application server and system
CN110209496A (en) * 2019-05-20 2019-09-06 中国平安财产保险股份有限公司 Task sharding method, device and sliced service device based on data processing
CN110275766A (en) * 2019-06-25 2019-09-24 深圳前海微众银行股份有限公司 A kind of task processing method and device
CN110351342A (en) * 2019-06-20 2019-10-18 平安科技(深圳)有限公司 Service order processing method, device, computer equipment and storage medium
CN110443695A (en) * 2019-07-31 2019-11-12 中国工商银行股份有限公司 Data processing method and its device, electronic equipment and medium
CN110458468A (en) * 2019-08-16 2019-11-15 北京百度网讯科技有限公司 A kind of task processing method, device, electronic equipment and storage medium

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107885594B (en) * 2016-09-30 2020-06-12 腾讯科技(深圳)有限公司 Distributed resource scheduling method, scheduling node and access node
US10331581B2 (en) * 2017-04-10 2019-06-25 Hewlett Packard Enterprise Development Lp Virtual channel and resource assignment
US10832241B2 (en) * 2017-10-11 2020-11-10 International Business Machines Corporation Transaction reservation for block space on a blockchain

Patent Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CA2824178A1 (en) * 2011-01-10 2012-07-19 Storone Ltd. Large scale storage system
CN104281970A (en) * 2014-10-13 2015-01-14 中国外汇交易中心 Message processing method, message processing device and server platform
CN108156194A (en) * 2016-12-02 2018-06-12 航天星图科技(北京)有限公司 A kind of form data processing method
CN106713504A (en) * 2017-02-17 2017-05-24 平安科技(深圳)有限公司 Task processing method and system
CN109447411A (en) * 2018-09-26 2019-03-08 平安普惠企业管理有限公司 Business Process Control method, apparatus, computer equipment and storage medium
CN109614209A (en) * 2018-10-26 2019-04-12 阿里巴巴集团控股有限公司 A kind of task processing method, application server and system
CN110209496A (en) * 2019-05-20 2019-09-06 中国平安财产保险股份有限公司 Task sharding method, device and sliced service device based on data processing
CN110351342A (en) * 2019-06-20 2019-10-18 平安科技(深圳)有限公司 Service order processing method, device, computer equipment and storage medium
CN110275766A (en) * 2019-06-25 2019-09-24 深圳前海微众银行股份有限公司 A kind of task processing method and device
CN110443695A (en) * 2019-07-31 2019-11-12 中国工商银行股份有限公司 Data processing method and its device, electronic equipment and medium
CN110458468A (en) * 2019-08-16 2019-11-15 北京百度网讯科技有限公司 A kind of task processing method, device, electronic equipment and storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
"面向网络对讲机语音小文件的高并发处理方案";方国栋 等;《现代计算机》(第13期);第3-8、31页 *

Also Published As

Publication number Publication date
CN111338797A (en) 2020-06-26

Similar Documents

Publication Publication Date Title
CN111338797B (en) Task processing method, device, electronic equipment and computer readable storage medium
US20210256431A1 (en) Methods for unlocking shared bikes
CN110781373B (en) List updating method and device, readable medium and electronic equipment
CN110263277B (en) Page data display method, page data updating device, page data equipment and storage medium
CN110390493B (en) Task management method and device, storage medium and electronic equipment
CN111857720B (en) User interface state information generation method and device, electronic equipment and medium
CN115292635A (en) Page floor data display method, device, equipment and computer readable medium
CN112363782B (en) Chat interface display method, chat interface display device, electronic equipment and computer readable medium
CN113709573B (en) Method, device, equipment and storage medium for configuring video special effects
WO2021143317A1 (en) Invitation link information processing method and apparatus, electronic device and readable medium
CN111986669A (en) Information processing method and device
CN110619079A (en) Method and device for pushing information
CN114513548B (en) Directional call information processing method and device
CN116820354B (en) Data storage method, data storage device and data storage system
CN112069438B (en) Message merging method, message processing method and device, equipment and medium
CN111262776B (en) Method, device, electronic equipment and computer readable medium for sending notification message
CN113778387B (en) Method and device for generating code
CN115221178B (en) Data table binding method, device, electronic equipment and computer readable medium
CN115994120B (en) Data file merging method, device, electronic equipment and computer readable medium
CN115525847A (en) Page view generation method and device, electronic equipment and storage medium
CN116127233A (en) Task scheduling method, device, electronic equipment and storage medium
CN111400322A (en) Method, apparatus, electronic device, and medium for storing data
CN116416120A (en) Image special effect processing method, device, equipment and medium
CN113656645A (en) Log consumption method and device
CN118363705A (en) Page generation method and device

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