CN108897610B - Task scheduling method, device, computer equipment and storage medium - Google Patents

Task scheduling method, device, computer equipment and storage medium Download PDF

Info

Publication number
CN108897610B
CN108897610B CN201810620400.0A CN201810620400A CN108897610B CN 108897610 B CN108897610 B CN 108897610B CN 201810620400 A CN201810620400 A CN 201810620400A CN 108897610 B CN108897610 B CN 108897610B
Authority
CN
China
Prior art keywords
task
group
decorator
scheduling
terminal
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201810620400.0A
Other languages
Chinese (zh)
Other versions
CN108897610A (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 Xingshenggong Technology Co ltd
Original Assignee
Beijing Xingshenggong 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 Xingshenggong Technology Co ltd filed Critical Beijing Xingshenggong Technology Co ltd
Priority to CN201810620400.0A priority Critical patent/CN108897610B/en
Publication of CN108897610A publication Critical patent/CN108897610A/en
Application granted granted Critical
Publication of CN108897610B publication Critical patent/CN108897610B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/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

Abstract

The application relates to a task scheduling method, a task scheduling device, computer equipment and a storage medium. The method comprises the following steps: receiving a development request for a service system sent by a terminal; the business system is provided with a corresponding business logic script; the business logic script comprises a plurality of entry functions corresponding to the entry function identifiers respectively; acquiring a task scheduling frame according to the development request; the task scheduling framework comprises a task decorator; receiving a first call request sent by a terminal, and sending a task decorator to the terminal according to the first call request, so that the terminal adds the task decorator corresponding to each entry function in a service logic script; converting the plurality of business functions into corresponding basic tasks respectively comprises: calling a task decorator corresponding to the entry function identifier; the task orchestrator is utilized to package the plurality of business functions into a plurality of basic tasks that execute asynchronously. By adopting the method, service level task scheduling can be realized without depending on an additional data table.

Description

Task scheduling method, device, computer equipment and storage medium
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a task scheduling method, a task scheduling device, a computer device, and a storage medium.
Background
The distributed task scheduling framework is mainly used for coordinating a framework for avoiding repeated processing of data when multiple nodes process the same task, and processing of a large number of tasks is shared through the nodes of the cluster. Developers can develop different business systems based on a distributed task scheduling framework. Business systems implement certain business functions based on a number of tasks. A developer needs to control the scheduling sequence of a plurality of tasks implementing different service functions.
There are many distributed task scheduling frameworks on the market, such as java-based quatertz, python (a programming language) -based cell, etc. But most of them can only control scheduling based on a single task, and lack concurrency control mechanism of a service level. If a developer desires to implement task scheduling of a business hierarchy based on a plurality of tasks, it is necessary to additionally maintain one or more data tables for recording scheduling sequences among tasks in the development process, which causes inconvenience to the developer.
Disclosure of Invention
In view of the foregoing, it is desirable to provide a task scheduling method, apparatus, computer device, and storage medium that can implement service level task scheduling without relying on an additional data table.
A method of task scheduling, the method comprising: receiving a service request sent by a terminal; the service request comprises an entry function identifier; identifying a function queue corresponding to the entry function identifier; the function queue comprises a plurality of business functions; converting a plurality of business functions into corresponding basic tasks respectively; invoking a group decorator corresponding to the entry function identifier, and encapsulating a plurality of basic tasks into task groups by using the group decorator; detecting whether the group decorator records a task group identifier; if yes, the task groups are packaged into corresponding task groups, scheduling sequences of the task groups are arranged in the task groups in advance, and scheduling execution is carried out on the task groups in the task groups based on the scheduling sequences.
In one embodiment, before converting the plurality of business functions into the corresponding basic tasks, the method further includes: receiving a development request for a service system sent by a terminal; the service system is provided with a corresponding service logic script; the business logic script comprises a plurality of entry functions corresponding to the entry function identifiers respectively; acquiring a task scheduling frame according to the development request; the task scheduling framework comprises a task decorator; receiving a first call request sent by a terminal, and sending the task decorator to the terminal according to the first call request, so that the terminal adds the task decorator corresponding to each entry function in the service logic script; converting the plurality of business functions into corresponding basic tasks respectively comprises: invoking a task decorator corresponding to the entry function identifier; and encapsulating the plurality of business functions into a plurality of basic tasks which are executed asynchronously by using the task decorator.
In one embodiment, the task scheduling framework further comprises a group decorator; before invoking the group decorator corresponding to the entry function identifier, the method further comprises: and receiving a second call request sent by the terminal, sending the group decorator to the terminal according to the second call request, enabling the terminal to add the group decorator corresponding to each entry function in a service logic script, and adding a task group identifier of a corresponding task group in the group decorator.
In one embodiment, the task scheduling framework further comprises a group container; the concurrent execution function and the asynchronous execution function are predefined in the group container; before the task groups are packaged into the corresponding task groups, the task groups are pre-arranged with the scheduling sequences of a plurality of task groups, the method further comprises the following steps: receiving a third call request sent by a terminal, sending the group container to the terminal according to the third call request, enabling the terminal to add a group container corresponding to each task group identifier in a service logic script based on the task group identifier configured in the group decorator, and predefining arrangement rules of a plurality of task groups which can be accommodated in the group container by utilizing the concurrent execution function and the asynchronous execution function; the orchestration rules include a concurrent and/or asynchronous scheduling order among the plurality of task group identifications.
In one embodiment, the task scheduling framework further comprises a log decorator; the method further comprises the steps of: receiving a fourth call request sent by a terminal, and sending the log decorator to the terminal according to the fourth call request, so that the terminal adds the log decorator corresponding to each entry function in a service logic script; scheduling the execution of the plurality of task groups in the task group based on the scheduling order includes: distributing a plurality of basic tasks corresponding to the task group to a plurality of servers in the group, enabling the servers to schedule and execute the basic tasks, generating a task log corresponding to each basic task, and inserting a corresponding task group identifier into the task log by using the log decorator; and when the task group is executed, merging task logs which are scattered on a plurality of servers and contain the same task group identification, and generating a service log corresponding to each task group identification.
In one embodiment, the group assembly decorator includes a status checker and a trash remover; scheduling the execution of the plurality of task groups in the task group based on the scheduling order includes: scheduling and executing a plurality of basic tasks corresponding to each task group in the task group according to a preset concurrent and/or asynchronous scheduling sequence of the task groups; monitoring the execution state of the corresponding task group by using the state checker, adding an abnormal mark to the task group with the execution state of failed execution, continuing to execute the subsequent task group, or canceling the execution of the task group corresponding to the task group with the execution state of failed execution; and acquiring the execution garbage corresponding to the task group with the execution state of failure, and cleaning the execution garbage by using the garbage cleaner.
In one embodiment, the group decorator includes a concurrency controller; scheduling the execution of the plurality of task groups in the task group based on the scheduling order includes: when receiving service requests sent by a plurality of terminals, respectively packaging and generating corresponding task groups according to each service request; the task group is provided with a corresponding task group identifier; counting the concurrent number of a plurality of task groups with the same task group identification, which are requested to be executed; judging whether the concurrency quantity exceeds a concurrency threshold; if yes, splitting a plurality of task groups with the same task group identification into a plurality of batches for dispatch and execution by using the concurrency controller according to the concurrency threshold.
A task scheduling device, comprising: the task conversion module is used for receiving the service request sent by the terminal; the service request comprises an entry function identifier; identifying a function queue corresponding to the entry function identifier; the function queue comprises a plurality of business functions; converting a plurality of business functions into corresponding basic tasks respectively; the task packaging module is used for calling a group decorator corresponding to the entry function identifier and packaging a plurality of basic tasks into task groups by utilizing the group decorator; the scheduling module is used for detecting whether the group assembly decorator records a task group identifier; if yes, the task groups are packaged into corresponding task groups, scheduling sequences of the task groups are arranged in the task groups in advance, and scheduling execution is carried out on the task groups in the task groups based on the scheduling sequences.
A computer device comprising a memory storing a computer program and a processor which when executing the computer program performs the steps of: receiving a service request sent by a terminal; the service request comprises an entry function identifier; identifying a function queue corresponding to the entry function identifier; the function queue comprises a plurality of business functions; converting a plurality of business functions into corresponding basic tasks respectively; invoking a group decorator corresponding to the entry function identifier, and encapsulating a plurality of basic tasks into task groups by using the group decorator; detecting whether the group decorator records a task group identifier; if yes, the task group is packaged into a corresponding task group, and the scheduling sequence of a plurality of task groups is pre-arranged in the task group; and the task scheduling module is used for scheduling and executing a plurality of task groups in the task group based on the scheduling sequence.
A computer readable storage medium having stored thereon a computer program which when executed by a processor performs the steps of: receiving a service request sent by a terminal; the service request comprises an entry function identifier; identifying a function queue corresponding to the entry function identifier; the function queue comprises a plurality of business functions; converting a plurality of business functions into corresponding basic tasks respectively; invoking a group decorator corresponding to the entry function identifier, and encapsulating a plurality of basic tasks into task groups by using the group decorator; detecting whether the group decorator records a task group identifier; if yes, the task groups are packaged into corresponding task groups, scheduling sequences of the task groups are arranged in the task groups in advance, and scheduling execution is carried out on the task groups in the task groups based on the scheduling sequences.
According to the task scheduling method, the task scheduling device, the computer equipment and the storage medium, when the service request sent by the terminal based on the service system is received, the function queue corresponding to the entry function identifier can be identified according to the entry function identifier carried by the service request; after the business functions in the function queue are respectively converted into corresponding basic tasks, a group decorator corresponding to the entry function identifier can be called to package the basic tasks into task groups; according to whether the task group identifier is recorded by the group assembly decorator, packaging the task group into a corresponding task group; because the task group schedules the scheduling sequence of the task groups in advance, the task groups in the task group can be scheduled and executed according to the scheduling sequence, so as to respond to the service request. Because the group decorator is integrated in advance in the service system, the group decorator provides task packaging and scheduling sequence arranging capability, a plurality of scattered basic tasks are packaged into task groups or task groups capable of realizing certain service functions according to service logic, and further, task scheduling can be realized from a service level without additional maintenance of a data table.
Drawings
FIG. 1 is an application scenario diagram of a task scheduling method in one embodiment;
FIG. 2 is a flow diagram of a task scheduling method in one embodiment;
FIG. 3 is a frame diagram of a task scheduling frame in one embodiment;
FIG. 4 is a flow chart illustrating the steps of traffic scheduling in one embodiment;
FIG. 5 is a block diagram of a task scheduler in one embodiment;
fig. 6 is an internal structural diagram of a computer device in one embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application will be further described in detail with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the present application.
The task scheduling method provided by the application can be applied to an application environment shown in fig. 1. Wherein the terminal 102 communicates with the server 104 via a network. The terminal 102 may be, but not limited to, various personal computers, notebook computers, smartphones, tablet computers, and portable wearable devices, and the server 104 may be implemented by a stand-alone server or a server cluster composed of a plurality of servers. A service system is deployed on the terminal 102. The business system is a software product developed based on a task scheduling framework provided by the application. The business system has a corresponding business logic script. The business logic script includes a plurality of entry functions, each of which integrates a task decorator and a group decorator provided by the task scheduling framework. When a user sends a service request based on a service system at the terminal 102, the terminal 102 sends the service request to the server 104. The service request contains an entry function identification. The server 104 obtains a corresponding function queue according to the entry function identifier. The function queue includes a plurality of business functions. The server 104 invokes the task orchestrator corresponding to the entry function identifier to convert the plurality of business functions to corresponding base tasks, respectively. The server 104 invokes the group decorator corresponding to the entry function identification, encapsulating the plurality of base tasks into task groups with the group decorator. The server 104 detects whether the group assembly decorator has recorded a task group identification. If the task group identifier is recorded, the task group needs to be further packaged together with other task groups into a task group, the server 104 packages the task group into a corresponding task group, and the task group is pre-arranged with the scheduling sequence of a plurality of task groups. Server 104 performs scheduling of a plurality of task groups within a task group based on the scheduled scheduling order in response to the service request. In the task scheduling process, the group decorator is integrated in the service system in advance, and the group decorator provides task packaging and scheduling sequence arrangement capability, so that a plurality of scattered basic tasks are packaged into task groups or task groups capable of realizing certain service functions according to service logic, further, task scheduling can be realized from a service level without additional maintenance of a data table, and the development efficiency of the service system can be improved.
In one embodiment, as shown in fig. 2, a task scheduling method is provided, and the method is applied to the server in fig. 1 for illustration, and includes the following steps:
step 202, receiving a service request sent by a terminal; the service request contains an entry function identification.
Step 204, identifying a function queue corresponding to the entry function identifier; the function queue includes a plurality of business functions.
The terminal is provided with a service system. The business system is a software product developed based on a task scheduling framework provided by the application. The business system implements a certain business function based on a plurality of business functions. For convenience of description, a plurality of service functions that collectively implement one service function are referred to as a function queue. The business system has a corresponding business logic script. The business logic script includes a plurality of function queues. Different function queues implement different service functions. It is readily understood that business system developers can be freely defined for the partitioning dimension of business functions. When the business logic of the business system is changed, the function queues corresponding to part or all of the business functions are correspondingly changed. The plurality of business functions in the function queue are arranged according to a scheduling sequence, wherein the business function of the first scheduling sequence is called an entry function.
When a user performs service operation on a service system at a terminal, the terminal generates a corresponding service request according to the service operation of the user and sends the service request to a server. The service request carries an entry function identifier corresponding to the entry function for realizing the corresponding service function. The server queries the corresponding entry function according to the entry function identification, and further queries the corresponding function queue according to the entry function. It is easy to understand that the same service request needs to implement the same service function, so that the corresponding function queues are the same.
And 206, converting the plurality of business functions into corresponding basic tasks respectively.
As shown in fig. 3, the task scheduling framework provided by the present application includes a task decorator. The task orchestrator is used for converting the business functions into corresponding basic tasks. The basic Task is "Task" in fig. 3. In a business system developed based on the task scheduling framework, each entry function has a corresponding task decorator. When an entry function corresponding to a certain business function is triggered, the server calls a task decorator corresponding to the entry function, and the task decorator is utilized to respectively convert a plurality of business functions in a function queue corresponding to the entry function into corresponding basic tasks. The plurality of base tasks executing asynchronously form a task queue. The Task queue is the "Task queue" in fig. 3. Different users can trigger the same service request based on the service system at the same time, so as to form a plurality of concurrent task queues.
And step 208, calling a group decorator corresponding to the entry function identifier, and packaging a plurality of basic tasks into task groups by using the group decorator.
As shown in fig. 3, the task scheduling framework provided in the present application further includes a group decorator. The group decorator is used for packaging a plurality of basic tasks in a task queue into corresponding task groups. The task group is "Job" in fig. 3. Each task group has a corresponding task group identification. In a business system developed based on the task scheduling framework, each entry function has a corresponding group decorator. When a task decorator corresponding to a certain entry function is triggered, the server identifies a task queue corresponding to the entry function, calls a group decorator corresponding to the entry function identifier, and encapsulates the task queue into a corresponding task group by using the group decorator. When different users trigger the same service request based on the service system at the same time, the server responds to each service request in the mode, packages and generates corresponding task groups respectively, and executes a plurality of task groups with the same task group identification simultaneously.
In another embodiment, the task decorator and the group decorator respectively have corresponding configuration pages, and when a developer invokes the task scheduling framework, the developer can configure corresponding parameters on the configuration pages, so that the decorator configuration operation can be simplified, and the service system development is further simplified.
Step 210, it is detected whether the group decorator records a task group identifier.
As shown in fig. 3, the task scheduling framework provided in the present application further includes a group container. The group container is used for packaging a plurality of task groups into corresponding task groups. The task group is "assignment" in fig. 3. The group container has a corresponding task group identification. The group container predefines an orchestration rule for the scheduling order among the plurality of task groups. The orchestration rules include an asynchronous and/or concurrent scheduling order among the multiple task group identifications.
The server detects whether the group decorator records a task group identification. If the group decorator records the task group identifier, the task group is required to be further packaged together with other task groups into a task group. If the task group identifier is not recorded in the group decorator, the task group is not required to be further packaged, and the follow-up service scheduling can be directly performed based on the task group so as to respond to the service request sent by the terminal.
And step 212, if yes, packaging the task groups into corresponding task groups, pre-arranging scheduling sequences of the task groups in the task groups, and scheduling and executing the task groups in the task groups based on the scheduling sequences.
The server judges which task group the task group is packaged to according to the task group identification in the group packager. The server can judge the scheduling sequence of the task group and other task groups according to the task group identification in the group wrapper and the predefined scheduling rules in the corresponding group container. The server responds to the service request sent by the terminal based on the task group. Specifically, the server performs scheduling execution on a plurality of task groups in the task group according to scheduling sequences of the plurality of task groups preset in the task group. And the server distributes a plurality of basic tasks corresponding to the task group in the current scheduling sequence to a plurality of servers in the cluster for execution.
In this embodiment, when a service request sent by a terminal based on a service system is received, according to an entry function identifier carried by the service request, a function queue corresponding to the entry function identifier may be identified; after the business functions in the function queue are respectively converted into corresponding basic tasks, a group decorator corresponding to the entry function identifier can be called to package the basic tasks into task groups; according to whether the task group identifier is recorded by the group assembly decorator, packaging the task group to the corresponding task group; because the task group schedules the scheduling sequence of the task groups in advance, the task groups in the task group can be scheduled and executed according to the scheduling sequence, so as to respond to the service request. Because the group decorator is integrated in advance in the service system, the group decorator provides task packaging and scheduling sequence arranging capability, a plurality of scattered basic tasks are packaged into task groups or task groups capable of realizing certain service functions according to service logic, and further, task scheduling can be realized from a service level without additional maintenance of a data table.
In one embodiment, before converting the plurality of business functions into the corresponding basic tasks, respectively, the method further includes: receiving a development request for a service system sent by a terminal; the business system is provided with a corresponding business logic script; the business logic script comprises a plurality of entry functions corresponding to the entry function identifiers respectively; acquiring a task scheduling frame according to the development request; the task scheduling framework comprises a task decorator; receiving a first call request sent by a terminal, and sending a task decorator to the terminal according to the first call request, so that the terminal adds the task decorator corresponding to each entry function in a service logic script; converting the plurality of business functions into corresponding basic tasks respectively comprises: calling a task decorator corresponding to the entry function identifier; the task orchestrator is utilized to package the plurality of business functions into a plurality of basic tasks that execute asynchronously.
When a developer invokes the task scheduling framework provided by the application to develop the service system, a development request of the service system can be sent to a server through a terminal. And the server acquires the task scheduling framework according to the development request. The server returns a task decorator to the terminal based on the first call request sent by the terminal. The terminal adds a task decorator at each entry function of the business logic script. Specifically, a callback function corresponding to the task decorator is added in the entry function, a callback object of the callback function is set as the task decorator, and callback conditions of the callback function are set as the entry function to be triggered and executed. When the entry function is triggered to be executed, a callback instruction for the corresponding task decorator is generated through the callback function, the server can call the corresponding task decorator according to the callback instruction, and each business function in the entry function corresponding function queue is packaged into a corresponding basic task through the task decorator.
In actual business operations, failure to execute a basic task in a task queue often results in the entire task queue stalling execution but continuing to occupy the thread of execution. For example, the task12 in the task queue 1 needs the execution result of the task22 in the task queue 2 as input, and if the task22 fails to execute, the task12 is waiting for the execution result of the task22 all the time, so that the whole task queue 1 falls into a deadlock state. For the situation, the traditional mode only can rely on a developer to perform manual processing according to the task scheduling log, so that the exception handling efficiency is low, exception discovery and handling are not timely, and further the waste of thread resources is caused.
To address the above, in another embodiment, the task orchestrator provides exception capture logic. Specifically, each basic task has a corresponding execution duration. When the task decorator is scheduled, the task decorator monitors the execution status of a plurality of basic tasks in the generated task queue. When it is monitored that a certain basic task fails to be executed before the execution duration reaches or is not executed when the execution duration reaches, an abnormal mark is added for the basic task, other basic tasks are continuously executed or the whole task queue is finished to be executed according to a preset execution logic, and corresponding processing is timely carried out on the basic task with the failed execution, so that execution resources corresponding to the basic task with the failed execution can be timely released.
In this embodiment, the task scheduling framework provides a task decorator. The business system developed based on the task scheduling framework can integrate the task decorator in advance, and the task decorator provides the task conversion capability, namely, the business function is converted into a basic task, and a packaging object is provided for task packaging.
In one embodiment, the task scheduling framework further comprises a group decorator; before calling the group decorator corresponding to the entry function identifier, the method further comprises: and receiving a second call request sent by the terminal, and sending the group decorator to the terminal according to the second call request, so that the terminal adds the group decorator corresponding to each entry function in the service logic script, and adds the task group identifier of the corresponding task group in the group decorator.
When a developer invokes the task scheduling framework provided by the application to develop the service system, a development request of the service system can be sent to a server through a terminal. And the server acquires the task scheduling framework according to the development request. The server returns the group assembly decorator to the terminal based on the second call request sent by the terminal. The implementation script corresponding to the group decorator can be:
def invoke_partition_job(
basic tasks corresponding to run_executor_task, run_executor_params, and/entry functions
status_scanner=none, status_scanner_params=none,// status checker
pre_aspect=none, pre_aspect_params=none,// pre-checker
cancelation_action=none, cancelation_action_params=none,// garbage cleaner
concurrency=2,// concurrency threshold
Transmission_id=none,// task group identification
parent_job_id=none,// task group identification
skip_error=false,// exception handling switch
sub_job_timeout=conf.SUB_JOB_DEFAULT_TIMEOUT)
The group decoration device comprises a plurality of components, such as a state inspector, a front inspector, a garbage cleaner and the like. The state inspector, the front-end inspector, the garbage cleaner and the like are respectively provided with corresponding realization scripts. The state checker is used for checking the execution state of the task group generated by the package. The pre-checker is configured to detect whether the current task group satisfies an execution condition. The garbage cleaner is used for cleaning garbage when the current task group is canceled to be executed. The group decorator also records a plurality of functional parameters, such as concurrency threshold value concurrency of the current task group, task group identification parent_job_id of the corresponding task group, and the like. It should be noted that, the implementation script corresponding to the group decorator is given only by way of example, and some logic codes are given to facilitate the reader to understand the implementation logic, and specific logic codes include but are not limited to this.
The terminal adds a group assembly decorator at each entry function of the business logic script. Specifically, the terminal adds a callback function corresponding to the group assembly decorator in the entry function, sets a callback object of the callback function as the group assembly decorator, and sets a callback condition of the callback function as a task queue corresponding to the entry function. The terminal configures a plurality of constituent elements and various parameters in the group decorators corresponding to each entry function so as to realize the group decorators corresponding to different packaging logics aiming at different entry functions. In other words, the entry functions may correspond to different group decorators. When the entry function is triggered to be executed, a callback instruction for the corresponding group decorator is generated through the callback function, the server can call the corresponding group decorator according to the callback instruction, the group decorator identifies a task queue corresponding to the entry function, and a plurality of basic tasks in the task queue are packaged into corresponding Jobs.
In this embodiment, the task scheduling framework provides a group decorator. The business system developed based on the task scheduling framework may be pre-integrated with the group decorator. The group decorator provides task packaging capability, and can package a plurality of scattered basic tasks into task groups or task groups capable of realizing certain service functions according to service logic, so that task scheduling can be realized from a service level without additional maintenance of a data table, and service system development is simplified.
In one embodiment, the task scheduling framework further comprises a group container; the concurrent execution function and the asynchronous execution function are predefined in the group container; before the task groups are packaged into the corresponding task groups, the task groups are pre-arranged with the scheduling sequences of the task groups, and the method further comprises the following steps: receiving a third call request sent by the terminal, sending a group container to the terminal according to the third call request, enabling the terminal to add a group container corresponding to each task group identifier in a service logic script based on the task group identifier configured in the group decorator, and predefining arrangement rules of a plurality of task groups capable of being accommodated in the group container by utilizing a concurrent execution function and an asynchronous execution function; the orchestration rules include a concurrent and/or asynchronous scheduling order among the multiple task group identifications.
For some service functions, only a plurality of basic tasks are required to be packaged into task groups, and subsequent task scheduling is performed based on the task groups. If a certain business function is complex, a plurality of task groups are needed to jointly realize the certain business function, and then a developer can further package the plurality of task groups into task groups. It is easy to understand that for the division dimension of business functions, the developer can be defined freely.
When a developer invokes the task scheduling framework provided by the application to develop the service system, a development request of the service system can be sent to a server through a terminal. And the server acquires the task scheduling framework according to the development request. If a certain task group needs to be packaged, the developer can send a third call request to the server through the terminal. The server returns the group container to the terminal based on the third call request. And the developer adds the group container to the business logic script at the terminal and configures a task group identifier corresponding to the group container. The group container is used for packaging a plurality of task groups into task groups. In other words, the group container is used to accommodate a plurality of task groups, which are the packaging objects of the corresponding group container. As shown in the implementation script of the group encapsulator, the developer adds the task group identification transmission_id to the group encapsulator corresponding to each encapsulation object at the terminal so as to establish the encapsulation relation between the task groups. Multiple group containers may be added to the business logic script. According to the task group identification in the group wrapper, it can be determined to which task group the task group is to be wrapped.
The group container itself provides concurrent execution functions and asynchronous execution functions in the task scheduling framework. After adding the group container to the business logic script, the developer may predefine scheduling rules for scheduling sequences among the plurality of task groups in the group container using the concurrent execution function and the asynchronous execution function. The orchestration rules include a plurality of task group identifications, and a scheduling order for asynchronous and/or concurrent execution among the plurality of task group identifications. The group container may support asynchronous execution and/or concurrent execution of multiple task groups in response to more complex business needs. For example, when the task group transmission includes four task groups of Job1, job2, job3 and Job4, the scheduling sequence of the four task groups may be that Job1 and Job2 are concurrently executed and then Job3 and Job4 are concurrently executed after completion of execution of Job1, or that Job2 and Job3 are concurrently executed and then Job4 are concurrently executed after completion of execution of Job1, so that the requirement of the business system on multiple complex business scenes can be met similarly.
In this embodiment, the task scheduling framework provides a group container. Business systems developed based on the task scheduling framework may be pre-integrated into a group container. The group container provides scheduling sequence arrangement capability, and after scattered basic tasks are packaged according to service logic, scheduling sequences of different task groups are further arranged, so that concurrency control of a service level can be realized.
In one embodiment, the task scheduling framework further comprises a log decorator; the method further comprises the steps of: receiving a fourth call request sent by the terminal, and sending the log decorator to the terminal according to the fourth call request, so that the terminal adds the log decorator corresponding to each entry function in the service logic script; scheduling execution of a plurality of task groups within a task group based on a scheduling order includes: distributing a plurality of basic tasks corresponding to the task group to a plurality of servers in the group, enabling the servers to schedule and execute the plurality of basic tasks, generating a task log corresponding to each basic task, and inserting a corresponding task group identifier into the task log by using a log decorator; and when the task group is executed, merging task logs which are scattered on a plurality of servers and contain the same task group identification, and generating a service log corresponding to each task group identification.
When the service system adopting the distributed task scheduling mode performs service processing, a plurality of basic tasks may be distributed to a plurality of servers or different virtual machines of the same server for execution, so that task logs generated by executing the different basic tasks are scattered in the plurality of servers or the plurality of virtual machines, and further, a developer can only see the task level scheduling condition of scattered black boxes. However, developers are usually only concerned with task scheduling at the business level, which causes great inconvenience to the developers in consulting the log.
In order to solve the above problems, the task scheduling framework provided by the present application further provides a log decorator. It will be readily appreciated that the log decorator may also exist in the form of a stand-alone log system that provides an interface to the business system. The log decorator enables the business system to log from the business dimension, i.e. to control the centralized presentation of task logs of a plurality of basic tasks implementing the same business function.
When a developer invokes the task scheduling framework provided by the application to develop the service system, a development request of the service system can be sent to a server through a terminal. And the server acquires the task scheduling framework according to the development request. The server returns a log decorator to the terminal based on the fourth call request. The developer adds a log decorator at each entry function of the business logic script through the terminal. The same entry function corresponds to a plurality of business functions in the function queue corresponding to the same log decorator. And the developer indicates the processing mode of the log in the deployed log decorator through the terminal. The log decorator has a plurality of different log processing modes, such as generating a log corresponding to each task group, or generating a log corresponding to each task group. And adding a corresponding task group identifier or task group identifier in the log decorator according to the appointed log processing mode.
The server performs scheduling execution on the task groups in the task group according to scheduling sequences of the task groups which are preset in the task group. And the server distributes a plurality of basic tasks corresponding to the task group in the current scheduling sequence to a plurality of servers in the cluster for execution. When the basic task is executed, a corresponding task log is generated, a corresponding log decorator is called, and the corresponding task group identifier or task group identifier and the like are inserted into the task log by the log decorator according to a specified log processing mode. When a certain service is executed, the log decorator collects a plurality of task logs with the same task group identification or task group identification in a plurality of servers or a plurality of virtual machines executing the service, integrates the collected plurality of task logs, generates a service log corresponding to each task group identification or task group identification, and returns the service log to the terminal for display.
In this embodiment, the task scheduling framework provides a log decorator. Business systems developed based on the task scheduling framework may be pre-journaled with decorators. The log decorator provides the capability of collecting logs from the service level, and after a plurality of servers execute basic tasks to generate scattered task logs, the log decorator automatically collects and integrates the logs from the service level, so that the problem of inconvenient log consulting caused by log scattering of a service system is solved.
In one embodiment, the cluster trim includes a status checker and a trash remover. As shown in fig. 4, the step of scheduling the plurality of task groups in the task group based on the scheduling order, that is, the service scheduling includes:
and step 402, scheduling and executing a plurality of basic tasks corresponding to each task group in the task group according to a preset concurrent and/or asynchronous scheduling sequence of the task groups.
Step 404, monitoring the execution state of the corresponding task group by using a state checker, adding an abnormal mark to the task group whose execution state is the execution failure, and continuing to execute the subsequent task group or canceling the execution of the task group corresponding to the task group whose execution state is the execution failure.
And 406, acquiring the execution garbage corresponding to the task group with the execution state of failure, and cleaning the execution garbage by using a garbage cleaner.
The group decorator includes a plurality of components such as a status checker and a trash remover. As shown in the implementation script of the group decorator, the group decorator also records the SKIP_ERROR attribute value. The state checker is used for checking the execution state of the task group generated by the package and performing exception handling according to the SKIP_ERROR attribute value. Canceling execution or execution failure task group as execution garbage can occupy server resources, and in order to reduce occupation of the execution garbage to the server resources, the garbage cleaner timely cleans the execution garbage. When the group decorator is added to the business logic script, a developer can configure the SKIP_ERROR attribute value in the group decorator through the terminal. If the SKIP_ERROR attribute value is a first preset value, the state checker adds an abnormal mark in a service log corresponding to the task group when detecting that the currently executed task group fails to execute, and continues to execute the subsequent task group. If the SKIP_ERROR attribute value is a second preset value, the state checker cancels executing the task group corresponding to the task group when detecting that the currently executed task group fails to execute. It is to be understood that the abnormality processing logic of the status checker is not limited to this, and may cancel execution of the entire task group when it detects that the execution of a specific task group fails.
When the server performs scheduling execution on a plurality of task groups in the task group according to the scheduling sequence of the plurality of task groups which are pre-arranged in the task group, the state inspector monitors the execution state of the corresponding task group, performs exception handling according to the monitoring result and the SKIP_ERROR attribute value, and invokes the garbage cleaner to timely release execution resources corresponding to the task group which fails to execute.
In this embodiment, the state checker performs corresponding processing on the task group with execution failure in time, so that execution resources corresponding to the task group with execution failure can be released in time, timeliness of exception discovery and processing is improved, and resource waste of a server is reduced.
In one embodiment, a cluster assembly decorator includes a concurrency controller; scheduling execution of a plurality of task groups within a task group based on a scheduling order includes: when receiving service requests sent by a plurality of terminals, respectively packaging and generating corresponding task groups according to each service request; the task group has a corresponding task group identifier; counting the concurrent number of a plurality of task groups with the same task group identification, which are requested to be executed; judging whether the concurrency quantity exceeds a concurrency threshold; if yes, splitting a plurality of task groups with the same task group identification into a plurality of batches for dispatch and execution by using the concurrency controller according to the concurrency threshold.
When different users trigger the same service request based on the service system at the same time, the server responds to each service request in the mode, packages and generates corresponding task groups respectively, and executes a plurality of task groups with the same task group identification simultaneously. For convenience of description, a distinguishing identifier may be added to a plurality of task groups having the same task group identifier to distinguish them. The distinguishing mark may be a number or the like. For example, as shown in fig. 3, 3 concurrent jobs 3 may be distinguished as Job31, job32, and Job33.
The group assembly decorator comprises a plurality of components, such as concurrent controllers and the like. The concurrency controller is used for controlling the concurrency quantity of task groups with the same task group identification not to exceed a concurrency threshold. The concurrency threshold can be dynamically set according to the current load of the server, or can be statically set according to the data volume of the corresponding task group. When receiving service requests sent by a plurality of terminals, the server counts the concurrency quantity of a plurality of task groups with the same task group identification and judges whether the concurrency quantity exceeds a concurrency threshold. If the concurrency threshold is exceeded, the concurrency controller splits the task groups with the same task group identification into a plurality of batches according to factors such as the receiving time of the plurality of service requests or the task quantity of the plurality of task groups, so as to ensure that the concurrency quantity of the task groups in each batch does not exceed the concurrency threshold. The server dispatches and executes the task groups according to the batch sequence.
In this embodiment, the service system with the concurrent controller integrated in advance can simultaneously satisfy the same service requests of multiple users, but simultaneously control the concurrent number of task groups with the same task group identifier by combining with the server resource occupation condition, so as to avoid task blocking caused by overload of the server due to overlarge task quantity, thereby ensuring task execution efficiency and task execution safety.
It should be understood that, although the steps in the flowcharts of fig. 2 and 4 are shown in order as indicated by the arrows, these steps are not necessarily performed in order as indicated by the arrows. The steps are not strictly limited to the order of execution unless explicitly recited herein, and the steps may be executed in other orders. Moreover, at least some of the steps in fig. 2 and 4 may include multiple sub-steps or phases that are not necessarily performed at the same time, but may be performed at different times, nor does the scheduling order of the sub-steps or phases necessarily proceed sequentially, but may be performed alternately or alternately with at least a portion of the sub-steps or phases of other steps or other steps.
In one embodiment, as shown in fig. 5, there is provided a task scheduling device, including: a task conversion module 502, a task encapsulation module 504, a scheduling module 506, and a task scheduling module 508, wherein:
the task conversion module 502 is configured to receive a service request sent by a terminal; the service request contains an entry function identifier; identifying a function queue corresponding to the entry function identifier; the function queue comprises a plurality of business functions; and respectively converting the plurality of business functions into corresponding basic tasks.
The task encapsulation module 504 is configured to call a group decorator corresponding to the entry function identifier, and encapsulate the plurality of basic tasks into a task group by using the group decorator.
A scheduling module 506, configured to detect whether the task group identifier is recorded by the group assembly decorator; if yes, the task group is packaged into a corresponding task group, and the scheduling sequence of a plurality of task groups is pre-arranged in the task group.
The task scheduling module 508 is configured to schedule execution of a plurality of task groups in the task group based on a scheduling order.
In one embodiment, the apparatus further includes a task decorator deployment module 510, configured to receive a development request for a service system sent by a terminal; the business system is provided with a corresponding business logic script; the business logic script comprises a plurality of entry functions corresponding to the entry function identifiers respectively; acquiring a task scheduling frame according to the development request; the task scheduling framework comprises a task decorator; receiving a first call request sent by a terminal, and sending a task decorator to the terminal according to the first call request, so that the terminal adds the task decorator corresponding to each entry function in a service logic script; converting the plurality of business functions into corresponding basic tasks respectively comprises: calling a task decorator corresponding to the entry function identifier; the task orchestrator is utilized to package the plurality of business functions into a plurality of basic tasks that execute asynchronously.
In one embodiment, the task scheduling framework further comprises a group decorator; the device further includes a group decorator deployment module 512, configured to receive a second call request sent by the terminal, send the group decorator to the terminal according to the second call request, so that the terminal adds the group decorator corresponding to each entry function in the service logic script, and adds the task group identifier of the corresponding task group in the group decorator.
In one embodiment, the task scheduling framework further comprises a group container; the concurrent execution function and the asynchronous execution function are predefined in the group container; the device further includes a group container deployment module 514, configured to receive a third call request sent by the terminal, send a group container to the terminal according to the third call request, make the terminal add a group container corresponding to each task group identifier in the service logic script based on the task group identifier configured in the group decorator, and predefine an arrangement rule of a plurality of task groups that can be accommodated in the group container by using a concurrent execution function and an asynchronous execution function; the orchestration rules include a concurrent and/or asynchronous scheduling order among the multiple task group identifications.
In one embodiment, the task scheduling framework further comprises a log decorator; the device further includes a log decorator deployment module 516, configured to receive a fourth call request sent by the terminal, and send the log decorator to the terminal according to the fourth call request, so that the terminal adds a log decorator corresponding to each entry function in the service logic script; scheduling execution of a plurality of task groups within a task group based on a scheduling order includes: distributing a plurality of basic tasks corresponding to the task group to a plurality of servers in the group, enabling the servers to schedule and execute the plurality of basic tasks, generating a task log corresponding to each basic task, and inserting a corresponding task group identifier into the task log by using a log decorator; and when the task group is executed, merging task logs which are scattered on a plurality of servers and contain the same task group identification, and generating a service log corresponding to each task group identification.
In one embodiment, the group assembly decorator includes a status checker and a trash remover; the task scheduling module 508 is further configured to schedule and execute a plurality of basic tasks corresponding to each task group in the task group according to a preset concurrent and/or asynchronous scheduling sequence of the plurality of task groups; monitoring the execution state of the corresponding task group by using a state checker, adding an abnormal mark to the task group with the execution state of failed execution, continuing to execute a subsequent task group, or canceling execution of a task group corresponding to the task group with the execution state of failed execution; and acquiring the execution garbage corresponding to the task group with the execution state of failure, and cleaning the execution garbage by using a garbage cleaner.
In one embodiment, a cluster assembly decorator includes a concurrency controller; the task scheduling module 508 is further configured to, when receiving service requests sent by a plurality of terminals, respectively encapsulate and generate a corresponding task group according to each service request; the task group has a corresponding task group identifier; counting the concurrent number of a plurality of task groups with the same task group identification, which are requested to be executed; judging whether the concurrency quantity exceeds a concurrency threshold; if yes, splitting a plurality of task groups with the same task group identification into a plurality of batches for dispatch and execution by using the concurrency controller according to the concurrency threshold.
For specific limitations of the task scheduling device, reference may be made to the above limitation of the task scheduling method, and no further description is given here. The respective modules in the task scheduling device described above may be implemented in whole or in part by software, hardware, and combinations thereof. The above modules may be embedded in hardware or may be independent of a processor in the computer device, or may be stored in software in a memory in the computer device, so that the processor may call and execute operations corresponding to the above modules.
In one embodiment, a computer device is provided, which may be a server, the internal structure of which may be as shown in fig. 6. The computer device includes a processor, a memory, a network interface, and a database connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement a task scheduling method.
It will be appreciated by those skilled in the art that the structure shown in fig. 6 is merely a block diagram of some of the structures associated with the present application and is not limiting of the computer device to which the present application may be applied, and that a particular computer device may include more or fewer components than shown, or may combine certain components, or have a different arrangement of components.
In one embodiment, a computer device is provided comprising a memory storing a computer program and a processor that when executing the computer program performs the steps of: receiving a service request sent by a terminal; the service request contains an entry function identifier; identifying a function queue corresponding to the entry function identifier; the function queue comprises a plurality of business functions; converting the plurality of business functions into corresponding basic tasks respectively; calling a group decorator corresponding to the entry function identifier, and encapsulating a plurality of basic tasks into task groups by using the group decorator; detecting whether the group decorator records a task group identifier; if yes, the task groups are packaged into corresponding task groups, scheduling sequences of the task groups are arranged in the task groups in advance, and scheduling execution is carried out on the task groups in the task groups based on the scheduling sequences.
In one embodiment, the processor, when executing the computer program, performs the steps of: receiving a development request for a service system sent by a terminal; the business system is provided with a corresponding business logic script; the business logic script comprises a plurality of entry functions corresponding to the entry function identifiers respectively; acquiring a task scheduling frame according to the development request; the task scheduling framework comprises a task decorator; receiving a first call request sent by a terminal, and sending a task decorator to the terminal according to the first call request, so that the terminal adds the task decorator corresponding to each entry function in a service logic script; converting the plurality of business functions into corresponding basic tasks respectively comprises: calling a task decorator corresponding to the entry function identifier; the task orchestrator is utilized to package the plurality of business functions into a plurality of basic tasks that execute asynchronously.
In one embodiment, the task scheduling framework further comprises a group decorator; the processor, when executing the computer program, performs the steps of: and receiving a second call request sent by the terminal, and sending the group decorator to the terminal according to the second call request, so that the terminal adds the group decorator corresponding to each entry function in the service logic script, and adds the task group identifier of the corresponding task group in the group decorator.
In one embodiment, the task scheduling framework further comprises a group container; the concurrent execution function and the asynchronous execution function are predefined in the group container; the processor, when executing the computer program, performs the steps of: receiving a third call request sent by the terminal, sending a group container to the terminal according to the third call request, enabling the terminal to add a group container corresponding to each task group identifier in a service logic script based on the task group identifier configured in the group decorator, and predefining arrangement rules of a plurality of task groups capable of being accommodated in the group container by utilizing a concurrent execution function and an asynchronous execution function; the orchestration rules include a concurrent and/or asynchronous scheduling order among the multiple task group identifications.
In one embodiment, the task scheduling framework further comprises a log decorator; the processor, when executing the computer program, performs the steps of: receiving a fourth call request sent by the terminal, and sending the log decorator to the terminal according to the fourth call request, so that the terminal adds the log decorator corresponding to each entry function in the service logic script; scheduling execution of a plurality of task groups within a task group based on a scheduling order includes: distributing a plurality of basic tasks corresponding to the task group to a plurality of servers in the group, enabling the servers to schedule and execute the plurality of basic tasks, generating a task log corresponding to each basic task, and inserting a corresponding task group identifier into the task log by using a log decorator; and when the task group is executed, merging task logs which are scattered on a plurality of servers and contain the same task group identification, and generating a service log corresponding to each task group identification.
In one embodiment, the group assembly decorator includes a status checker and a trash remover; the processor, when executing the computer program, performs the steps of: scheduling and executing a plurality of basic tasks corresponding to each task group in the task group according to a preset concurrent and/or asynchronous scheduling sequence of the task groups; monitoring the execution state of the corresponding task group by using a state checker, adding an abnormal mark to the task group with the execution state of failed execution, continuing to execute a subsequent task group, or canceling execution of a task group corresponding to the task group with the execution state of failed execution; and acquiring the execution garbage corresponding to the task group with the execution state of failure, and cleaning the execution garbage by using a garbage cleaner.
In one embodiment, a cluster assembly decorator includes a concurrency controller; the processor, when executing the computer program, performs the steps of: when receiving service requests sent by a plurality of terminals, respectively packaging and generating corresponding task groups according to each service request; the task group has a corresponding task group identifier; counting the concurrent number of a plurality of task groups with the same task group identification, which are requested to be executed; judging whether the concurrency quantity exceeds a concurrency threshold; if yes, splitting a plurality of task groups with the same task group identification into a plurality of batches for dispatch and execution by using the concurrency controller according to the concurrency threshold.
In one embodiment, a computer readable storage medium is provided having a computer program stored thereon, which when executed by a processor, performs the steps of: receiving a service request sent by a terminal; the service request contains an entry function identifier; identifying a function queue corresponding to the entry function identifier; the function queue comprises a plurality of business functions; converting the plurality of business functions into corresponding basic tasks respectively; calling a group decorator corresponding to the entry function identifier, and encapsulating a plurality of basic tasks into task groups by using the group decorator; detecting whether the group decorator records a task group identifier; if yes, the task groups are packaged into corresponding task groups, scheduling sequences of the task groups are arranged in the task groups in advance, and scheduling execution is carried out on the task groups in the task groups based on the scheduling sequences.
In one embodiment, the computer program when executed by the processor further performs the steps of: receiving a development request for a service system sent by a terminal; the business system is provided with a corresponding business logic script; the business logic script comprises a plurality of entry functions corresponding to the entry function identifiers respectively; acquiring a task scheduling frame according to the development request; the task scheduling framework comprises a task decorator; receiving a first call request sent by a terminal, and sending a task decorator to the terminal according to the first call request, so that the terminal adds the task decorator corresponding to each entry function in a service logic script; converting the plurality of business functions into corresponding basic tasks respectively comprises: calling a task decorator corresponding to the entry function identifier; the task orchestrator is utilized to package the plurality of business functions into a plurality of basic tasks that execute asynchronously.
In one embodiment, the task scheduling framework further comprises a group decorator; the computer program when executed by the processor also performs the steps of: and receiving a second call request sent by the terminal, and sending the group decorator to the terminal according to the second call request, so that the terminal adds the group decorator corresponding to each entry function in the service logic script, and adds the task group identifier of the corresponding task group in the group decorator.
In one embodiment, the task scheduling framework further comprises a group container; the concurrent execution function and the asynchronous execution function are predefined in the group container; the computer program when executed by the processor also performs the steps of: receiving a third call request sent by the terminal, sending a group container to the terminal according to the third call request, enabling the terminal to add a group container corresponding to each task group identifier in a service logic script based on the task group identifier configured in the group decorator, and predefining arrangement rules of a plurality of task groups capable of being accommodated in the group container by utilizing a concurrent execution function and an asynchronous execution function; the orchestration rules include a concurrent and/or asynchronous scheduling order among the multiple task group identifications.
In one embodiment, the task scheduling framework further comprises a log decorator; the computer program when executed by the processor also performs the steps of: receiving a fourth call request sent by the terminal, and sending the log decorator to the terminal according to the fourth call request, so that the terminal adds the log decorator corresponding to each entry function in the service logic script; scheduling execution of a plurality of task groups within a task group based on a scheduling order includes: distributing a plurality of basic tasks corresponding to the task group to a plurality of servers in the group, enabling the servers to schedule and execute the plurality of basic tasks, generating a task log corresponding to each basic task, and inserting a corresponding task group identifier into the task log by using a log decorator; and when the task group is executed, merging task logs which are scattered on a plurality of servers and contain the same task group identification, and generating a service log corresponding to each task group identification.
In one embodiment, the group assembly decorator includes a status checker and a trash remover; the computer program when executed by the processor also performs the steps of: scheduling and executing a plurality of basic tasks corresponding to each task group in the task group according to a preset concurrent and/or asynchronous scheduling sequence of the task groups; monitoring the execution state of the corresponding task group by using a state checker, adding an abnormal mark to the task group with the execution state of failed execution, continuing to execute a subsequent task group, or canceling execution of a task group corresponding to the task group with the execution state of failed execution; and acquiring the execution garbage corresponding to the task group with the execution state of failure, and cleaning the execution garbage by using a garbage cleaner.
In one embodiment, a cluster assembly decorator includes a concurrency controller; the computer program when executed by the processor also performs the steps of: when receiving service requests sent by a plurality of terminals, respectively packaging and generating corresponding task groups according to each service request; the task group has a corresponding task group identifier; counting the concurrent number of a plurality of task groups with the same task group identification, which are requested to be executed; judging whether the concurrency quantity exceeds a concurrency threshold; if yes, splitting a plurality of task groups with the same task group identification into a plurality of batches for dispatch and execution by using the concurrency controller according to the concurrency threshold.
Those skilled in the art will appreciate that implementing all or part of the above-described methods in accordance with the embodiments may be accomplished by way of a computer program stored on a non-transitory computer readable storage medium, which when executed may comprise the steps of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium used in the various embodiments provided herein may include non-volatile and/or volatile memory. The nonvolatile memory can include Read Only Memory (ROM), programmable ROM (PROM), electrically Programmable ROM (EPROM), electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double Data Rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous Link DRAM (SLDRAM), memory bus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), among others.
The technical features of the above embodiments may be arbitrarily combined, and all possible combinations of the technical features in the above embodiments are not described for brevity of description, however, as long as there is no contradiction between the combinations of the technical features, they should be considered as the scope of the description.
The foregoing examples represent only a few embodiments of the present application, which are described in more detail and are not to be construed as limiting the scope of the invention. It should be noted that it would be apparent to those skilled in the art that various modifications and improvements could be made without departing from the spirit of the present application, which would be within the scope of the present application. Accordingly, the scope of protection of the present application is to be determined by the claims appended hereto.

Claims (7)

1. A method of task scheduling, the method comprising:
receiving a service request sent by a terminal; the service request comprises an entry function identifier;
identifying a function queue corresponding to the entry function identifier; the function queue comprises a plurality of business functions;
converting a plurality of business functions into corresponding basic tasks respectively;
invoking a group decorator corresponding to the entry function identifier, and encapsulating a plurality of basic tasks into task groups by using the group decorator;
Detecting whether the group decorator records a task group identifier;
if yes, the task group is packaged into a corresponding task group, the scheduling sequence of a plurality of task groups is pre-arranged in the task group, and scheduling execution is carried out on the plurality of task groups in the task group based on the scheduling sequence;
before the service functions are respectively converted into the corresponding basic tasks, the method further comprises the following steps: receiving a development request for a service system sent by a terminal; the service system is provided with a corresponding service logic script; the business logic script comprises a plurality of entry functions corresponding to the entry function identifiers respectively; acquiring a task scheduling frame according to the development request; the task scheduling framework comprises a task decorator; receiving a first call request sent by a terminal, and sending the task decorator to the terminal according to the first call request, so that the terminal adds the task decorator corresponding to each entry function in the service logic script; the converting the business functions into corresponding basic tasks respectively comprises the following steps: invoking a task decorator corresponding to the entry function identifier; encapsulating a plurality of business functions into a plurality of basic tasks which are executed asynchronously by using the task decorator;
The task scheduling framework further comprises a group decorator; before the calling the group decorator corresponding to the entry function identifier, the method further comprises: receiving a second call request sent by the terminal, sending the group decorator to the terminal according to the second call request, enabling the terminal to add the group decorator corresponding to each entry function in a business logic script, and adding a task group identifier of a corresponding task group in the group decorator;
the task scheduling framework further comprises a group container; the concurrent execution function and the asynchronous execution function are predefined in the group container; before the task groups are packaged into the corresponding task groups, and the scheduling sequences of the task groups are pre-arranged in the task groups, the method further comprises the steps of: receiving a third call request sent by a terminal, sending the group container to the terminal according to the third call request, enabling the terminal to add a group container corresponding to each task group identifier in a service logic script based on the task group identifier configured in the group decorator, and predefining arrangement rules of a plurality of task groups which can be accommodated in the group container by utilizing the concurrent execution function and the asynchronous execution function; the orchestration rules include a concurrent and/or asynchronous scheduling order among the plurality of task group identifications.
2. The method of claim 1, wherein the task scheduling framework further comprises a log decorator; the method further comprises the steps of:
receiving a fourth call request sent by a terminal, and sending the log decorator to the terminal according to the fourth call request, so that the terminal adds the log decorator corresponding to each entry function in a service logic script; the scheduling execution of the plurality of task groups in the task group based on the scheduling sequence comprises the following steps:
distributing a plurality of basic tasks corresponding to the task group to a plurality of servers in the group, enabling the servers to schedule and execute the basic tasks, generating a task log corresponding to each basic task, and inserting a corresponding task group identifier into the task log by using the log decorator;
and when the task group is executed, merging task logs which are scattered on a plurality of servers and contain the same task group identification, and generating a service log corresponding to each task group identification.
3. The method of claim 1, wherein the group decorator includes a status checker and a trash remover; the scheduling execution of the plurality of task groups in the task group based on the scheduling sequence comprises the following steps:
Scheduling and executing a plurality of basic tasks corresponding to each task group in the task group according to a preset concurrent and/or asynchronous scheduling sequence of the task groups;
monitoring the execution state of the corresponding task group by using the state checker, adding an abnormal mark to the task group with the execution state of failed execution, continuing to execute the subsequent task group, or canceling the execution of the task group corresponding to the task group with the execution state of failed execution;
and acquiring the execution garbage corresponding to the task group with the execution state of failure, and cleaning the execution garbage by using the garbage cleaner.
4. The method of claim 1, wherein the group decorator comprises a concurrency controller; the scheduling execution of the plurality of task groups in the task group based on the scheduling sequence comprises the following steps:
when receiving service requests sent by a plurality of terminals, respectively packaging and generating corresponding task groups according to each service request; the task group is provided with a corresponding task group identifier;
counting the concurrent number of a plurality of task groups with the same task group identification, which are requested to be executed;
judging whether the concurrency quantity exceeds a concurrency threshold;
If yes, splitting a plurality of task groups with the same task group identification into a plurality of batches for dispatch and execution by using the concurrency controller according to the concurrency threshold.
5. A task scheduling device, comprising:
the task conversion module is used for receiving the service request sent by the terminal; the service request comprises an entry function identifier; identifying a function queue corresponding to the entry function identifier; the function queue comprises a plurality of business functions; converting a plurality of business functions into corresponding basic tasks respectively;
the task packaging module is used for calling a group decorator corresponding to the entry function identifier and packaging a plurality of basic tasks into task groups by utilizing the group decorator;
the scheduling module is used for detecting whether the group assembly decorator records a task group identifier; if yes, the task group is packaged into a corresponding task group, and the scheduling sequence of a plurality of task groups is pre-arranged in the task group;
the task scheduling module is used for scheduling and executing a plurality of task groups in the task group based on the scheduling sequence;
the device further comprises:
the task decorator deployment module is used for receiving a development request of a service system sent by a terminal; the business system is provided with a corresponding business logic script; the business logic script comprises a plurality of entry functions corresponding to the entry function identifiers respectively; acquiring a task scheduling frame according to the development request; the task scheduling framework comprises a task decorator; receiving a first call request sent by a terminal, and sending a task decorator to the terminal according to the first call request, so that the terminal adds the task decorator corresponding to each entry function in a service logic script; converting the plurality of business functions into corresponding basic tasks respectively comprises: calling a task decorator corresponding to the entry function identifier; encapsulating the plurality of business functions into a plurality of basic tasks which are executed asynchronously by using a task decorator;
The group decorator deployment module is used for receiving a second call request sent by the terminal, sending the group decorators to the terminal according to the second call request, enabling the terminal to add the group decorators corresponding to each entry function in the business logic script, and adding task group identifiers of corresponding task groups in the group decorators;
the group container deployment module is used for receiving a third call request sent by the terminal, sending the group container to the terminal according to the third call request, enabling the terminal to add the group container corresponding to each task group identifier in the service logic script based on the task group identifier configured in the group decorator, and predefining the arrangement rules of a plurality of task groups which can be accommodated in the group container by utilizing the concurrent execution function and the asynchronous execution function; the orchestration rules include a concurrent and/or asynchronous scheduling order among the multiple task group identifications.
6. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor implements the steps of the method of any of claims 1 to 4 when the computer program is executed.
7. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1 to 4.
CN201810620400.0A 2018-06-15 2018-06-15 Task scheduling method, device, computer equipment and storage medium Active CN108897610B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810620400.0A CN108897610B (en) 2018-06-15 2018-06-15 Task scheduling method, device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810620400.0A CN108897610B (en) 2018-06-15 2018-06-15 Task scheduling method, device, computer equipment and storage medium

Publications (2)

Publication Number Publication Date
CN108897610A CN108897610A (en) 2018-11-27
CN108897610B true CN108897610B (en) 2024-04-12

Family

ID=64345981

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810620400.0A Active CN108897610B (en) 2018-06-15 2018-06-15 Task scheduling method, device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN108897610B (en)

Families Citing this family (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109582301B (en) * 2018-12-03 2022-01-28 深圳前海微众银行股份有限公司 Service processing method, device, equipment and medium based on task scheduling system
CN109739547A (en) * 2018-12-28 2019-05-10 北京小米移动软件有限公司 Method for scheduling task, device and storage medium
CN110046041B (en) * 2019-04-15 2021-04-09 北京中安智达科技有限公司 Data acquisition method based on battery scheduling framework
CN110716943B (en) * 2019-09-06 2023-10-27 中国平安财产保险股份有限公司 Missing data complement method, device, computer equipment and storage medium
CN110780870B (en) * 2019-10-29 2024-02-09 中国建设银行股份有限公司 Service execution method, device, equipment and storage medium
CN111581578B (en) * 2020-05-09 2022-11-29 郑州悉知信息科技股份有限公司 Interface request processing method and device
CN112346609B (en) * 2020-09-25 2022-07-12 北京淇瑀信息科技有限公司 Page display method and device based on multi-service task display and electronic equipment
CN115981986B (en) * 2023-03-21 2023-07-14 北京淘友天下技术有限公司 User behavior scene reproduction method in app
CN116541019B (en) * 2023-06-28 2023-09-29 深圳市极限网络科技有限公司 Data forwarding method, system, device and readable storage medium
CN117170818B (en) * 2023-09-25 2024-04-12 中关村科学城城市大脑股份有限公司 Container processing method, apparatus, electronic device, and computer readable medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
FR2860311A1 (en) * 2003-09-30 2005-04-01 Cit Alcatel Resource allocation method in telecommunications network includes assessment of traffic demands and costs prior to allocation in reiterated process
CN1866204A (en) * 2006-01-17 2006-11-22 华为技术有限公司 Software assembly architecture
CN108156236A (en) * 2017-12-22 2018-06-12 平安养老保险股份有限公司 Service request processing method, device, computer equipment and storage medium

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
FR2860311A1 (en) * 2003-09-30 2005-04-01 Cit Alcatel Resource allocation method in telecommunications network includes assessment of traffic demands and costs prior to allocation in reiterated process
CN1866204A (en) * 2006-01-17 2006-11-22 华为技术有限公司 Software assembly architecture
CN108156236A (en) * 2017-12-22 2018-06-12 平安养老保险股份有限公司 Service request processing method, device, computer equipment and storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
刘一田 ; 刘士进 ; .多租户高可用并行任务调度框架.计算机系统应用.2016,(12),全文. *

Also Published As

Publication number Publication date
CN108897610A (en) 2018-11-27

Similar Documents

Publication Publication Date Title
CN108897610B (en) Task scheduling method, device, computer equipment and storage medium
CN107291547B (en) Task scheduling processing method, device and system
CN106802826B (en) Service processing method and device based on thread pool
EP3799390A1 (en) Preemptive scheduling based resource sharing use method, system and
CN107729139B (en) Method and device for concurrently acquiring resources
EP2701074B1 (en) Method, device, and system for performing scheduling in multi-processor core system
CN106844136B (en) Method and system for collecting program crash information
CN112286671B (en) Containerization batch processing job scheduling method and device and computer equipment
CN107431696A (en) Method and cloud management node for application automatically dispose
CN105610972A (en) Clustered task dispatching system
CN107992362B (en) Method, device and system for automatic performance test
CN111338791A (en) Method, device and equipment for scheduling cluster queue resources and storage medium
US20220006879A1 (en) Intelligent scheduling apparatus and method
CN107203413A (en) A kind of resource data dispatches system and method
CN113220431A (en) Cross-cloud distributed data task scheduling method, device and storage medium
KR20210129584A (en) Dynamically allocated cloud worker management system and method therefor
CN114625533A (en) Distributed task scheduling method and device, electronic equipment and storage medium
CN108509257B (en) Message processing method and device based on multithreading
CN111258741B (en) Warehouse task execution method, distributed server cluster and computer equipment
CN112307046A (en) Data acquisition method and device, computer readable storage medium and electronic equipment
CN114205183A (en) Communication method and system of AT instruction protocol stack based on real-time operating system
CN111913784A (en) Task scheduling method and device, network element and storage medium
CN110780869A (en) Distributed batch scheduling
CN103514036A (en) Scheduling system and method for event trigger and batch processing
CN111522630B (en) Method and system for executing planned tasks based on batch dispatching center

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
TA01 Transfer of patent application right

Effective date of registration: 20200122

Address after: 200120 floor 15, 1333 Lujiazui Ring Road, China (Shanghai) pilot Free Trade Zone, Pudong New Area, Shanghai

Applicant after: Weikun (Shanghai) Technology Service Co.,Ltd.

Address before: 200120 13 floor, 1333 Lujiazui Road, Pudong New Area free trade pilot area, Shanghai.

Applicant before: SHANGHAI LUJIAZUI INTERNATIONAL FINANCIAL ASSETS TRANSACTION MARKET CO.,LTD.

TA01 Transfer of patent application right
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
TA01 Transfer of patent application right

Effective date of registration: 20240314

Address after: 2nd Floor, Building 6, Zone 2, No. 188 South Fourth Ring West Road, Fengtai District, Beijing, 100160

Applicant after: Beijing Xingshenggong Technology Co.,Ltd.

Country or region after: China

Address before: 15th floor, 1333 Lujiazui Ring Road, China (Shanghai) pilot Free Trade Zone, Pudong New Area, Shanghai, 200120

Applicant before: Weikun (Shanghai) Technology Service Co.,Ltd.

Country or region before: China

TA01 Transfer of patent application right
GR01 Patent grant
GR01 Patent grant