CN114003384A - Task management method, device and equipment - Google Patents

Task management method, device and equipment Download PDF

Info

Publication number
CN114003384A
CN114003384A CN202111285284.XA CN202111285284A CN114003384A CN 114003384 A CN114003384 A CN 114003384A CN 202111285284 A CN202111285284 A CN 202111285284A CN 114003384 A CN114003384 A CN 114003384A
Authority
CN
China
Prior art keywords
task
target
identifier
management table
state
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202111285284.XA
Other languages
Chinese (zh)
Other versions
CN114003384B (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.)
Beijing Shenyan Intelligent Technology Co ltd
Original Assignee
Beijing Shenyan Intelligent Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Shenyan Intelligent Technology Co ltd filed Critical Beijing Shenyan Intelligent Technology Co ltd
Priority to CN202111285284.XA priority Critical patent/CN114003384B/en
Publication of CN114003384A publication Critical patent/CN114003384A/en
Application granted granted Critical
Publication of CN114003384B publication Critical patent/CN114003384B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

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
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • G06F9/5038Allocation 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
    • 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/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • G06F9/4881Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues
    • 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)
  • 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 an access request sent by a consumer device at regular time; 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 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 a processing result of the target task corresponding to the target task identifier to producer equipment through a task callback address of a 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 additional dependence is added by introducing third-party message middleware.

Description

Task management method, device and equipment
Technical Field
The application relates to the field of computers, in particular to a method, a device and equipment for task management.
Background
At present, there are two main models for the distribution and calculation of processing tasks in the industry: one is a synchronous model, the production and consumption of calculation tasks are combined into one, and from the production of the tasks to the calculation, the calculation is in the same thread, the problem exists that the response time of the whole system is too long because the time required by large-scale calculation is long, and a user can only obtain a response when the calculation is completed or fails, and meanwhile, in the calculation completion process, the whole system can be hung up to wait for a calculation result, so that the system throughput is low. The other is an asynchronous model, the production and consumption of computing tasks are decoupled, and the production and computation of the tasks are performed 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 messaging middleware, such as kafka, which is a high throughput distributed publish-subscribe messaging system that can handle all the action flow data of consumers in a website, in such a way that tools are installed, adding additional dependency. For some scenarios where it is desirable to have fewer external dependent components as good, this approach increases the cost of dependence.
In view of the above problems, no effective solution has been proposed.
Disclosure of Invention
The embodiment of the application provides a method, a device and equipment for task management, and aims to at least solve the technical problem that additional dependence is added by introducing third-party message middleware.
According to an aspect of an embodiment of the present application, there is provided a method for task management, including: the task manager receives an access request sent by the consumer equipment at regular time; 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; 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; and uploading the target task identifier to the 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 includes: the task manager stores 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; the tasks in the task management table are sorted according to the priority, and the higher the priority is, the more the task is called to execute.
Optionally, the task manager stores the task registered by the producer device before the management table, and 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 verifying the user name and the password corresponding to the producer equipment, wherein after the verification is passed, the task corresponding to the task registration request is allowed to be registered, and the task information of the task corresponding to the task registration request is added into the task management table.
Optionally, the task information further includes: task timeout time; the method further comprises the following steps: and when the task reaching the task overtime exists in the task management table, uploading the task identifier of the task reaching the task overtime to the monitoring center.
Optionally, before determining the target task identifier from the task management table according to the priority of each task in the waiting state in the task management table, the method further includes: and the task manager receives the task type of the task requested by the task request, and inquires the task corresponding to the task type from the task management table according to the task type.
Optionally, determining a target task identifier from the task management table according to each task priority in a waiting state in the task management table, including: the task manager selects a preset number of task sets from high to low according to the task priority, wherein the tasks in the task sets are sorted according to the priority; 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 an 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 in the waiting state in the task management table under the trigger 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; sending 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 above-mentioned device still includes: 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; the tasks in the task management table are sorted according to the priority, and the higher the priority is, the more the task is called to execute.
According to another aspect of the embodiments of the present application, there is also provided an electronic device, including: a memory for storing program instructions; a processor, coupled to the memory, for invoking the program instructions stored by the memory and performing the steps of: receiving an access request sent by a consumer device at regular time; 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; sending 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 identifier to the 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 non-volatile storage medium, where the non-volatile storage medium includes a stored program, and the method for controlling a device in which the non-volatile storage medium is located to perform the above task management is performed when the program runs.
In the embodiment of the application, the traditional mode of passively sending the tasks to the consumer equipment when third-party message middleware is used is changed, the consumer equipment adopts a mode of actively polling the tasks to be processed in the task manager, the task manager sequences the tasks according to the types and the priority of the tasks and the task creation time, sends the tasks meeting the conditions to the consumer equipment for processing, the processing result of the task is sent to the producer equipment through a callback mechanism, so that the aims of improving the distribution efficiency, the system response time and the throughput of the calculation task are fulfilled, therefore, the technical effect of asynchronous processing of generation and consumption of the computing task is achieved, the state of the computing task is managed in a centralized mode, the capability of monitoring the state of the task is enhanced, and the technical problem that additional dependence is added by introducing a 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 embodiment(s) of the application and together with the description serve to explain the application and not to limit 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 diagram 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 flowchart of a method for determining a target task identity according to an embodiment of the present application;
fig. 5 is a block diagram of a task management apparatus according to an embodiment of the present application.
Detailed Description
In order to make the technical solutions better understood by those skilled in the art, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only partial embodiments of the present application, but not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
It should be noted that the terms "first," "second," and the like in the description and claims of this application and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the application described herein are capable of operation in sequences other than those illustrated or 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 a better understanding of the embodiments of the present application, technical terms referred to 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 needing to be processed exists or not, and processing the task after receiving the task sent by the task manager.
The producer: the data generation end is provided with software for generating tasks in the embodiment of the application, and the software is used for detecting the generation instructions of the tasks and splicing the instructions into task rules.
A task manager: in the embodiment of the application, the middleware connecting the producer and the consumer replaces a third-party middleware, provides various services, such as registration, distribution, notification, callback, reporting and the like, and completes interaction between the producer and the consumer.
In order to improve the distribution efficiency of the calculation tasks, the system response time and the throughput, the embodiment of the application realizes a task distribution model based on producers and consumers. The model is used for decoupling producer equipment and consumer equipment of large-scale calculation tasks, centrally managing the state of the tasks and monitoring alarms, realizing asynchronous processing of generation and consumption of the calculation tasks under the condition of not introducing external dependence, improving the efficiency and throughput of task distribution by the asynchronous processing and callback mechanism of the tasks, and establishing other calculation tasks again without waiting for completion of task calculation.
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 by the memory and performing the steps of: the task manager receives an access request sent by the consumer equipment at regular time, wherein the parameter of the access request is the task type; under the triggering of the access request, the task manager determines a target task identifier from the task management table according to the task priority in the waiting state in the task management table, sends the target task identifier to the 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 a 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 internally 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 an address link for designating 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 identifier to the monitoring center.
In the above operating environment, the embodiments of the present application provide an embodiment of a method for task management, it should be noted that the steps shown in the flowchart of the drawings may be executed in a computer system such as a set of computer executable instructions, and that although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in an order different from that shown.
Fig. 2 is a flowchart of a method for task management according to an embodiment of the present application, and as shown in fig. 2, the method includes the following steps:
step S202, a task manager receives an access request sent by consumer equipment at regular time, wherein the parameter of the access request is a task type;
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 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 device through the task callback address of the task corresponding to the target task identifier, wherein the callback address is an address link for appointing to jump back to the website;
and step S208, uploading the target task identifier to the monitoring center under the condition that the processing result of the target task is failure.
Through the steps, the mode that the tasks are passively sent to the consumer equipment when the third-party message middleware is used in the past is changed, the consumer equipment actively polls the tasks to be processed in the task manager, the task manager sequences the tasks according to the types, the task priorities and the task creation time of the tasks, 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 tasks are achieved, the technical effects of asynchronous processing of generation and consumption of the computing tasks are achieved, the states of the computing tasks are centrally managed, the monitoring capability of the task states is enhanced, and the technical problem that additional dependence is added when the third-party message middleware is introduced is solved.
Optionally, before step S202, in order to improve efficiency of the task manager in querying the target task, the task is registered and stored in the task management table in advance by the producer device, and when the task manager queries the target task, the target task does not need to be stored each time, and the task stored in the task management table can be directly called and queried, so that time is saved. The method comprises the following steps: the task manager stores 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; the tasks in the task management table are sorted according to the priority, and the higher the priority is, the more the task is called to execute.
Optionally, the task manager stores the task registered by the producer device before the management table, and 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 verifying the user name and the password corresponding to the producer equipment, wherein after the verification is passed, the task corresponding to the task registration request is allowed to be registered, and the task information of the task corresponding to the task registration request is added into the task management table.
Whether the device is a producer device or a consumer device, when the http requests the service of the task manager, if the request header has no token or the token fails, the token needs to be authenticated first, that is, the device requesting the service is checked first, the task manager calls/registers, and the request parameters include the user name and the password of the device requesting the service. And 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 are checked to be passed, the task manager returns a token with timeliness to the request device, the validity period of the default token is 20 minutes, and the user needs to be checked again after 20 minutes.
The producer equipment calls a task registration interface of the task manager to register the task, and parameters of a registration request comprise: name, the name of the task; type, i.e., the type of task; definition, namely definition information of the task, which is used as a reserved field for storing information describing the task; metadata, namely, related information of a task required when the consumer device executes a computing task, namely, rule information agreed between the producer device and the consumer device; callbacking Url, namely, the callback address, the consumer device finishes processing the task, and the task manager informs the producer device of the processing result and the state of the task through the callback address; priority, i.e., priority of the task.
Optionally, the task information further includes: task timeout time; the method further comprises the following steps: and when the task reaching the task overtime exists in the task management table, uploading the task identifier of the task reaching the task overtime to the monitoring center. Wherein, judging whether the task is overtime includes the following steps as shown in fig. 3:
step S302, the task manager regularly inquires the task with the task state as the waiting state in the task management table, and determines the task creation time, the overtime time and the current time;
step S304, when the sum of the task creating time and the overtime time is larger than the current time, determining that the task is not overtime;
step S306, when the sum of the task creating time and the overtime time is less than the current time, determining that the task is overtime, setting the overtime task state to be an overtime state by the task manager, and uploading the task identifier of the task in the overtime state to the monitoring center, wherein the task in the overtime state is the task reaching the task overtime time.
The steps S302 to S306 can be described by following examples, if the task state of the task a in the task management table is the waiting state, the creating time of the task a is 8, the timeout time is set to 30 minutes, the current time is 8 hours and 20 minutes, and since the sum of the creating 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 is 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, the creating time of the task B is 9, the overtime time is set to be 30 minutes, the current time is 9 hours and 40 minutes, and the time is less than the current time due to the fact that the sum of the creating time and the overtime time of the task B is 9 hours and 30 minutes, the task B is determined to be overtime, 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 in the waiting state in the task management table, the following processing steps may also be performed: and the task manager receives the task type of the task requested by the task request, and inquires the task corresponding to the task type from the task management table according to the task type. Specifically, the task request may further 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 also be determined according to the task identifier carried in the task request, 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 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, the target task identifier is determined from the task management table according to the priority of each task in the waiting state in the task management table, as shown in fig. 4, the method includes the following steps:
step S402, the task manager selects a preset number of task sets according to the sequence of the task priorities from high to low, wherein the tasks in the task sets are sorted according to the priorities;
s404, re-sequencing according to the task creation time of each task in the task set;
and 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 relevant tasks do not exist, the task manager informs the consumer device that the tasks are temporarily not needed to be processed; if there are related tasks, the task manager takes the tasks out of the task management table and sends the target tasks to the consumer device. After the consumer device obtains the target task, the task is processed according to the rule information stored in the metadata of the target task, after the processing is completed or the processing fails, the task state is uploaded to the task manager through the task identifier, the execution state of the task and the task processing result, the task manager calls a callback address provided by a registered task of the producer device before calling, the task processing result is transmitted to the producer device, and meanwhile, the execution state of the corresponding task is updated in the task management table according to the task identifier and the execution state of the task, wherein 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 identifier 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 and a task type of the task. 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 a task of a group circulant as an example, the method for managing the task shown in fig. 2-4 is explained in detail, firstly, a producer device creates a service interface of a crowd circulant rule, the circulant rule is converted into a corresponding json structure according to the json structure defined by the consumer device, corresponding request parameters such as timeout time, task type, group type segment and the like are set, the circulant rule is written into metadata parameters, and then the producer device calls a task registration interface of a task manager to register the task. Before a producer device requests a registration service provided by a task manager to perform task registration, 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 verifies the user name and the password corresponding to the producer device, after the verification is passed, 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 in a waiting state. And directly returning after the producer equipment produces the task, and setting the group state of the business party as a new state. The task manager detects whether there is OVERTIME task at regular time, the step corresponds to the step S302 to the step S306, if the task is judged to be OVERTIME, the task manager modifies the state of the task to OVERTIME, namely, 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 parameter is the type segment of the group, and whether there is a task of the group circulant waiting for calculation is checked, which corresponds to step S202. The task manager receives an access request of the consumer device, determines whether a task of a group circle person waiting for calculation exists in the task management table according to the task priority of each task in the waiting state in the task management table, and if the task of the group circle person needing to be calculated exists in the task management table, the task manager sends the identifier of the task to the consumer device for processing, and simultaneously modifies the state of the task corresponding to the task identifier into a calculating state, wherein the step corresponds to the step S204. The consumer equipment receives the tasks of the group circulant needing to be calculated, which are sent from the task manager, and takes the json structure with the circulant rule defined in advance from the parameters related to the transmitted tasks of the group circulant for processing. After the consumer device completes or fails to process, an interface provided by the task manager is called, meanwhile, a message which needs to be transmitted back to the producer device is put into a payload, and a calculation result is uploaded 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, and takes payload information as it is, calls the callback address of the group circulant service party, and notifies the producer of the processing result of the device task, which corresponds to S206 of the above step. Meanwhile, if the execution state of the task is failure, the task manager reports the task to the monitoring center, which corresponds to S208 of the above step. And processing the group circulant task in the group circulant callback interface, if the task processing is successful, updating the number of the circulants into the group table, and modifying the state of the group into segmentFinish (group calculation is completed), and if the task processing is failed, modifying the state of the group into segmentFail.
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, the apparatus including:
a receiving module 50, configured to receive an access request sent by a consumer device at regular time, where a parameter of the access request is a task type;
the processing module 52 is configured to, under the trigger of the access request, determine a target task identifier from the task management table according to the task priority of each 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; sending 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 for appointing to jump back to the 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 above-mentioned device still includes: 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; the tasks in the task management table are sorted according to the priority, and the higher the priority is, the more the task is called to execute.
It should be noted that the device for task management shown in fig. 5 is used to execute the method for task management shown in fig. 2 to 4, and therefore, the relevant explanation pages in the method for task management are applicable to the device for task management, and are not described herein again.
The embodiment of the application also provides a nonvolatile storage medium, which includes a stored program, wherein, when the program runs, the device where the nonvolatile storage medium is located is controlled to execute the following task management method:
the task manager receives an access request sent by the consumer equipment at regular time, wherein the parameter of the access request is the task type;
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;
the task manager sends a processing result of the target task corresponding to the target task identifier to the producer device through a task callback address of the task corresponding to the target task identifier, wherein the callback address is an address link used for appointing to jump back to the website;
and uploading the target task identifier to the monitoring center under the condition that the processing result of the target task is failure.
The above-mentioned serial numbers of the embodiments of the present application are merely for description and do not represent the merits of the embodiments.
In the above embodiments of the present application, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
In the embodiments provided in the present application, it should be understood that the disclosed technology can be implemented in other ways. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units may be a logical division, and in actual implementation, there may be another division, for example, multiple units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, units or modules, and may be in an electrical or other form.
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 can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application may be substantially implemented or contributed to by the prior art, or all or part of the technical solution may be embodied in a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic or optical disk, and other various media capable of storing program codes.
The foregoing is only a preferred embodiment of the present application and it should be noted that those skilled in the art can make several improvements and modifications without departing from the principle of the present application, and these improvements and modifications should also be considered as the protection scope of the present application.

Claims (10)

1. A method of task management, comprising:
the task manager receives an access request sent by the consumer equipment at regular time;
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 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 a processing result of the target task corresponding to the target task identifier to producer equipment through a task callback address of a 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.
2. The method of claim 1, wherein prior to the task manager receiving the access request periodically sent by the consumer device, the method further comprises:
the task manager stores the tasks registered by the producer device in the 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;
the tasks in the task management table are sorted according to priority, and the higher the priority is, the more the task is called to execute.
3. The method of claim 2, wherein the task manager stores the tasks registered by the producer device in a management table prior to the task manager storing the tasks in the 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 verifying the user name and the password corresponding to the producer equipment, wherein after the verification is passed, the task corresponding to the task registration request is allowed to be registered, and the task information of the task corresponding to the task registration request is added into the task management table.
4. The method of claim 2, wherein the task information further comprises: task timeout time; the method further comprises the following steps: and when the task reaching the task overtime time exists in the task management table, uploading the task identifier of the task reaching the task overtime time to the monitoring center.
5. The method of claim 1, wherein before determining the target task identifier from the task management table according to the priority of each waiting task in the task management table, the method further comprises: and the task manager receives the task type of the task requested by the task request, and inquires the task corresponding to the task type from the task management table according to the task type.
6. The method of claim 1, wherein determining a target task identifier from the task management table according to the priority of each waiting task in the task management table comprises:
the task manager selects a preset number of task sets according to the sequence of the task priorities from high to low, wherein the tasks in the task sets are sorted 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.
7. An apparatus for task management, comprising:
the receiving module is used for receiving an 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 waiting state in the task management table under the trigger of the access request, 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; sending a processing result of a target task corresponding to a target task identifier to producer equipment through a task callback address of a task corresponding to the target task identifier;
and 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.
8. The apparatus of claim 7, further comprising:
a storage module, configured to store the task registered by the producer device in the task management table, where task information of multiple 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 sorted according to priority, and the higher the priority is, the more the task is called to execute.
9. An electronic device, comprising:
a memory for storing program instructions;
a processor coupled to the memory for invoking the program instructions stored by the memory and performing the steps of: receiving an access request sent by a consumer device at regular time; 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 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; sending a processing result of a target task corresponding to a target task identifier to producer equipment through a task callback address of a 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.
10. A non-volatile storage medium, comprising a stored program, wherein when the program is executed, a device in which the non-volatile storage medium is located is controlled to perform the method of task management according to any one of claims 1 to 6.
CN202111285284.XA 2021-11-01 2021-11-01 Task management method, device and equipment Active CN114003384B (en)

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 true CN114003384A (en) 2022-02-01
CN114003384B 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)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115774564A (en) * 2022-11-03 2023-03-10 北京大学重庆大数据研究院 Task processing method and device and electronic equipment

Citations (11)

* Cited by examiner, † Cited by third party
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
CN104239148A (en) * 2013-06-06 2014-12-24 腾讯科技(深圳)有限公司 Distributed task scheduling method and device
CN104407922A (en) * 2014-10-29 2015-03-11 中国建设银行股份有限公司 Asynchronous batch-processing dispatching method and system
US20160219009A1 (en) * 2013-09-20 2016-07-28 Tcs John Huxley Europe Limited Messaging 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
CN108228327A (en) * 2017-12-29 2018-06-29 北京奇虎科技有限公司 A kind for the treatment of method and apparatus of task
CN110581897A (en) * 2019-09-30 2019-12-17 山东浪潮通软信息科技有限公司 Method for realizing data interaction between two systems under unidirectional network environment
CN111338797A (en) * 2020-02-19 2020-06-26 望海康信(北京)科技股份公司 Task processing method and device, electronic equipment and computer readable storage medium

Patent Citations (11)

* Cited by examiner, † Cited by third party
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
US9436532B1 (en) * 2011-12-20 2016-09-06 Emc Corporation Method and system for implementing independent message queues by specific applications
CN104239148A (en) * 2013-06-06 2014-12-24 腾讯科技(深圳)有限公司 Distributed task scheduling method and device
US20160219009A1 (en) * 2013-09-20 2016-07-28 Tcs John Huxley Europe Limited Messaging system
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
CN108228327A (en) * 2017-12-29 2018-06-29 北京奇虎科技有限公司 A kind for the treatment of method and apparatus of task
CN110581897A (en) * 2019-09-30 2019-12-17 山东浪潮通软信息科技有限公司 Method for realizing data interaction between two systems under unidirectional network environment
CN111338797A (en) * 2020-02-19 2020-06-26 望海康信(北京)科技股份公司 Task processing method and device, electronic equipment and computer readable storage medium

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
CHRISTIAN SEEGER等: "A Publish/Subscribe Middleware for Body and Ambient Sensor Networks that Mediates between Sensors and Applications", 《2013 IEEE INTERNATIONAL CONFERENCE ON HEALTHCARE INFORMATICS》, pages 199 - 208 *
李丹等: "消息中间件在船载监控系统中的应用研究", 《海洋技术》, pages 113 - 117 *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115774564A (en) * 2022-11-03 2023-03-10 北京大学重庆大数据研究院 Task processing method and device and electronic equipment

Also Published As

Publication number Publication date
CN114003384B (en) 2023-07-18

Similar Documents

Publication Publication Date Title
CN111447103B (en) Virtual device management system, electronic device, virtual device management method, and medium
US10048996B1 (en) Predicting infrastructure failures in a data center for hosted service mitigation actions
WO2021139788A1 (en) Cloud gateway configuration method, system, apparatus, and computer readable storage medium
US11120107B2 (en) Managing content delivery to client devices
CN110278256B (en) Block link point access uplink method, related equipment and system
CN113067850B (en) Cluster arrangement system under multi-cloud scene
US11593188B2 (en) Method and apparatus for providing asynchronicity to microservice application programming interfaces
US20230052935A1 (en) Asynchronous accounting method and apparatus for blockchain, medium and electronic device
CN114048264A (en) Consensus intelligent contract algorithm
CN111064626B (en) Configuration updating method, device, server and readable storage medium
CN111400041A (en) Server configuration file management method and device and computer readable storage medium
CN111147605B (en) Service registration method, device and equipment
CN109600240A (en) Group Communications method and device
CN114003384B (en) Task management method, device and equipment
CN110933188A (en) Remote service calling method, system, server and storage medium
CN109948332A (en) A kind of physical machine login password remapping method and device
CN110930253B (en) Method and device for generating main key inside intelligent contract, computer equipment and storage medium
CN115208900B (en) Multi-cloud architecture cloud service resource scheduling method based on blockchain and game model
CN114780228B (en) Hybrid cloud resource creation method and system
TWI772721B (en) System and method using blockchain to manage network devices
CN110768855B (en) Method and device for testing linkmzation performance
CN114448703B (en) Request processing method, request processing device, electronic equipment and storage medium
CN111711537B (en) Method, device and equipment for updating standby main node list
CN113220491B (en) Remote call self-adaptive load balancing method, device and system and computer equipment
LU101121B1 (en) Method for improving blockchain applications

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