CN114035933A - Scheduling method and device, electronic equipment and storage medium - Google Patents
Scheduling method and device, electronic equipment and storage medium Download PDFInfo
- Publication number
- CN114035933A CN114035933A CN202111164684.5A CN202111164684A CN114035933A CN 114035933 A CN114035933 A CN 114035933A CN 202111164684 A CN202111164684 A CN 202111164684A CN 114035933 A CN114035933 A CN 114035933A
- Authority
- CN
- China
- Prior art keywords
- task
- service unit
- processed
- information
- processing
- 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.)
- Pending
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/50—Allocation of resources, e.g. of the central processing unit [CPU]
- G06F9/5005—Allocation of resources, e.g. of the central processing unit [CPU] to service a request
- G06F9/5027—Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
- G06F9/505—Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals considering the load
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/48—Program initiating; Program switching, e.g. by interrupt
- G06F9/4806—Task transfer initiation or dispatching
- G06F9/4843—Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Management, Administration, Business Operations System, And Electronic Commerce (AREA)
Abstract
The present disclosure relates to a scheduling method and apparatus, an electronic device, and a storage medium, wherein the method includes: determining a target address of a target service unit in a registration database according to task information of a task to be processed; serializing the task data to obtain a task data object; and sending the task data object to the target address, so that the target service unit processes the task to be processed, and a processing result is obtained. According to the scheduling method disclosed by the embodiment of the invention, the function information and the address of each service unit can be stored in the registration database, the scheduling control unit is convenient to call, the decoupling of the scheduling control unit and the service unit can be realized, the expansion and maintenance of the service function are convenient, the most suitable service unit can be selected based on the task information, and the task execution efficiency is improved.
Description
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a scheduling method and apparatus, an electronic device, and a storage medium.
Background
Distributed task scheduling is widely used in business system development, such as image file data timing cleaning, batch data timing analysis, and the like. At present, the J2EE application is mainly realized based on secondary development of a quartz framework, or open source frameworks such as xxl-joba and elastic Job are directly integrated. However, in the above manner, the scheduling control unit and the service unit have strong coupling, which is not beneficial to the update and operation and maintenance management of the service unit. And cross-language execution is not convenient.
Disclosure of Invention
The disclosure provides a scheduling method and device, electronic equipment and a storage medium.
According to an aspect of the present disclosure, there is provided a scheduling method, including: determining a target address of a target service unit for processing a task to be processed in a registration database according to task information of the task to be processed, wherein the task information comprises a task type of the task to be processed, and the registration database comprises function information and an address of at least one service unit; serializing the task data of the task to be processed to obtain a task data object; and sending the task data object to the target address, so that the target service unit processes the task to be processed according to the task data object to obtain a processing result.
According to the scheduling method disclosed by the embodiment of the invention, the function information and the address of each service unit can be stored in the registration database, the scheduling control unit is convenient to call, the decoupling of the scheduling control unit and the service unit can be realized, the expansion and maintenance of the service function are convenient, the most suitable service unit can be selected based on the task information, and the task execution efficiency is improved. Besides, the scheduling control unit is decoupled from the service units, cross-language calling of various service units can be realized through the function information and the addresses, scheduling of various programming language tasks can be realized, task data serialization is favorable for data transmission between the scheduling control unit and the service units when cross-language calling is carried out, and the problem of data incompatibility is reduced.
In a possible implementation manner, determining, in a registration database, a target address of a target service unit for processing a task to be processed according to task information of the task to be processed includes: splitting the task to be processed into a plurality of subtasks, wherein the task information comprises subtask information of the plurality of subtasks; and determining the target address of the target service unit for processing each subtask in a registration database according to the subtask information of the plurality of subtasks.
By the method, the task to be processed can be divided into the plurality of subtasks to execute the plurality of subtasks in parallel, and the task processing efficiency is improved.
In a possible implementation manner, the registration database further includes processing resource information of at least one service unit, the task information further includes processing resource requirement information, and the determining, in the registration database, a target address of a target service unit for processing the task to be processed according to the task information of the task to be processed includes: and determining the target address of the target service unit according to the task type and the processing resource demand information of the task to be processed and the processing resource information and the function information of at least one service unit.
By the method, the target service unit suitable for executing the task to be processed can be selected through the type and the load of the target service unit, the service unit with matched functions can be selected, the load of the selected target service unit can be balanced, and the task processing efficiency is improved.
In one possible implementation, the method further includes: acquiring a result object of a task to be processed sent by the target service unit, wherein the result object is obtained by the target service unit serializing the processing result; and performing deserialization on the result object to obtain a processing result of the task to be processed.
In a possible implementation manner, the processing the task to be processed by the target service unit according to the task data object to obtain a processing result includes: deserializing the task data object to obtain task data; and processing the task data to obtain a processing result.
In one possible implementation, the method further includes: the functional information and the address of the business unit are added to the registration database.
According to an aspect of the present disclosure, there is provided a scheduling apparatus, including: a scheduling control unit, a service unit and a registration database,
the registration database comprises function information and an address of at least one service unit;
the scheduling control unit is configured to: determining a target address of a target service unit for processing a task to be processed in a registration database according to task information of the task to be processed, wherein the task information comprises a task type of the task to be processed; serializing the task data of the task to be processed to obtain a task data object; sending the task data object to the target address,
the target service unit is configured to: and processing the task to be processed according to the task data object to obtain a processing result.
In one possible implementation, the scheduling control unit is further configured to: splitting the task to be processed into a plurality of subtasks, wherein the task information comprises subtask information of the plurality of subtasks; and determining the target address of the target service unit for processing each subtask in a registration database according to the subtask information of the plurality of subtasks.
In a possible implementation manner, the registration database further includes processing resource information of at least one service unit, the task information further includes processing resource requirement information, and the scheduling control unit is further configured to: and determining the target address of the target service unit according to the task type and the processing resource demand information of the task to be processed and the processing resource information and the function information of at least one service unit.
In one possible implementation manner, the scheduling control unit is further configured to: acquiring a result object of a task to be processed sent by the target service unit, wherein the result object is obtained by the target service unit serializing the processing result; and performing deserialization on the result object to obtain a processing result of the task to be processed.
In one possible implementation, the target service unit is further configured to: deserializing the task data object to obtain task data; and processing the task data to obtain a processing result.
In one possible implementation, the service unit is further configured to: the functional information and the address of the business unit are added to the registration database.
According to an aspect of the present disclosure, there is provided an electronic device including: a processor; a memory for storing processor-executable instructions; wherein the processor is configured to invoke the memory-stored instructions to perform the above-described method.
According to an aspect of the present disclosure, there is provided a computer readable storage medium having stored thereon computer program instructions which, when executed by a processor, implement the above-described method.
According to the scheduling method of the embodiment of the disclosure, the function information and the address of each service unit can be stored in the registration database, the scheduling control unit is convenient to call, the decoupling of the scheduling control unit and the service unit can be realized, the service unit does not need to be integrated in the scheduling control unit, the scheduling control unit does not need to be integrated in the service unit, the development and implementation process of the scheduling task is simplified, a developer keeps the original service development mode, the registration of the scheduling service can be completed only by simple configuration or annotation, the scheduling is performed through the scheduling control unit, the expansion and maintenance of the service function are convenient, the most suitable service unit can be selected based on the task information, and the task execution efficiency is improved. Besides, the scheduling control unit is decoupled from the service units, cross-language calling of various service units can be realized through the functional information and addresses, and cross-language scheduling can be realized by using the multiple languages sdk. Meanwhile, the task data is objectified, so that data transmission between the scheduling control unit and the service unit is facilitated when cross-language calling is carried out, and the problem of data incompatibility is reduced. Furthermore, the task to be processed can be divided into a plurality of subtasks to execute the plurality of subtasks in parallel, a suitable target service unit is selected based on the type and the load of the target service unit, the service unit with matched functions can be selected, the load of the selected target service unit can be balanced, and the task processing efficiency is improved.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure. Other features and aspects of the present disclosure will become apparent from the following detailed description of exemplary embodiments, which proceeds with reference to the accompanying drawings.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the disclosure.
Fig. 1 shows a flow chart of a scheduling method according to an embodiment of the present disclosure;
FIG. 2 shows a flow diagram of a scheduling method according to an embodiment of the present disclosure;
fig. 3 shows a block diagram of a scheduling apparatus according to an embodiment of the present disclosure;
FIG. 4 shows a block diagram of an electronic device in accordance with an embodiment of the disclosure;
fig. 5 shows a block diagram of an electronic device in accordance with an embodiment of the disclosure.
Detailed Description
Various exemplary embodiments, features and aspects of the present disclosure will be described in detail below with reference to the accompanying drawings. In the drawings, like reference numbers can indicate functionally identical or similar elements. While the various aspects of the embodiments are presented in drawings, the drawings are not necessarily drawn to scale unless specifically indicated.
The word "exemplary" is used exclusively herein to mean "serving as an example, embodiment, or illustration. Any embodiment described herein as "exemplary" is not necessarily to be construed as preferred or advantageous over other embodiments.
The term "and/or" herein is merely an association describing an associated object, meaning that three relationships may exist, e.g., a and/or B, may mean: a exists alone, A and B exist simultaneously, and B exists alone. In addition, the term "at least one" herein means any one of a plurality or any combination of at least two of a plurality, for example, including at least one of A, B, C, and may mean including any one or more elements selected from the group consisting of A, B and C.
Furthermore, in the following detailed description, numerous specific details are set forth in order to provide a better understanding of the present disclosure. It will be understood by those skilled in the art that the present disclosure may be practiced without some of these specific details. In some instances, methods, means, elements and circuits that are well known to those skilled in the art have not been described in detail so as not to obscure the present disclosure.
Fig. 1 shows a flowchart of a scheduling method for scheduling control units according to an embodiment of the present disclosure, which, as shown in fig. 1, includes:
in step S11, according to task information of a task to be processed, determining a target address of a target service unit for processing the task to be processed in a registration database, where the task information includes a task type of the task to be processed, and the registration database includes function information and an address of at least one service unit;
in step S12, serializing the task data of the to-be-processed task to obtain a task data object;
in step S13, the task data object is sent to the target address, so that the target service unit processes the task to be processed according to the task data object to obtain a processing result.
According to the scheduling method disclosed by the embodiment of the invention, the function information and the address of each service unit can be stored in the registration database, the scheduling control unit is convenient to call, the decoupling of the scheduling control unit and the service unit can be realized, the expansion and maintenance of the service function are convenient, the most suitable service unit can be selected based on the task information, and the task execution efficiency is improved. Besides, the scheduling control unit is decoupled from the service units, cross-language calling of various service units can be realized through the function information and the addresses, scheduling of various programming language tasks can be realized, task data serialization is favorable for data transmission between the scheduling control unit and the service units when cross-language calling is carried out, and the problem of data incompatibility is reduced.
In a possible implementation mode, a task scheduling mode in the related art is usually realized based on quadratic development of a quartz framework, or an open source framework such as xxl-joba and elastic Job is directly integrated. That is, when the function is updated, the whole framework needs to be developed secondarily, or the scheduling function and the service processing function need to be integrated. Resulting in the coupling of the scheduling control unit and the service unit, which is not favorable for the update iteration and maintenance of the service unit. Moreover, the coupling of the scheduling control unit and the service unit is also not beneficial to the cross-language scheduling of the service unit, for example, multiple service units may be developed by multiple programming languages, the calling modes of the multiple service units are different, and when a multi-language task is executed (for example, multiple subtasks of the task are executed by multiple programming languages), the compatibility of the task is not high.
In a possible implementation manner, aiming at the above problem, the scheduling control unit and the service unit may be decoupled, and the function information and the address of the service unit are registered in the registration database, so that the scheduling control unit can select a suitable service unit in the registration database to perform generalized call, that is, after determining the address of the suitable service unit, serialize the task data and send the task data to the address, so that the service unit executes the task. The scheduling mode of decoupling the scheduling control unit and the service unit enables the functions of the scheduling control unit and the service unit to be more specific, namely, the scheduling control unit is only responsible for scheduling, and the service unit is only responsible for executing tasks, so that the development and iteration of the service unit are more convenient. Furthermore, business units of multiple programming languages can be called, and task data are serialized for communication, so that the problem of data incompatibility is reduced, and cross-language task scheduling is facilitated.
In a possible implementation manner, the scheduling control unit may be a server, and the service unit may be a terminal. Alternatively, the scheduling control unit may be a functional unit in a device (e.g., a server) for executing scheduling processing, and the service unit may be a functional unit in the device for executing a specific task, and the present disclosure does not limit the specific forms of the scheduling control unit and the service unit.
In one possible implementation, the service unit may be a stand-alone device or a functional unit, has a specific function, and may be in communication connection with the scheduling control unit, and the service unit may register its own address (i.e., an address for communicating with the scheduling control unit) in the registration database, so that the scheduling control unit can transmit data through the address when communication with the service unit is required. The registration database can provide a function of storing registration information, so that the scheduling control unit can inquire the registration information and select the service unit. The registration database can be realized by a framework such as zookeeper, nacos, etcd and the like. The present disclosure does not limit the type of registration database.
In a possible implementation manner, as described above, decoupling the scheduling control unit and the service unit may facilitate updating and iteration of the service unit, and when the service unit is updated or a new service unit is added, the information of the new service unit may be registered, so that the scheduling control unit may obtain the information of the new service unit, thereby invoking the new service unit. The method further comprises the following steps: the functional information and the address of the business unit are added to the registration database. That is, the updated function information and address of the service unit or the newly added service unit are stored in the registration database, and when the scheduling control unit needs to call the service unit to execute the task, the function information can be obtained to determine whether to call the service unit. In addition, the resource information of the service unit can also be stored in the registration database, and the type of the information stored in the registration database is not limited by the disclosure.
In one possible implementation manner, in step S11, the scheduling control unit may execute the pending task at regular time, or when there is an execution requirement of the pending task (for example, a request for executing the pending task is received from a user), select a business unit suitable for executing the task in the registration database for processing the pending task with respect to task information of the pending task.
In one possible implementation, the task information may include a type of a task to be processed, a type and an amount of required processing resources (i.e., processing resource requirement information), and the like, for example, a certain task is an image processing task, required processing resources are GPU resources, a video memory of 128MB is required, and the like. The disclosure does not limit the content included in the task information.
In one possible implementation, the scheduling control unit may select a service unit suitable for performing the task based on the task information and the function information of the service unit stored in the registration database. For example, the scheduling control unit may select the service unit having the corresponding function according to the type of the to-be-processed task, and for example, the scheduling control unit selects the service unit having the corresponding processing resource according to the type of the processing resource required by the to-be-processed task and the required number of the processing resource, which is not limited by the present disclosure.
In one possible implementation, in order to match the functionality of the selected service unit to the type of task to be processed, and also to balance the load of the service units, an appropriate target service unit may be determined based on the above-mentioned multiple factors at the same time. The registration database further includes processing resource information of at least one service unit, the task information further includes processing resource requirement information, and step S11 may include: and determining the target address of the target service unit according to the task type and the processing resource demand information of the task to be processed and the processing resource information and the function information of at least one service unit.
In one possible implementation, the scheduling control unit may select a service unit having a corresponding function and a corresponding processing resource from the plurality of service units based on the type of the task to be processed and the type of the required processing resource. For example, if a task is an image processing task and the required processing resource is a GPU resource, the scheduling control unit may select at least one service unit having an image processing function and GPU processing resources according to the processing resource information and function information of each service unit. For another example, if the scheduling control unit and the service unit are not separate hardware devices but are independent functional units in a certain device, the service unit having the image processing function may be selected based on the function information of each service unit.
In a possible implementation manner, after determining the service units having the corresponding functions and processing resources, the scheduling control unit may further determine a target service unit suitable for executing the task to be processed based on the required amount of the processing resources by the task to be processed and the amount of the processing resources that can be provided by each service unit (for example, the load of the service unit, that is, the amount of the processing resources that can be provided by the service unit, may be determined based on the total amount of the processing resources of the service unit and the current occupied amount). If the scheduling control unit and the service unit are not separate hardware devices but are independent functional units in a certain device, the load of the service unit can be determined according to whether each service unit is currently executing other tasks, whether the task to be processed can be executed and other factors, and then a proper target service unit is selected. Further, the address of the target service unit is determined as the target address to transmit the data to the target address.
By the method, the target service unit suitable for executing the task to be processed can be selected through the type and the load of the target service unit, the service unit with matched functions can be selected, the load of the selected target service unit can be balanced, and the task processing efficiency is improved.
In a possible implementation manner, to further improve task processing efficiency, a task may be split, and a plurality of service units may be simultaneously selected according to the foregoing manner to process a plurality of split sub-tasks in parallel. Step S11 may include: splitting the task to be processed into a plurality of subtasks, wherein the task information comprises subtask information of the plurality of subtasks; and determining the target address of the target service unit for processing each subtask in a registration database according to the subtask information of the plurality of subtasks.
In one possible implementation, a larger (e.g., a task with characteristics of more processing steps, more resource requirements, etc.) task to be processed may be split to obtain a plurality of subtasks. Meanwhile, the subtask information of each subtask can be obtained based on the task information of the task to be processed. For example, the task to be processed is a face recognition task, the task can be split into subtasks for positioning the face position in the image, subtasks for determining key points of the face and subtasks for recognition according to the key points, and meanwhile, the types of the subtasks can be determined to be image processing tasks, and the required processing resources are GPU resources and the like. The present disclosure does not limit the type of subtasks and the type of processing resources required.
In a possible implementation manner, the scheduling control unit may determine, based on the task information of the sub-tasks, and the processing resource information, the function information, and the like of each service unit, a target service unit for executing each sub-task in the foregoing manner, and may further determine a target address of each target service unit, so as to transmit data of each sub-task to the corresponding target address respectively.
By the method, the task to be processed can be divided into the plurality of subtasks to execute the plurality of subtasks in parallel, and the task processing efficiency is improved.
In one possible implementation manner, in step S12, task data of the task to be processed may be serialized to obtain a task data object. And sent to the target address of the target business unit in step S13 to invoke the target business unit by sending serialized task data (i.e., task data object) to the target business unit. The task data may include parameters, method names, types, and the like of the tasks, and the task data is not limited by the disclosure. The service unit is called in the above manner, and the service unit does not need to be integrated in the scheduling control unit, that is, the scheduling control unit and the service unit are decoupled, so that the updating and iteration of the service unit are facilitated, and the cross-language task scheduling is facilitated. Namely, the function information and the address of the service unit developed by different programming languages can be stored in the registration database, so that the scheduling control unit can conveniently perform scheduling, the object which can be used by the service unit can be obtained by utilizing the serialized processing, and the service unit can perform deserialization on the task data object to obtain data and process the data, so that the compatibility of the data is improved, and the compatibility is better when the cross-language calling is performed.
In a possible implementation manner, the processing the task to be processed by the target service unit according to the task data object to obtain a processing result includes: deserializing the task data object to obtain task data; and processing the task data to obtain a processing result. When the service unit receives the task data object, the task data object can be deserialized in a self-mode to obtain task data, and the task to be processed can be processed based on the task data to obtain a processing result. In an example, the target business unit may parse the object to implement deserialization processing, obtain task data, and process the task based on the task data to obtain a processing result.
In a possible implementation, the processing result may be sent directly by the target service unit to the demanding party, e.g. to the user. The processing result may also be sent to the scheduling control unit, sent to the demander via the scheduling control unit, or as task data of other tasks.
In a possible implementation, the processing result may also be sent to the scheduling control unit, and the subsequent processing is performed by the scheduling control unit, for example, sent to the user by the scheduling control unit, or as task data of a subsequent task. When the data is sent to the scheduling control unit, the processing results can be serialized to improve the compatibility of the data. The scheduling control unit can obtain a result object of the task to be processed sent by the target service unit, wherein the result object is obtained by the target service unit by serializing the processing result; and performing deserialization on the result object to obtain a processing result of the task to be processed.
In an example, the target service unit may serialize the processing result, obtain a result object, that is, obtain an object that can be read by the scheduling control unit, and send the result object to the scheduling control unit, so as to reduce the problem of data incompatibility. And the scheduling control unit carries out deserialization on the received result object to obtain a processing result and carries out subsequent processing based on the processing result.
In an example, the processing result may be sent to the requester, or may be used as task data of another task, and when the service unit is called to execute another task, the processing result is sent to the address of the service unit as task data. Furthermore, the processing result and the used service unit can be subjected to statistical analysis and other processing, and the use mode of the processing result is not limited by the disclosure.
In a possible implementation manner, the scheduling control unit may further have other functions, such as the above statistical analysis function, and may further include a log management function, which may be used to record information such as a processing procedure of a task; the system also can comprise an operation monitoring function which can be used for monitoring the task execution progress or monitoring the resource occupation condition of each service unit and the like; the system also comprises an authority management function used for setting the operation authority of the user; and the system also can comprise a task management function which is used for managing the information of timing execution, task priority and the like of the tasks. The present disclosure does not limit other functions included in the scheduling control unit.
According to the scheduling method of the embodiment of the disclosure, the function information and the address of each service unit can be stored in the registration database, the scheduling control unit is convenient to call, the decoupling of the scheduling control unit and the service unit can be realized, the service unit does not need to be integrated in the scheduling control unit, the scheduling control unit does not need to be integrated in the service unit, the development and implementation process of the scheduling task is simplified, a developer keeps the original service development mode, the registration of the scheduling service can be completed only by simple configuration or annotation, the scheduling is performed through the scheduling control unit, the expansion and maintenance of the service function are convenient, the most suitable service unit can be selected based on the task information, and the task execution efficiency is improved. Besides, the scheduling control unit is decoupled from the service units, cross-language calling of various service units can be realized through the functional information and addresses, and cross-language scheduling can be realized by using the multiple languages sdk. Meanwhile, the task data is objectified, so that data transmission between the scheduling control unit and the service unit is facilitated when cross-language calling is carried out, and the problem of data incompatibility is reduced. Furthermore, the task to be processed can be divided into a plurality of subtasks to execute the plurality of subtasks in parallel, a suitable target service unit is selected based on the type and the load of the target service unit, the service unit with matched functions can be selected, the load of the selected target service unit can be balanced, and the task processing efficiency is improved.
In a possible implementation manner, in the task execution process, if a certain service unit is determined as a target service unit by the scheduling control unit, the scheduling control unit serializes the task data to obtain a task data object, and sends the task data object to a target address of the target service unit. The target service unit may obtain the task data object, perform deserialization on the task data object, and obtain task data, so as to process the task data and obtain a processing result.
In a possible implementation, the processing result may be sent directly by the target service unit to the demanding party, e.g. to the user. The processing result may also be sent to the scheduling control unit, sent to the demander via the scheduling control unit, or as task data of other tasks.
In one possible implementation, when the processing result is sent to the scheduling control unit, communication may be performed in a data sequence manner to reduce the problem of data incompatibility. The processing results may be serialized to obtain a result object, and the result object may be sent to the dispatch control unit. And the scheduling control unit obtains a processing result after deserializing the result object and performs subsequent processing based on the processing result.
In a possible implementation manner, as described above, decoupling the scheduling control unit and the service unit may facilitate updating and iteration of the service unit, and when the service unit is updated or a new service unit is added, the information of the new service unit may be registered, so that the scheduling control unit may obtain the information of the new service unit, thereby invoking the new service unit. In an example, the updated function information and address of the service unit or the newly added service unit may be saved in the registration database, and when the scheduling control unit needs to call the service unit to execute the task, the function information may be obtained to determine whether to call the service unit. In addition, the resource information of the service unit can also be stored in the registration database, and the type of the information stored in the registration database is not limited by the disclosure.
Fig. 2 shows a flowchart of a scheduling method according to an embodiment of the present disclosure, and as shown in fig. 2, the service units may be registered in a registration database, for example, the function information, resource information, address, and the like of each service unit may be saved in the registration database, so that the scheduling control unit can query the information and select an appropriate target service unit based on the information.
In a possible implementation manner, the scheduling control unit may execute the to-be-processed task at regular time, or select a suitable service unit to execute the to-be-processed task when there is an execution requirement of the to-be-processed task. In the calling process, the scheduling control unit is only responsible for the task scheduling function and schedules the proper service unit to perform specific task execution processing.
In one possible implementation manner, when scheduling a task, in order to improve processing efficiency, the task to be processed may be divided, for example, into n subtasks, and n service units are respectively scheduled to execute the n subtasks. In determining the business units to execute the subtasks, the business units may be selected based on the type of each subtask and the requirements of the processing resources, e.g., in a registry database, a business unit having a function corresponding to the type of the subtask and capable of providing the processing resources required by the subtask is selected as a target business unit to process each subtask.
In a possible implementation manner, after the target service unit is selected, the task data of each subtask may be serialized to improve data compatibility, and the obtained task data object is sent to the address of each target service unit.
In a possible implementation manner, after each target service unit obtains a task data object, deserialization may be performed to obtain task data, and processing is performed based on the task data to obtain a processing result. Further, the processing results may be serialized and the obtained result object may be sent to the scheduling control unit. The scheduling control unit performs deserialization on the result object to obtain a processing result, and performs subsequent processing on the processing result, for example, the processing result may be sent to a user, or the processing result may be used as task data of a subsequent task to execute the subsequent task.
In a possible implementation manner, the scheduling control unit may further have functions such as a log management function, an operation monitoring function, a permission management function, and a task management function, and the disclosure does not limit other functions of the scheduling control unit.
In one possible implementation, the scheduling method may be used in the field of distributed task execution. For example, in a task of periodically cleaning image data, one or more service units may have a function required for the cleaning task, and the scheduling control unit may start the cleaning task at a timing (e.g., a certain time of day, a certain time of week, etc.) and schedule the plurality of service modules to execute the image data of the plurality of partitions, respectively. The scheduling method can also be applied to a dubbo frame of a business system supporting Remote Procedure Call (RPC) between micro-services and also supports generalized calling, so that development of distributed scheduling can be completed without introducing additional frames to most of business systems using the dubbo, complexity of the business system is greatly reduced, high availability can be automatically supported by using mechanisms such as load balancing, fault tolerance and the like of the dubbo frame, task slicing capability can be completed by slightly modifying, and execution efficiency of scheduling tasks is improved. The present disclosure does not limit the application field of the scheduling method.
It is understood that the above-mentioned method embodiments of the present disclosure can be combined with each other to form a combined embodiment without departing from the logic of the principle, which is limited by the space, and the detailed description of the present disclosure is omitted. Those skilled in the art will appreciate that in the above methods of the specific embodiments, the specific order of execution of the steps should be determined by their function and possibly their inherent logic.
In addition, the present disclosure also provides a scheduling apparatus, an electronic device, a computer-readable storage medium, and a program, which can be used to implement any one of the scheduling methods provided by the present disclosure, and the corresponding technical solutions and descriptions and corresponding descriptions of the method portions are not repeated.
Fig. 3 shows a block diagram of a scheduling apparatus according to an embodiment of the present disclosure, as shown in fig. 3, the apparatus includes: a scheduling control unit 11, a service unit 12 and a registration database 13,
the registration database 13 includes function information and an address of at least one service unit;
the scheduling control unit 11 is configured to determine, in a registration database, a target address of a target service unit for processing a task to be processed according to task information of the task to be processed, where the task information includes a task type of the task to be processed; serializing the task data of the task to be processed to obtain a task data object; sending the task data object to the target address,
the target service unit is configured to: and processing the task to be processed according to the task data object to obtain a processing result.
In a possible implementation manner, the scheduling control unit 11 is further configured to: splitting the task to be processed into a plurality of subtasks, wherein the task information comprises subtask information of the plurality of subtasks; according to the subtask information of the plurality of subtasks, a target address of a target service unit for processing each subtask is determined in the registration database 13.
In a possible implementation manner, the registration database 13 further includes processing resource information of at least one service unit, the task information further includes processing resource requirement information, and the scheduling control unit is further configured to: and determining the target address of the target service unit according to the task type and the processing resource demand information of the task to be processed and the processing resource information and the function information of at least one service unit.
In a possible implementation manner, the scheduling control unit 11 is further configured to: acquiring a result object of a task to be processed sent by the target service unit, wherein the result object is obtained by the target service unit serializing the processing result; and performing deserialization on the result object to obtain a processing result of the task to be processed.
In one possible implementation, the target service unit is further configured to: deserializing the task data object to obtain task data; and processing the task data to obtain a processing result.
In a possible implementation manner, the service unit 12 is further configured to: the functional information and the address of the business unit are added to the registration database.
In some embodiments, functions of or modules included in the apparatus provided in the embodiments of the present disclosure may be used to execute the method described in the above method embodiments, and specific implementation thereof may refer to the description of the above method embodiments, and for brevity, will not be described again here.
Embodiments of the present disclosure also provide a computer-readable storage medium having stored thereon computer program instructions, which when executed by a processor, implement the above-mentioned method. The computer readable storage medium may be a non-volatile computer readable storage medium.
An embodiment of the present disclosure further provides an electronic device, including: a processor; a memory for storing processor-executable instructions; wherein the processor is configured to invoke the memory-stored instructions to perform the above-described method.
The embodiments of the present disclosure also provide a computer program product, which includes computer readable code, and when the computer readable code runs on a device, a processor in the device executes instructions for implementing the scheduling method provided in any of the above embodiments.
The embodiments of the present disclosure also provide another computer program product for storing computer readable instructions, which when executed cause a computer to perform the operations of the scheduling method provided in any of the above embodiments.
The electronic device may be provided as a terminal, server, or other form of device.
Fig. 4 illustrates a block diagram of an electronic device 800 in accordance with an embodiment of the disclosure. For example, the electronic device 800 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, or the like terminal.
Referring to fig. 4, electronic device 800 may include one or more of the following components: processing component 802, memory 804, power component 806, multimedia component 808, audio component 810, input/output (I/O) interface 812, sensor component 814, and communication component 816.
The processing component 802 generally controls overall operation of the electronic device 800, such as operations associated with display, telephone calls, data communications, camera operations, and recording operations. The processing components 802 may include one or more processors 820 to execute instructions to perform all or a portion of the steps of the methods described above. Further, the processing component 802 can include one or more modules that facilitate interaction between the processing component 802 and other components. For example, the processing component 802 can include a multimedia module to facilitate interaction between the multimedia component 808 and the processing component 802.
The memory 804 is configured to store various types of data to support operations at the electronic device 800. Examples of such data include instructions for any application or method operating on the electronic device 800, contact data, phonebook data, messages, pictures, videos, and so forth. The memory 804 may be implemented by any type or combination of volatile or non-volatile memory devices such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic or optical disks.
The power supply component 806 provides power to the various components of the electronic device 800. The power components 806 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the electronic device 800.
The multimedia component 808 includes a screen that provides an output interface between the electronic device 800 and a user. In some embodiments, the screen may include a Liquid Crystal Display (LCD) and a Touch Panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive an input signal from a user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense an edge of a touch or slide action, but also detect a duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 808 includes a front facing camera and/or a rear facing camera. The front camera and/or the rear camera may receive external multimedia data when the electronic device 800 is in an operation mode, such as a shooting mode or a video mode. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
The audio component 810 is configured to output and/or input audio signals. For example, the audio component 810 includes a Microphone (MIC) configured to receive external audio signals when the electronic device 800 is in an operational mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signals may further be stored in the memory 804 or transmitted via the communication component 816. In some embodiments, audio component 810 also includes a speaker for outputting audio signals.
The I/O interface 812 provides an interface between the processing component 802 and peripheral interface modules, which may be keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to: a home button, a volume button, a start button, and a lock button.
The sensor assembly 814 includes one or more sensors for providing various aspects of state assessment for the electronic device 800. For example, the sensor assembly 814 may detect an open/closed state of the electronic device 800, the relative positioning of components, such as a display and keypad of the electronic device 800, the sensor assembly 814 may also detect a change in the position of the electronic device 800 or a component of the electronic device 800, the presence or absence of user contact with the electronic device 800, orientation or acceleration/deceleration of the electronic device 800, and a change in the temperature of the electronic device 800. Sensor assembly 814 may include a proximity sensor configured to detect the presence of a nearby object without any physical contact. The sensor assembly 814 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 814 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
The communication component 816 is configured to facilitate wired or wireless communication between the electronic device 800 and other devices. The electronic device 800 may access a wireless network based on a communication standard, such as WiFi, 2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component 816 receives a broadcast signal or broadcast related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 816 further includes a Near Field Communication (NFC) module to facilitate short-range communications. For example, the NFC module may be implemented based on Radio Frequency Identification (RFID) technology, infrared data association (IrDA) technology, Ultra Wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.
In an exemplary embodiment, the electronic device 800 may be implemented by one or more Application Specific Integrated Circuits (ASICs), Digital Signal Processors (DSPs), Digital Signal Processing Devices (DSPDs), Programmable Logic Devices (PLDs), Field Programmable Gate Arrays (FPGAs), controllers, micro-controllers, microprocessors or other electronic components for performing the above-described methods.
In an exemplary embodiment, a non-transitory computer-readable storage medium, such as the memory 804, is also provided that includes computer program instructions executable by the processor 820 of the electronic device 800 to perform the above-described methods.
Fig. 5 illustrates a block diagram of an electronic device 1900 in accordance with an embodiment of the disclosure. For example, the electronic device 1900 may be provided as a server. Referring to fig. 5, electronic device 1900 includes a processing component 1922 further including one or more processors and memory resources, represented by memory 1932, for storing instructions, e.g., applications, executable by processing component 1922. The application programs stored in memory 1932 may include one or more modules that each correspond to a set of instructions. Further, the processing component 1922 is configured to execute instructions to perform the above-described method.
The electronic device 1900 may also include a power component 1926 configured to perform power management of the electronic device 1900, a wired or wireless network interface 1950 configured to connect the electronic device 1900 to a network, and an input/output (I/O) interface 1958. The electronic device 1900 may operate based on an operating system, such as Windows Server, stored in memory 1932TM,Mac OS XTM,UnixTM,LinuxTM,FreeBSDTMOr the like.
In an exemplary embodiment, a non-transitory computer readable storage medium, such as the memory 1932, is also provided that includes computer program instructions executable by the processing component 1922 of the electronic device 1900 to perform the above-described methods.
The present disclosure may be systems, methods, and/or computer program products. The computer program product may include a computer-readable storage medium having computer-readable program instructions embodied thereon for causing a processor to implement various aspects of the present disclosure.
The computer readable storage medium may be a tangible device that can hold and store the instructions for use by the instruction execution device. The computer readable storage medium may be, for example, but not limited to, an electronic memory device, a magnetic memory device, an optical memory device, an electromagnetic memory device, a semiconductor memory device, or any suitable combination of the foregoing. More specific examples (a non-exhaustive list) of the computer readable storage medium would include the following: a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a Static Random Access Memory (SRAM), a portable compact disc read-only memory (CD-ROM), a Digital Versatile Disc (DVD), a memory stick, a floppy disk, a mechanical coding device, such as punch cards or in-groove projection structures having instructions stored thereon, and any suitable combination of the foregoing. Computer-readable storage media as used herein is not to be construed as transitory signals per se, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagating through a waveguide or other transmission medium (e.g., optical pulses through a fiber optic cable), or electrical signals transmitted through electrical wires.
The computer-readable program instructions described herein may be downloaded from a computer-readable storage medium to a respective computing/processing device, or to an external computer or external storage device via a network, such as the internet, a local area network, a wide area network, and/or a wireless network. The network may include copper transmission cables, fiber optic transmission, wireless transmission, routers, firewalls, switches, gateway computers and/or edge servers. The network adapter card or network interface in each computing/processing device receives computer-readable program instructions from the network and forwards the computer-readable program instructions for storage in a computer-readable storage medium in the respective computing/processing device.
The computer program instructions for carrying out operations of the present disclosure may be assembler instructions, Instruction Set Architecture (ISA) instructions, machine-related instructions, microcode, firmware instructions, state setting data, or source or object code written in any combination of one or more programming languages, including an object oriented programming language such as Smalltalk, C + + or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The computer-readable program instructions may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider). In some embodiments, the electronic circuitry that can execute the computer-readable program instructions implements aspects of the present disclosure by utilizing the state information of the computer-readable program instructions to personalize the electronic circuitry, such as a programmable logic circuit, a Field Programmable Gate Array (FPGA), or a Programmable Logic Array (PLA).
Various aspects of the present disclosure are described herein with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the disclosure. It will be understood that each block of the flowchart illustrations and/or block diagrams, and combinations of blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer-readable program instructions.
These computer-readable program instructions may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions/acts specified in the flowchart and/or block diagram block or blocks. These computer-readable program instructions may also be stored in a computer-readable storage medium that can direct a computer, programmable data processing apparatus, and/or other devices to function in a particular manner, such that the computer-readable medium storing the instructions comprises an article of manufacture including instructions which implement the function/act specified in the flowchart and/or block diagram block or blocks.
The computer readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other devices to cause a series of operational steps to be performed on the computer, other programmable apparatus or other devices to produce a computer implemented process such that the instructions which execute on the computer, other programmable apparatus or other devices implement the functions/acts specified in the flowchart and/or block diagram block or blocks.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of instructions, which comprises one or more executable instructions for implementing the specified logical function(s). In some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The computer program product may be embodied in hardware, software or a combination thereof. In an alternative embodiment, the computer program product is embodied in a computer storage medium, and in another alternative embodiment, the computer program product is embodied in a Software product, such as a Software Development Kit (SDK), or the like.
Having described embodiments of the present disclosure, the foregoing description is intended to be exemplary, not exhaustive, and not limited to the disclosed embodiments. Many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The terminology used herein is chosen in order to best explain the principles of the embodiments, the practical application, or improvements made to the technology in the marketplace, or to enable others of ordinary skill in the art to understand the embodiments disclosed herein.
Claims (10)
1. A scheduling method, for scheduling a control unit, comprising:
determining a target address of a target service unit for processing a task to be processed in a registration database according to task information of the task to be processed, wherein the task information comprises a task type of the task to be processed, and the registration database comprises function information and an address of at least one service unit;
serializing the task data of the task to be processed to obtain a task data object;
and sending the task data object to the target address, so that the target service unit processes the task to be processed according to the task data object to obtain a processing result.
2. The method of claim 1, wherein determining a target address of a target business unit for processing the task to be processed in a registration database according to task information of the task to be processed comprises:
splitting the task to be processed into a plurality of subtasks, wherein the task information comprises subtask information of the plurality of subtasks;
and determining the target address of the target service unit for processing each subtask in a registration database according to the subtask information of the plurality of subtasks.
3. The method of claim 1, wherein the registration database further includes processing resource information for at least one business unit, wherein the task information further includes processing resource requirement information,
determining a target address of a target service unit for processing a task to be processed in a registration database according to task information of the task to be processed, including:
and determining the target address of the target service unit according to the task type and the processing resource demand information of the task to be processed and the processing resource information and the function information of at least one service unit.
4. The method of claim 1, further comprising:
acquiring a result object of a task to be processed sent by the target service unit, wherein the result object is obtained by the target service unit serializing the processing result;
and performing deserialization on the result object to obtain a processing result of the task to be processed.
5. The method according to claim 1, wherein the target service unit processes the task to be processed according to the task data object to obtain a processing result, including:
deserializing the task data object to obtain task data;
and processing the task data to obtain a processing result.
6. The method of claim 1, further comprising:
the functional information and the address of the business unit are added to the registration database.
7. A scheduling apparatus, comprising: the system comprises a scheduling control unit, a service unit and a registration database;
the registration database comprises function information and an address of at least one service unit;
the scheduling control unit is used for determining a target address of a target service unit for processing the task to be processed in a registration database according to task information of the task to be processed, wherein the task information comprises a task type of the task to be processed;
serializing the task data of the task to be processed to obtain a task data object;
sending the task data object to the target address,
and the target service unit is used for processing the task to be processed according to the task data object to obtain a processing result.
8. The apparatus of claim 7, wherein the scheduling control unit is further configured to:
splitting the task to be processed into a plurality of subtasks, wherein the task information comprises subtask information of the plurality of subtasks;
and determining the target address of the target service unit for processing each subtask in a registration database according to the subtask information of the plurality of subtasks.
9. An electronic device, comprising:
a processor;
a memory for storing processor-executable instructions;
wherein the processor is configured to invoke the memory-stored instructions to perform the method of any of claims 1 to 6.
10. A computer readable storage medium having computer program instructions stored thereon, which when executed by a processor implement the method of any one of claims 1 to 6.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111164684.5A CN114035933A (en) | 2021-09-30 | 2021-09-30 | Scheduling method and device, electronic equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111164684.5A CN114035933A (en) | 2021-09-30 | 2021-09-30 | Scheduling method and device, electronic equipment and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN114035933A true CN114035933A (en) | 2022-02-11 |
Family
ID=80140584
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202111164684.5A Pending CN114035933A (en) | 2021-09-30 | 2021-09-30 | Scheduling method and device, electronic equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114035933A (en) |
-
2021
- 2021-09-30 CN CN202111164684.5A patent/CN114035933A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN112187862B (en) | Task processing method and device for task processing | |
CN114138439A (en) | Task scheduling method and device, electronic equipment and storage medium | |
CN112130475B (en) | Equipment control method, device, terminal and storage medium | |
CN113420338B (en) | Data processing method and device for data processing | |
CN111857858A (en) | Method and apparatus for processing information | |
CN110865846A (en) | Application management method, device, terminal, system and storage medium | |
CN113900721A (en) | Operating system starting method and device and electronic equipment | |
CN111913707B (en) | Multiplexing method and device for running process | |
CN112925788A (en) | Data set management method, system, device, electronic equipment and storage medium | |
CN115185717A (en) | Interface calling method and device, electronic equipment and storage medium | |
WO2023024435A1 (en) | Device registration method and apparatus, electronic device, storage medium, and computer program product | |
CN110597602A (en) | Transaction processing method and device, computer equipment and storage medium | |
CN112839065B (en) | Information processing method, information processing device, first equipment and storage medium | |
CN112685104A (en) | Application program starting control method and device, electronic equipment and storage medium | |
CN110221813B (en) | Application data connection establishment method and device, storage medium and electronic equipment | |
CN111221593A (en) | Dynamic loading method and device | |
CN114035933A (en) | Scheduling method and device, electronic equipment and storage medium | |
CN115794853A (en) | Method and device for updating government affair data resource catalog, electronic equipment and medium | |
CN115328558A (en) | Starting method and device and electronic equipment | |
CN114827060B (en) | Interaction method and device and electronic equipment | |
CN114398035A (en) | Method, apparatus, device and computer readable medium for providing service using component | |
US20210182129A1 (en) | Method and device for processing an application | |
CN110704767B (en) | Page opening method and device, electronic equipment and storage medium | |
CN113905083A (en) | User code operation method and device, electronic equipment and storage medium | |
CN112817701A (en) | Timer processing method and device, electronic equipment and computer readable medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |