CN114003384B - Task management method, device and equipment - Google Patents
Task management method, device and equipment Download PDFInfo
- Publication number
- CN114003384B CN114003384B CN202111285284.XA CN202111285284A CN114003384B CN 114003384 B CN114003384 B CN 114003384B CN 202111285284 A CN202111285284 A CN 202111285284A CN 114003384 B CN114003384 B CN 114003384B
- Authority
- CN
- China
- Prior art keywords
- task
- target
- management table
- identifier
- equipment
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/50—Allocation of resources, e.g. of the central processing unit [CPU]
- G06F9/5005—Allocation of resources, e.g. of the central processing unit [CPU] to service a request
- G06F9/5027—Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
- G06F9/5038—Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals considering the execution order of a plurality of tasks, e.g. taking priority or time dependency constraints into consideration
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/48—Program initiating; Program switching, e.g. by interrupt
- G06F9/4806—Task transfer initiation or dispatching
- G06F9/4843—Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
- G06F9/4881—Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/54—Interprogram communication
- G06F9/546—Message passing systems or structures, e.g. queues
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Debugging And Monitoring (AREA)
Abstract
The application discloses a method, a device and equipment for task management. Wherein the method comprises the following steps: the task manager receives access requests sent by consumer equipment at regular time; under the triggering of the access request, determining a target task identifier from a task management table according to the task priority of each task in a waiting state in the task management table, sending the target task identifier to the consumer equipment, and modifying the state of a task corresponding to the target task identifier into a calculation state; the task manager sends the processing result of the target task corresponding to the target task identifier to producer equipment through the task callback address of the task corresponding to the target task identifier; and uploading the target task identifier to a monitoring center under the condition that the processing result of the target task is failure. The method and the device solve the technical problem that the third party message middleware is introduced to add extra dependence.
Description
Technical Field
The present application relates to the field of computers, and in particular, to a method, an apparatus, and a device for task management.
Background
At present, two models are mainly used for issuing and calculating processing tasks in the industry: a synchronous model is used for integrating production and consumption of calculation tasks into one thread from task generation to calculation, and the problem is that a user can respond only when calculation is completed or fails due to long time required by large-scale calculation, so that the response time of the whole system is overlong, and meanwhile, the whole system can be suspended and wait for calculation results in the calculation completion process, so that the throughput of the system is low. The other is an asynchronous model, the production and consumption of the calculation tasks are decoupled, and the production and the calculation of the tasks are carried out in different threads or different systems, so that the response time and the throughput of the system are improved. However, most asynchronous models introduce third party message middleware, such as kafka, which is a high throughput distributed publish-subscribe messaging system that can handle all action flow data of consumers in websites, which requires installation tools, adding additional dependencies. For some scenarios where it is desirable to have fewer external dependent components, this approach increases the dependent costs.
In view of the above problems, no effective solution has been proposed at present.
Disclosure of Invention
The embodiment of the application provides a method, a device and equipment for task management, which are used for at least solving the technical problem that additional dependence is added by introducing a third party message middleware.
According to one aspect of the embodiments of the present application, there is provided a method for task management, including: the task manager receives an access request sent by consumer equipment at regular time; under the triggering of an access request, determining a target task identifier from a task management table according to the task priority of each task in a waiting state in the task management table, sending the target task identifier to consumer equipment, and modifying the state of a task corresponding to the target task identifier into a calculation state; the task manager sends the processing result of the target task corresponding to the target task identifier to the producer device through the task callback address of the task corresponding to the target task identifier; and uploading the target task identification to a monitoring center under the condition that the processing result of the target task is failure.
Optionally, before the task manager receives the access request sent by the consumer device at regular time, the method further comprises: the task manager stores the tasks registered by the producer device in a task management table, wherein task information of a plurality of tasks is stored in the task management table, and the task information comprises: task state, task type, task priority and task callback address; wherein the tasks in the task management table are ordered according to the priority, and the higher the priority is, the earlier the order in which the tasks are called to execute is.
Optionally, before the task manager stores the task registered by the producer device in the management table, the task manager includes: receiving a task registration request sent by producer equipment, wherein the registration request carries a user name and a password corresponding to the producer equipment; and checking the user name and the password corresponding to the producer equipment, wherein after the user name and the password pass the checking, the task corresponding to the task registration request is allowed to register, and the task information of the task corresponding to the task registration request is added into a task management table.
Optionally, the task information further includes: task timeout time; the method further comprises the steps of: when the task reaching the task timeout time exists in the task management table, the task identification of the task reaching the task timeout time is uploaded to the monitoring center.
Optionally, before determining the target task identifier from the task management table according to the task priority of each task in the waiting state in the task management table, the method further includes: the task manager receives the task type of the task requested by the task request, and queries the task corresponding to the task type from the task management table according to the task type.
Optionally, determining the target task identifier from the task management table according to the task priority of each task in the waiting state in the task management table includes: the task manager selects a preset number of task sets according to the order of the task priorities from high to low, wherein the tasks in the task sets are ordered according to the priorities; re-sequencing according to the task creation time of each task in the task set; and selecting a second preset number of target task identifiers from the task set obtained after re-sequencing according to the sequence of the task creation time.
According to another aspect of the embodiments of the present application, there is also provided an apparatus for task management, including: the receiving module is used for receiving the access request sent by the consumer equipment at regular time; the processing module is used for determining a target task identifier from the task management table according to the task priority of each task in the waiting state in the task management table under the triggering of the access request, sending the target task identifier to consumer equipment, and modifying the state of the task corresponding to the target task identifier into a calculation state; transmitting a processing result of the target task corresponding to the target task identifier to producer equipment through a task callback address of the task corresponding to the target task identifier; and the uploading module is used for uploading the target task identifier to the monitoring center under the condition that the processing result of the target task is failure.
The device further comprises: the storage module is used for storing the tasks registered by the producer equipment in a task management table, wherein the task management table stores task information of a plurality of tasks, and the task information comprises: task state, task type, task priority and task callback address; wherein the tasks in the task management table are ordered according to the priority, and the higher the priority is, the earlier the order in which the tasks are called to execute is.
According to still another aspect of the embodiments of the present application, there is also provided an electronic device, including: a memory for storing program instructions; and the processor is connected with the memory and is used for calling the program instructions stored in the memory and executing the following steps: receiving an access request sent by consumer equipment at regular time; under the triggering of an access request, determining a target task identifier from a task management table according to the task priority of each task in a waiting state in the task management table, sending the target task identifier to consumer equipment, and modifying the state of a task corresponding to the target task identifier into a calculation state; transmitting a processing result of the target task corresponding to the target task identifier to producer equipment through a task callback address of the task corresponding to the target task identifier; and uploading the target task identification to a monitoring center under the condition that the processing result of the target task is failure.
According to still another aspect of the embodiments of the present application, there is also provided a nonvolatile storage medium including a stored program, where the method of controlling a device in which the nonvolatile storage medium is located to perform the above task management when the program runs is provided.
In the embodiment of the application, the method that the task is passively sent to the consumer equipment when the third party message middleware is used is changed, the consumer equipment adopts a method of actively polling the task to be processed in the task manager, the task manager orders the tasks according to the types and the task priorities of the tasks and the task creation time, the tasks meeting the conditions are sent to the consumer equipment for processing, and the processing results of the tasks are sent to the producer equipment through a callback mechanism, so that the purposes of improving the distribution efficiency, the system response time and the throughput of the computing task are achieved, the technical effect of asynchronous processing of the computing task is achieved, the state of the computing task is managed in a concentrated mode, the monitoring capability of the task state is enhanced, and the technical problem that the additional dependence is added to the third party message middleware is solved.
Drawings
The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this application, illustrate embodiments of the application and together with the description serve to explain the application and do not constitute an undue limitation to the application. In the drawings:
FIG. 1 is a block diagram of an electronic device according to an embodiment of the present application;
FIG. 2 is a flow chart of a method of task management according to an embodiment of the present application;
FIG. 3 is a flow chart of a method of determining task timeout according to an embodiment of the present application;
FIG. 4 is a flow chart of a method of determining a target task identity according to an embodiment of the present application;
fig. 5 is a block diagram of an apparatus for task management according to an embodiment of the present application.
Detailed Description
In order to make the present application solution better understood by those skilled in the art, the following description will be made in detail and with reference to the accompanying drawings in the embodiments of the present application, it is apparent that the described embodiments are only some embodiments of the present application, not all embodiments. All other embodiments, which can be made by one of ordinary skill in the art based on the embodiments herein without making any inventive effort, shall fall within the scope of the present application.
It should be noted that the terms "first," "second," and the like in the description and claims of the present application and the above figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that embodiments of the present application described herein may be implemented in sequences other than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
For better understanding of the embodiments of the present application, technical terms related in the embodiments of the present application are explained below:
the consumer: the data computing end is used for sending an access request to the task manager in the embodiment of the application, requesting whether a task to be processed exists or not, and processing the task after receiving the task sent by the task manager.
The producer: the data generating end, in this embodiment of the present application, is installed with software for generating tasks, where the software is used to detect a task generating instruction and splice the instruction into a task rule.
Task manager: in the embodiment of the application, middleware for connecting the producer and the consumer replaces a third party middleware to provide various services, such as registration, distribution, notification, callback, reporting and the like, so as to complete interaction between the producer and the consumer.
In order to improve the distribution efficiency of computing tasks, the embodiment of the application realizes a task distribution model based on producers and consumers by using the system response time and throughput. The model is used for decoupling producer equipment and consumer equipment of large-scale computing tasks, centrally managing the states of the tasks and monitoring alarms, realizing asynchronous processing of generation and consumption of the computing tasks without introducing external dependence, improving the efficiency and throughput of task distribution by the asynchronous processing and callback mechanism of the tasks, avoiding waiting for completion of task computation, and creating other computing tasks again.
Fig. 1 is a block diagram of an electronic device according to an embodiment of the present application, and as shown in fig. 1, the device includes:
a memory 10 for storing program instructions;
a processor 12, coupled to the memory, for invoking program instructions stored in the memory and performing the steps of: the method comprises the steps that a task manager receives an access request sent by consumer equipment at regular time, wherein parameters of the access request are task types; under the triggering of an access request, a task manager determines a target task identifier from a task management table according to the task priority of each task in a waiting state in the task management table, sends the target task identifier to consumer equipment, and modifies the state of a task corresponding to the target task identifier into a calculation state; the task manager sends a processing result of a target task corresponding to the target task identifier to producer equipment through a task callback address of the task corresponding to the target task identifier, wherein the producer equipment is provided with software for generating the task, the software is used for detecting a generating instruction of the task and splicing the instruction, the task is generated by clicking a page by a user, the producer equipment splices the generated task into a task rule, and the callback address is used for designating an address link of a jump-back website; and under the condition that the processing result of the target task is failure, the task manager uploads the target task identification to the monitoring center.
In the above-described operating environment, the present application provides a method embodiment of task management, and it should be noted that the steps illustrated in the flowcharts of the figures may be performed in a computer system such as a set of computer executable instructions, and that although a logical order is illustrated in the flowcharts, in some cases the steps illustrated or described may be performed in an order other than that illustrated herein.
FIG. 2 is a flow chart of a method of task management, as shown in FIG. 2, according to an embodiment of the present application, the method comprising the steps of:
step S202, a task manager receives an access request sent by consumer equipment at regular time, wherein parameters of the access request are task types;
step S204, under the triggering of the access request, determining a target task identifier from the task management table according to the task priority of each task in the waiting state in the task management table, sending the target task identifier to the consumer equipment, and modifying the state of the task corresponding to the target task identifier into a calculation state;
step S206, the task manager sends the processing result of the target task corresponding to the target task identifier to the producer equipment through the task callback address of the task corresponding to the target task identifier, wherein the callback address is an address link for designating to jump back to the website;
step S208, uploading the target task identification to the monitoring center when the processing result of the target task is failure.
Through the steps, the traditional mode of passively sending the task to the consumer equipment when the third party message middleware is used is changed, the consumer equipment adopts a mode of actively polling the task to be processed in the task manager, the task manager sorts the tasks according to the types and the task priorities of the tasks and the task creation time, sends the tasks meeting the conditions to the consumer equipment for processing, and sends the processing results of the tasks to the producer equipment through a callback mechanism, so that the purposes of improving the distribution efficiency, the system response time and the throughput of the computing task are achieved, the technical effect of asynchronous processing of the generation and consumption of the computing task is achieved, the state of the computing task is managed in a centralized mode, the monitoring capability of the task state is enhanced, and the technical problem that the additional dependence is added to the third party message middleware is solved.
Optionally, before step S202, in order to improve the efficiency of the task manager in querying the target task, the producer device registers and stores the task in the task management table in advance, and when the task manager queries the target task, the task stored in the task management table does not need to be stored each time, and can be directly invoked and queried, thereby saving time. The method comprises the following steps: the task manager stores the tasks registered by the producer device in a task management table, wherein task information of a plurality of tasks is stored in the task management table, and the task information comprises: task state, task type, task priority and task callback address; wherein the tasks in the task management table are ordered according to the priority, and the higher the priority is, the earlier the order in which the tasks are called to execute is.
Optionally, before the task manager stores the task registered by the producer device in the management table, the task manager includes: receiving a task registration request sent by producer equipment, wherein the registration request carries a user name and a password corresponding to the producer equipment; and checking the user name and the password corresponding to the producer equipment, wherein after the user name and the password pass the checking, the task corresponding to the task registration request is allowed to register, and the task information of the task corresponding to the task registration request is added into a task management table.
Whether the producer device or the consumer device requests the service of the task manager through http, if the request header does not have a token or the token fails, the request header needs to be authenticated, that is, the device requesting the service is checked first, and the task manager calls/logins, and the request parameters include the user name and the password of the device requesting the service. The task manager checks the user name and the password, if the user name and the password are legal, the user name and the password pass the check, the task manager transmits a token with timeliness back to the request equipment, the valid period of the default token is 20 minutes, and the user name and the password need to be checked again more than 20 minutes.
The producer device calls a task registration interface of the task manager to register tasks, and parameters of the registration request comprise: name, the name of the task; type, i.e., the type of task; definition, namely definition information of a task, is used as a reserved field, and information describing the task is stored; metadata, i.e., related information of a task required when a consumer device performs a computing task, i.e., rule information agreed between a producer device and a consumer device; the callback Url is used for enabling the consumer equipment to process the task, and the task manager informs the producer equipment of the processing result and the state of the task through the callback address; priority, i.e., the priority of a task.
Optionally, the task information further includes: task timeout time; the method further comprises the steps of: when the task reaching the task timeout time exists in the task management table, the task identification of the task reaching the task timeout time is uploaded to the monitoring center. Wherein, judging whether the task is overtime, as shown in fig. 3, comprising the following steps:
step S302, a task manager queries tasks with task states in a waiting state in a task management table at regular time, and determines task creation time, timeout time and current time;
step S304, when the sum of the task creation time and the overtime time is larger than the current time, determining that the task has no overtime;
and step S306, when the sum of the task creation time and the overtime time is smaller than the current time, determining that the task overtime, setting the overtime task state by the task manager, and uploading the task identification of the task in the overtime state to the monitoring center, wherein the task in the overtime state is the task reaching the overtime time of the task.
Step S302 to step S306 may be described by the following example, where if the task state of the task a in the task management table is a waiting state, when the creation time of the task a is 8, the timeout time is set to 30 minutes, and the current time is 8 hours and 20 minutes, and since the sum of the creation time of the task a and the timeout time is 8 hours and 30 minutes, the time is greater than the current time, it is determined that the task a has not timed out, and the state of the task a is still the waiting state; if the task state of the task B in the task management table is a waiting state, when the creation time of the task B is 9, the overtime time is set to be 30 minutes, and the current time is set to be 9 hours and 40 minutes, and because the sum of the creation time and the overtime time of the task B is 9 hours and 30 minutes, the time is smaller than the current time, the overtime of the task B is determined, and at the moment, the task manager sets the state of the task B to be the overtime state and uploads the task identifier corresponding to the task B to the monitoring center.
In some embodiments of the present application, before step S204, that is, before determining the target task identifier from the task management table according to the task priority of each waiting state in the task management table, the following processing steps may be further performed: the task manager receives the task type of the task requested by the task request, and queries the task corresponding to the task type from the task management table according to the task type. Specifically, the task request may also carry a task type identifier, and the task manager determines the type of the requested task based on the task type identifier; in other embodiments, the type corresponding to the task identifier may be determined according to the task identifier carried in the task request, and at this time, a mapping relationship between the task identifier and the task type is maintained in a device where the task manager is located or in a device connected to the task manager, and the task type corresponding to the task identifier carried in the task request is determined based on the mapping relationship.
Optionally, in step S204, a target task identifier is determined from the task management table according to the task priority of each task in the waiting state in the task management table, as shown in fig. 4, and the method includes the following steps:
step S402, a task manager selects a preset number of task sets according to the order of the task priorities from high to low, wherein the tasks in the task sets are ordered according to the priorities;
step S404, re-ordering according to the task creation time of each task in the task set;
step S406, selecting a second preset number of target task identifiers from the task set obtained after re-sequencing according to the sequence of the task creation time.
If the related task does not exist, informing the consumer equipment that the task does not exist temporarily and needs to be processed by the task manager; if there is a relevant task, the task manager fetches the task from the task management table and sends the target task to the consumer device. After the consumer device acquires the target task, processing the task according to rule information stored in metadata of the target task, and uploading the task state to a task manager through a task identifier and an execution state of the task and a task processing result after processing is completed or processing failure occurs, wherein the task manager calls a callback address provided by a previous producer device registration task, and transmits the task processing result to the producer device, and meanwhile, the execution state of the corresponding task is updated in a task management table according to the task identifier and the execution state of the task, and the execution state of the task comprises success and failure. If the execution state of the task is failure, the task manager uploads the failed task identification and other information related to the task to the monitoring center, wherein the other information related to the task can be information such as a processing result of the task, a task type and the like. And the producer equipment receives the task processing result in the callback address and updates the execution state of the task according to the task processing result.
Taking the task of the group ring as an example, describing the task management method shown in fig. 2-4 in detail, firstly, creating a business interface of a group ring rule by the producer device, converting the ring rule into a corresponding json structure according to the json structure defined by the producer device, setting corresponding request parameters such as timeout time, task type, group type of segment and the like, writing the ring rule into metadata parameters, and then calling a task registration interface of a task manager by the producer device to register the task. Before the task registration is carried out by the task manager, the task manager receives a task registration request sent by the producer device, wherein the registration request carries a user name and a password corresponding to the producer device, the task manager checks the user name and the password corresponding to the producer device, after the user name and the password pass the check, the task corresponding to the task registration request is allowed to be registered, and meanwhile, the task manager stores the task registered by the producer device in a task management table and sets the state of the task to be a waiting state. And after the producer equipment produces the task, directly returning, and setting the group state of the service party as a new state. The task manager regularly detects whether a timeout task exists, the step corresponds to the step S302 to the step S306, if judging that the task is OVERTIME, the task manager modifies the state of the task into an OVERTIME state, and reports the OVERTIME task identifier to the monitoring center. The consumer device sends an access request to the task manager at regular time, the parameters are group type segments, and whether there is a task of the group ring waiting for calculation is checked, and the step corresponds to step S202. The task manager receives the access request of the consumer device, determines whether there is a task of the group ring waiting for calculation from the task management table according to the task priority of each task in the waiting state in the task management table, if the task of the group ring needing to be calculated is queried in the task management table, the task manager sends the identification of the task to the consumer device for processing, and simultaneously modifies the state of the task corresponding to the task identification into the calculating state, and the step corresponds to the step S204. The consumer equipment receives the task of the group circler to be calculated, which is sent from the task manager, and takes out the json structure with the predefined circler rule from the parameters related to the transmitted task of the group circler to process. And after the processing of the consumer equipment is finished or fails, calling an interface provided by the task manager, and simultaneously, putting a message which needs to be transmitted back to the producer equipment into the payload, and uploading a calculation result to the task manager, wherein the payload comprises a processing result of the task. The task manager modifies the execution state of the task according to the processing result of the task, including success or failure, takes the payload information as it is, calls the callback address of the group ring business side, and notifies the producer of the processing result of the task, and the step corresponds to S206 of the above step. Meanwhile, if the execution status of the task is failure, the task manager reports the task to the monitoring center, and the step corresponds to S208 of the above steps. And in the group loop callback interface, processing the group loop task, if the task processing is successful, updating the number of the loop into a group table, and modifying the state of the group to be the segment finish (group calculation completion), and if the task processing is failed, modifying the state of the group to be the segment fail.
Fig. 5 is a block diagram of an apparatus for task management according to an embodiment of the present application, as shown in fig. 4, including:
the receiving module 50 is configured to receive an access request sent by the consumer device at regular time, where a parameter of the access request is a task type;
the processing module 52 is configured to determine a target task identifier from the task management table according to the task priority of each task in the waiting state in the task management table, send the target task identifier to the consumer device, and modify the state of the task corresponding to the target task identifier into a calculation state under the triggering of the access request; transmitting a processing result of the target task corresponding to the target task identifier to producer equipment through a task callback address of the task corresponding to the target task identifier, wherein the callback address is an address link used for designating a jump-back website;
and the uploading module 54 is configured to upload the target task identifier to the monitoring center if the processing result of the target task is failure.
The device further comprises: the storage module is used for storing the tasks registered by the producer equipment in a task management table, wherein the task management table stores task information of a plurality of tasks, and the task information comprises: task state, task type, task priority and task callback address; wherein the tasks in the task management table are ordered according to the priority, and the higher the priority is, the earlier the order in which the tasks are called to execute is.
It should be noted that, the task management device shown in fig. 5 is used to execute the task management method shown in fig. 2-4, so relevant explanation pages in the task management method are applicable to the task management device, and are not repeated herein.
The embodiment of the application also provides a nonvolatile storage medium, which comprises a stored program, wherein when the program runs, the device where the nonvolatile storage medium is controlled to execute the following task management method:
the method comprises the steps that a task manager receives an access request sent by consumer equipment at regular time, wherein parameters of the access request are task types;
under the triggering of an access request, determining a target task identifier from a task management table according to the task priority of each task in a waiting state in the task management table, sending the target task identifier to consumer equipment, and modifying the state of a task corresponding to the target task identifier into a calculation state;
the task manager sends the processing result of the target task corresponding to the target task identifier to the producer equipment through the task callback address of the task corresponding to the target task identifier, wherein the callback address is an address link for designating a jump-back website;
and uploading the target task identification to a monitoring center under the condition that the processing result of the target task is failure.
The foregoing embodiment numbers of the present application are merely for describing, and do not represent advantages or disadvantages of the embodiments.
In the foregoing embodiments of the present application, the descriptions of the embodiments are emphasized, and for a portion of this disclosure that is not described in detail in this embodiment, reference is made to the related descriptions of other embodiments.
In the several embodiments provided in the present application, it should be understood that the disclosed technology content may be implemented in other manners. The above-described embodiments of the apparatus are merely exemplary, and the division of the units, for example, may be a logic function division, and may be implemented in another manner, for example, a plurality of units or components may be combined or may be integrated into another system, or some features may be omitted, or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be through some interfaces, units or modules, or may be in electrical or other forms.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in each embodiment of the present application may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units may be implemented in hardware or in software functional units.
The integrated units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application may be embodied in essence or a part contributing to the prior art or all or part of the technical solution in the form of a software product stored in a storage medium, including several instructions to cause a computer device (which may be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the methods described in the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a removable hard disk, a magnetic disk, or an optical disk, or other various media capable of storing program codes.
The foregoing is merely a preferred embodiment of the present application and it should be noted that modifications and adaptations to those skilled in the art may be made without departing from the principles of the present application and are intended to be comprehended within the scope of the present application.
Claims (9)
1. A method of task management, comprising:
the task manager receives an access request sent by consumer equipment at regular time;
under the triggering of the access request, determining a target task identifier from a task management table according to the task priority of each task in a waiting state in the task management table, sending the target task identifier to the consumer equipment, and modifying the state of a task corresponding to the target task identifier into a calculation state;
the task manager sends the processing result of the target task corresponding to the target task identifier to producer equipment through the task callback address of the task corresponding to the target task identifier;
uploading the target task identifier to a monitoring center under the condition that the processing result of the target task is failure, wherein when the consumer equipment requests the service of a task manager through http, if no token exists in a request header or the token fails, the task manager checks the user name and the password of the consumer equipment; when a task with task overtime exists in the task management table, a task identifier of the task reaching the task overtime is uploaded to the monitoring center, wherein before the task manager receives an access request sent by consumer equipment at regular time, the task manager stores the task registered by the producer equipment in the task management table, and the task manager is used for connecting the producer equipment and the consumer equipment to realize asynchronous processing of generation and consumption of the task.
2. The method according to claim 1, wherein task information of a plurality of tasks is stored in the task management table, and the task information includes: task state, task type, task priority and task callback address;
the tasks in the task management table are ordered according to the priority, and the higher the priority is, the earlier the order in which the tasks are called to be executed is.
3. The method of claim 2, wherein the task manager stores the task registered by the producer device in a management table, comprising:
receiving a task registration request sent by the producer equipment, wherein the task registration request carries a user name and a password corresponding to the producer equipment;
and checking the user name and the password corresponding to the producer equipment, wherein after the user name and the password pass the checking, the task corresponding to the task registration request is allowed to register, and task information of the task corresponding to the task registration request is added into the task management table.
4. The method of claim 1, wherein prior to determining the target task identity from the task management table according to each task priority in the task management table in a waiting state, the method further comprises: and the task manager receives the task type of the task requested by the task request, and queries the task corresponding to the task type from the task management table according to the task type.
5. The method of claim 1, wherein determining a target task identity from the task management table according to each task priority in the task management table in a waiting state comprises:
the task manager selects a preset number of task sets according to the order of the task priorities from high to low, wherein the tasks in the task sets are ordered according to the priorities;
re-sequencing according to the task creation time of each task in the task set;
and selecting a second preset number of target task identifiers from the task set obtained after re-sequencing according to the sequence of the task creation time.
6. An apparatus for task management, comprising:
the receiving module is used for receiving the access request sent by the consumer equipment at regular time;
the processing module is used for determining a target task identifier from the task management table according to the task priority of each task in the waiting state in the task management table under the triggering of the access request, sending the target task identifier to the consumer equipment, and modifying the state of the task corresponding to the target task identifier into a calculation state; transmitting a processing result of a target task corresponding to a target task identifier to producer equipment through a task callback address of the task corresponding to the target task identifier;
the uploading module is used for uploading the target task identifier to a monitoring center under the condition that the processing result of the target task is failure, wherein when the consumer equipment requests the service of a task manager through http, if no token exists in a request header or the token fails, the task manager checks the user name and the password of the consumer equipment; when a task with task overtime exists in the task management table, a task identifier of the task reaching the task overtime is uploaded to the monitoring center, wherein before the task manager receives an access request sent by consumer equipment at regular time, the task manager stores the task registered by the producer equipment in the task management table, and the task manager is used for connecting the producer equipment and the consumer equipment to realize asynchronous processing of generation and consumption of the task.
7. The apparatus of claim 6, wherein the apparatus further comprises:
the storage module is configured to store tasks registered by the producer device in the task management table, where task information of a plurality of tasks is stored in the task management table, and the task information includes: task state, task type, task priority and task callback address; the tasks in the task management table are ordered according to the priority, and the higher the priority is, the earlier the order in which the tasks are called to be executed is.
8. An electronic device, comprising:
a memory for storing program instructions;
and the processor is connected with the memory and is used for calling the program instructions stored in the memory and executing the following steps: receiving an access request sent by consumer equipment at regular time; under the triggering of the access request, determining a target task identifier from a task management table according to the task priority of each task in a waiting state in the task management table, sending the target task identifier to the consumer equipment, and modifying the state of a task corresponding to the target task identifier into a calculation state; transmitting a processing result of a target task corresponding to a target task identifier to producer equipment through a task callback address of the task corresponding to the target task identifier; uploading the target task identifier to a monitoring center under the condition that the processing result of the target task is failure, wherein when the consumer equipment requests the service of a task manager through http, if no token exists in a request header or the token fails, the task manager checks the user name and the password of the consumer equipment; when a task with task overtime exists in the task management table, a task identifier of the task reaching the task overtime is uploaded to the monitoring center, wherein before the task manager receives an access request sent by consumer equipment at regular time, the task manager stores the task registered by the producer equipment in the task management table, and the task manager is used for connecting the producer equipment and the consumer equipment to realize asynchronous processing of generation and consumption of the task.
9. A non-volatile storage medium, characterized in that the non-volatile storage medium comprises a stored program, wherein the program, when run, controls a device in which the non-volatile storage medium is located to perform the method of task management according to any one of claims 1 to 5.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111285284.XA CN114003384B (en) | 2021-11-01 | 2021-11-01 | Task management method, device and equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111285284.XA CN114003384B (en) | 2021-11-01 | 2021-11-01 | Task management method, device and equipment |
Publications (2)
Publication Number | Publication Date |
---|---|
CN114003384A CN114003384A (en) | 2022-02-01 |
CN114003384B true CN114003384B (en) | 2023-07-18 |
Family
ID=79926222
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202111285284.XA Active CN114003384B (en) | 2021-11-01 | 2021-11-01 | Task management method, device and equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114003384B (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115774564B (en) * | 2022-11-03 | 2024-06-25 | 北京大学重庆大数据研究院 | Task processing method and device and electronic equipment |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104407922A (en) * | 2014-10-29 | 2015-03-11 | 中国建设银行股份有限公司 | Asynchronous batch-processing dispatching method and system |
US9436532B1 (en) * | 2011-12-20 | 2016-09-06 | Emc Corporation | Method and system for implementing independent message queues by specific applications |
CN107102894A (en) * | 2017-04-07 | 2017-08-29 | 百度在线网络技术(北京)有限公司 | Method for scheduling task, device and system |
CN107656825A (en) * | 2017-09-01 | 2018-02-02 | 上海艾融软件股份有限公司 | Message treatment method, apparatus and system |
Family Cites Families (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20070106778A1 (en) * | 2005-10-27 | 2007-05-10 | Zeldin Paul E | Information and status and statistics messaging method and system for inter-process communication |
US20100332604A1 (en) * | 2009-06-30 | 2010-12-30 | International Business Machines Corporation | Message selector-chaining |
CN104239148B (en) * | 2013-06-06 | 2018-05-18 | 腾讯科技(深圳)有限公司 | A kind of distributed task dispatching method and device |
GB2518425A (en) * | 2013-09-20 | 2015-03-25 | Tcs John Huxley Europ Ltd | Messaging system |
CN108228327B (en) * | 2017-12-29 | 2021-01-15 | 北京奇虎科技有限公司 | Task processing method and device |
CN110581897A (en) * | 2019-09-30 | 2019-12-17 | 山东浪潮通软信息科技有限公司 | Method for realizing data interaction between two systems under unidirectional network environment |
CN111338797B (en) * | 2020-02-19 | 2023-09-05 | 望海康信(北京)科技股份公司 | Task processing method, device, electronic equipment and computer readable storage medium |
-
2021
- 2021-11-01 CN CN202111285284.XA patent/CN114003384B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US9436532B1 (en) * | 2011-12-20 | 2016-09-06 | Emc Corporation | Method and system for implementing independent message queues by specific applications |
CN104407922A (en) * | 2014-10-29 | 2015-03-11 | 中国建设银行股份有限公司 | Asynchronous batch-processing dispatching method and system |
CN107102894A (en) * | 2017-04-07 | 2017-08-29 | 百度在线网络技术(北京)有限公司 | Method for scheduling task, device and system |
CN107656825A (en) * | 2017-09-01 | 2018-02-02 | 上海艾融软件股份有限公司 | Message treatment method, apparatus and system |
Non-Patent Citations (2)
Title |
---|
A Publish/Subscribe Middleware for Body and Ambient Sensor Networks that Mediates between Sensors and Applications;Christian Seeger等;《2013 IEEE International Conference on Healthcare Informatics》;第199-208页 * |
消息中间件在船载监控系统中的应用研究;李丹等;《海洋技术》;第113-117页 * |
Also Published As
Publication number | Publication date |
---|---|
CN114003384A (en) | 2022-02-01 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US11356282B2 (en) | Sending cross-chain authenticatable messages | |
CN111447103B (en) | Virtual device management system, electronic device, virtual device management method, and medium | |
WO2021139788A1 (en) | Cloud gateway configuration method, system, apparatus, and computer readable storage medium | |
CN105468450A (en) | Task scheduling method and system | |
CN111897633A (en) | Task processing method and device | |
US11593188B2 (en) | Method and apparatus for providing asynchronicity to microservice application programming interfaces | |
CN112507029A (en) | Data processing system and data real-time processing method | |
CN109241009B (en) | Method for preventing file from being repeatedly uploaded and control method and device thereof | |
CN110210845B (en) | Method, apparatus, medium, and computing device for blockchain data migration | |
CN112860505B (en) | A distributed cluster control method and device | |
CN113590354B (en) | Block chain based information pushing method, device, equipment, medium and program product | |
CN112866421A (en) | Intelligent contract operation method and device based on distributed cache and NSQ | |
CN115567388A (en) | Network slice configuration automatic update method, system, device and storage medium | |
CN114003384B (en) | Task management method, device and equipment | |
CN110333916A (en) | Request message processing method, device, computer system and readable storage medium storing program for executing | |
CN109948332A (en) | A kind of physical machine login password remapping method and device | |
CN106357430A (en) | Method and system for service state monitoring of cloud computing cluster | |
CN115686813A (en) | Resource scheduling method and device, electronic equipment and storage medium | |
CN114448703B (en) | Request processing method, request processing device, electronic equipment and storage medium | |
CN117114613A (en) | A process engine, method, equipment and program product for business process control | |
CN115098528B (en) | Service processing method, device, electronic equipment and computer readable storage medium | |
CN117119078A (en) | Privacy task scheduling method and device based on Kubernetes cluster interconnection scheduling framework | |
CN115061891A (en) | System load capacity prediction method and device based on block chain | |
CN114911590A (en) | Task scheduling method and device, computer equipment and readable storage medium | |
CN112905321A (en) | Event response type task triggering method and device, electronic equipment and storage medium |
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 |