CN116880973A - Task scheduling method and device, electronic equipment and storage medium - Google Patents

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

Info

Publication number
CN116880973A
CN116880973A CN202310792750.6A CN202310792750A CN116880973A CN 116880973 A CN116880973 A CN 116880973A CN 202310792750 A CN202310792750 A CN 202310792750A CN 116880973 A CN116880973 A CN 116880973A
Authority
CN
China
Prior art keywords
task
information
flow
node
subtasks
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
Application number
CN202310792750.6A
Other languages
Chinese (zh)
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.)
Hangzhou Qulian Technology Co Ltd
Original Assignee
Hangzhou Qulian 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 Hangzhou Qulian Technology Co Ltd filed Critical Hangzhou Qulian Technology Co Ltd
Priority to CN202310792750.6A priority Critical patent/CN116880973A/en
Publication of CN116880973A publication Critical patent/CN116880973A/en
Pending legal-status Critical Current

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
    • 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

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 application relates to the technical field of blockchain, and provides a task scheduling method, a task scheduling device, electronic equipment and a storage medium. The method comprises the following steps: acquiring a flow instance for scheduling the overall task, wherein the flow instance comprises each flow node of the execution flow of the overall task; starting from the first flow node to the last flow node in each flow node, and sequentially pushing the execution flow of the whole task; in the process of sequentially pushing the execution flow of the whole task, scheduling decision information is acquired by calling an intelligent contract every time any one flow node is reached; creating subtasks to be scheduled according to node task information and scheduling decision information contained in the flow node; and distributing the subtasks to be scheduled to corresponding electronic equipment for processing according to the scheduling decision information. By adopting the method, a plurality of electronic devices which are networked under the chain can be utilized to safely and efficiently execute tasks.

Description

Task scheduling method and device, electronic equipment and storage medium
Technical Field
The present application relates to the field of blockchain technologies, and in particular, to a task scheduling method, a task scheduling device, an electronic device, and a storage medium.
Background
In the system architecture of the blockchain, besides the blockchain link points of the on-chain networking, a plurality of trusted electronic devices can be networked under the chain, and tasks with high requirements on the credibility can be completed by utilizing the electronic devices. It can be seen that how to efficiently perform tasks using multiple electronic devices networked under a chain is a technical problem that needs to be considered by those skilled in the art.
Disclosure of Invention
In view of the above, the embodiments of the present application provide a task scheduling method, apparatus, electronic device, and storage medium, which can efficiently execute tasks by using multiple electronic devices that are networked under a chain.
A first aspect of an embodiment of the present application provides a task scheduling method applied to a first electronic device, where the first electronic device is any one of at least two electronic devices that are already networked, and the method includes:
acquiring a flow instance for scheduling the overall task; the process instance comprises each process node of the execution process of the overall task, and each process node comprises respective node task information;
starting from the first flow node to the last flow node in the flow nodes, and sequentially pushing the execution flow of the whole task;
In the process of sequentially pushing the execution flow of the whole task, acquiring scheduling decision information by calling an intelligent contract when any flow node is reached; creating subtasks to be scheduled according to node task information and the scheduling decision information contained in any flow node; selecting a second electronic device from the at least two electronic devices according to the scheduling decision information; and distributing the subtasks to be scheduled to the second electronic equipment for processing.
In the embodiment of the application, when the electronic equipment which is networked under the chain is required to execute a certain overall task, a task scheduling process can be initiated by any one electronic equipment, a process instance for scheduling the overall task is obtained, and the execution process of the overall task is sequentially pushed according to the process node contained in the process instance. In addition, in the process of pushing the execution flow of the whole task, scheduling decision information can be obtained by calling an intelligent contract every time any flow node is reached; creating subtasks to be scheduled according to node task information and scheduling decision information contained in the flow node; and then, making a decision according to the scheduling decision information, so that the subtasks to be scheduled are distributed to corresponding electronic equipment for processing. By the arrangement, each subtask to be scheduled can be divided according to the execution flow of the whole task, and the subtasks are allocated to which electronic devices to execute according to the obtained scheduling decision information, so that the distributed parallel processing of the multitasking is realized, namely, the tasks can be efficiently executed by using a plurality of electronic devices which are networked under a chain.
In an implementation manner of the embodiment of the present application, before acquiring the flow instance for scheduling the overall task, the method may further include:
acquiring a task script file input by a user;
analyzing the task script file to obtain meta-information of a total task contained in the overall task, information of all subtasks contained in the total task and task dependency information among all subtasks;
and creating and obtaining the flow instance according to the meta-information of the total task, the information of each subtask contained in the total task and the task dependency information among the subtasks.
Further, the first electronic device is provided with a task management process and a flow engine process, wherein the task management process is a daemon process for realizing task management, and the flow engine process is a daemon process for realizing overall task flow promotion; the parsing the task script file to obtain meta information of a total task included in the overall task, information of each subtask included in the total task, and task dependency information between the subtasks may include:
Analyzing the task script file through the task management process to obtain meta-information of the total task, information of all subtasks contained in the total task and task dependency information among all subtasks;
the creating the process instance according to the meta information of the total task, the information of each subtask included in the total task, and the task dependency information among the subtasks may include:
the meta-information of the total task, the information of each subtask contained in the total task and the task dependency information among the subtasks are transmitted to the process engine process through the task management process;
and establishing the process instance by combining process configuration information set by a user based on the received meta-information of the total task, the information of each subtask contained in the total task and the task dependency information among the subtasks through the process of the process engine.
In one implementation manner of the embodiment of the present application, each electronic device submits state information of a subtask that is processed separately to a task contract of a blockchain, and submits device resource information of each electronic device to a flow engine contract of the blockchain, where the task contract and the flow engine contract are both intelligent contracts deployed in the blockchain; the method for acquiring the scheduling decision information by calling the intelligent contract may include:
Acquiring state information of each subtask processed by each electronic device by calling the task contract;
acquiring respective device resource information of each electronic device by calling the flow engine contract;
and determining the state information of the subtasks processed by each electronic device and the device resource information of each electronic device as the scheduling decision information.
Further, the selecting a second electronic device from the at least two electronic devices according to the scheduling decision information may include:
selecting candidate electronic equipment from the at least two electronic equipment according to the state information of the subtasks processed by each electronic equipment;
and selecting the second electronic equipment from the candidate electronic equipment according to the equipment resource information of each electronic equipment.
Further, the pushing the execution flow of the overall task from the first flow node to the last flow node in the respective flow nodes in sequence may include:
determining a current flow node of the execution flow of the overall task;
determining whether a process node jump condition is met according to the state information of the subtasks processed by each electronic device and the user-defined logic configured by the current process node;
And if the flow node jump condition is met, pushing the execution flow of the whole task to jump from the current flow node to the next flow node.
In an implementation manner of the embodiment of the present application, the node task information included in the arbitrary flow node records subtasks to be executed by the arbitrary flow node and task dependency information of the subtasks to be executed, where the scheduling decision information includes execution states of all the subtasks of the overall task; the creating a subtask to be scheduled according to the node task information and the scheduling decision information contained in the arbitrary flow node may include:
and determining and creating the subtasks to be scheduled from the subtasks to be executed according to the task dependency information and the scheduling information of the subtasks to be executed and the execution states of all the subtasks of the overall task.
A second aspect of an embodiment of the present application provides a task scheduling device applied to a first electronic device, where the first electronic device is any one of at least two electronic devices that are already networked, and the device includes:
The flow instance acquisition module is used for acquiring a flow instance for scheduling the whole task; the process instance comprises each process node of the execution process of the overall task, and each process node comprises respective node task information;
the flow pushing module is used for sequentially pushing the execution flow of the whole task from the first flow node to the last flow node in the flow nodes;
the task scheduling module is used for acquiring scheduling decision information by calling an intelligent contract when any one process node is reached in the process of sequentially pushing the execution processes of the whole tasks; creating subtasks to be scheduled according to node task information and the scheduling decision information contained in any flow node; selecting a second electronic device from the at least two electronic devices according to the scheduling decision information; and distributing the subtasks to be scheduled to the second electronic equipment for processing.
A third aspect of an embodiment of the present application provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, where the processor implements the task scheduling method as provided in the first aspect of the embodiment of the present application when the processor executes the computer program.
A fourth aspect of the embodiments of the present application provides a computer readable storage medium storing a computer program which, when executed by a processor, implements a task scheduling method as provided in the first aspect of the embodiments of the present application.
A fifth aspect of an embodiment of the application provides a computer program product for, when run on an electronic device, causing the electronic device to perform the task scheduling method as provided by the first aspect of the embodiment of the application.
It will be appreciated that the advantages of the second to fifth aspects may be found in the relevant description of the first aspect, and are not described here again.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are needed in the embodiments or the description of the prior art will be briefly described below, it being obvious that the drawings in the following description are only some embodiments of the present application, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a schematic diagram of a task scheduling system according to an embodiment of the present application;
FIG. 2 is a flowchart of a task scheduling method according to an embodiment of the present application;
FIG. 3 is a schematic diagram of an example of a flow of overall tasks provided by an embodiment of the present application;
fig. 4 is a schematic structural diagram of a task scheduling device according to an embodiment of the present application;
fig. 5 is a schematic diagram of an electronic device according to an embodiment of the present application.
Detailed Description
In the following description, for purposes of explanation and not limitation, specific details are set forth such as the particular system architecture, techniques, etc., in order to provide a thorough understanding of the embodiments of the present application. It will be apparent, however, to one skilled in the art that the present application may be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the present application with unnecessary detail. Furthermore, the terms "first," "second," "third," and the like in the description of the present specification and in the appended claims, are used for distinguishing between descriptions and not necessarily for indicating or implying a relative importance.
In the field of blockchain technology, when tasks with high reliability requirements need to be executed, people often network a plurality of electronic devices (for example, a plurality of trusted integrated machine devices) under the chain, and execute corresponding tasks by using the electronic devices. However, processing mechanisms for efficiently performing tasks with these electronic devices are currently lacking. In view of the above, the embodiments of the present application provide a task scheduling method, apparatus, electronic device, and storage medium, which can efficiently execute tasks by using a plurality of electronic devices that are networked under a chain.
Referring to fig. 1, a task scheduling system provided by an embodiment of the present application is shown. In fig. 1, the electronic devices including electronic devices 1 to N (N is greater than or equal to 2) are networked under a chain, each electronic device may call an intelligent contract of a blockchain, and may report respective related information to the intelligent contract of the blockchain. Two smart contracts are shown in fig. 1, a task contract for storing task information executed by each electronic device, and a flow engine contract for storing device resource information (e.g., memory, CPU usage, etc.) of each electronic device, respectively. In addition, each electronic device is provided with a task management process and a process engine process which are respectively used for realizing the functions of task management, task process pushing and the like. For the specific working principle of the system shown in fig. 1, please refer to the method embodiment described below.
Referring to fig. 2, a task scheduling method provided by an embodiment of the present application is applied to any one of at least two electronic devices that are networked, and the task scheduling method is represented by a first electronic device, for example, the first electronic device may be any one of N electronic devices shown in fig. 1. The method comprises the following steps:
201. Acquiring a flow instance for scheduling the overall task;
the first electronic device is an initiator of the task, and can make a decision and schedule other electronic devices of the networking to cooperatively process the task, so that efficient execution of the task is realized. The overall task is a task initiated by the first electronic device that needs to be performed, and may include one overall task and a plurality of subtasks. The overall task comprises meta-information (such as a creator of the task, creation time and the like) of the overall task, information of all sub-tasks contained in the overall task and task dependency information among all the sub-tasks; the total task belongs to a specific task contained in the whole task, is used as a coordinator of each subtask, and is mainly used for combining the subtasks with priorities and dependency relations; the information for each subtask may include specific input and output information for the execution of the subtask and corresponding task processing logic, status information and scheduling information for the execution of the subtask, and so forth. Since the overall task to be executed is a known task, a flow instance of the overall task may be created in advance for scheduling the overall task. The process instance comprises each process node of the execution process of the overall task, each process node comprises respective node task information, and the node task information can comprise meta information, state information, task dependency relationship and scheduling information of the task, and the like.
Fig. 3 is a schematic diagram of an example of a whole task flow according to an embodiment of the present application. In fig. 3, each block represents a flow node, and the execution flow of the overall task is sequentially pushed to the last flow node from the first flow node at the leftmost side, and each flow node may have subtask information, subtask dependency relationship and node jump condition implemented by user-defined logic. For example, the node jump condition of the flow node 1 is that "both subtasks a and B are performed and completed", "the electronic device node memory occupies <50%" and "the subtask C outputs an intermediate result to be saved locally", and when these 3 conditions are satisfied, the jump is from the flow node 1 to the flow node 2, and the flow node 2 schedules the subtask D and the subtask E to be performed. By the arrangement, the subtasks are dynamically scheduled, and the subtasks can be dynamically created according to the node configuration of the flow, the requirements of the task initiator and the current resource conditions in the network and distributed to corresponding electronic equipment for execution.
In an implementation manner of the embodiment of the present application, before acquiring the flow instance for scheduling the overall task, the method may further include:
(1) Acquiring a task script file input by a user;
(2) Analyzing the task script file to obtain meta-information of a total task contained in the overall task, information of all sub-tasks contained in the total task and task dependency information among all the sub-tasks;
(3) And creating a flow instance according to the meta-information of the total task, the information of each subtask contained in the total task and the task dependency information among the subtasks.
In actual operation, a user may pre-write a task script file corresponding to the overall task, and input and run the task script file at the first electronic device side. After the first electronic device obtains the task script file, the first electronic device may parse the task script file, and obtain meta information of a total task included in the overall task, information of each subtask included in the total task, and task dependency information among the subtasks according to a parsing result. All that is obtained here is information about the total task, which is a coordinator, and the sub-tasks with priorities and dependencies are combined. After parsing the portion of information, a flow instance as shown in FIG. 3 may be created based on the portion of information.
Further, the first electronic device is provided with a task management process and a flow engine process, wherein the task management process is a daemon for realizing task management, and the flow engine process is a daemon for realizing overall task flow promotion; the parsing the task script file to obtain meta information of a total task included in the overall task, information of each subtask included in the total task, and task dependency information between the subtasks may include:
and analyzing the task script file through the task management process to obtain meta-information of the total task, information of all subtasks contained in the total task and task dependency information among all subtasks.
Each electronic device of the link-down networking can be provided with a task management process and a flow engine process, wherein the task management process is a daemon for realizing task management, and the flow engine process is a daemon for realizing the promotion of the total task flow. The daemon is a special process running in the background and is generally used for executing specific system tasks, task management and task flow pushing are realized by using the daemon, accidents such as interruption or stopping of the process can be reduced, and the stability and reliability of the task scheduling flow are further improved. After the first electronic device obtains the task script file, the task script file can be analyzed through the task management process, so that meta-information of the total task, information of each subtask contained in the total task and task dependency information among the subtasks are obtained.
The creating a flow instance according to meta-information of the total task, information of each subtask included in the total task, and task dependency information among the subtasks may include:
(1) The meta-information of the total task, the information of each subtask contained in the total task and the task dependency information among the subtasks are transmitted to a process engine process through a task management process;
(2) And creating a flow instance by combining flow configuration information set by a user based on the received meta-information of the total task, the information of each subtask contained in the total task and the task dependency information among the subtasks through a flow engine process.
The first electronic device can call the process engine process through the task management process, and send meta-information of the total task, information of all subtasks contained in the total task and task dependency information among all subtasks to the process engine process through modes of parameter transmission and the like. After receiving the information, the process of the flow engine creates scheduling information of the whole task, and one subtask can correspond to one subtask scheduling entity. Specifically, the process engine process may create a process instance for overall task scheduling according to the task information and the subtask scheduling entity. In addition, the user who initiates the task may also import and set corresponding flow configuration information according to personalized scheduling requirements (for example, which tasks are executed before the current subtask is scheduled, which electronic device the current subtask is assigned to execute, etc.), and consider the task meta-information, subtask and dependency information in combination when creating the flow instance, and the flow configuration information. After the process instance is created, the process engine process may start the process, and at this time, the task management process is called according to the first process node of the process instance to create a subtask, and the subtask is allocated to the corresponding electronic device for execution.
202. Starting from the first flow node to the last flow node in each flow node, and sequentially pushing the execution flow of the whole task;
after the first electronic device obtains the flow instance for scheduling the overall task, each flow node of the execution flow of the overall task can be determined, and then the execution flow of the overall task is sequentially pushed from the first flow node until the last flow node is pushed, namely, the overall task is executed.
In an implementation manner of the embodiment of the present application, the pushing the execution flow of the overall task sequentially from the first flow node to the last flow node in the respective flow nodes may include:
(1) Determining a current flow node of the execution flow of the overall task;
(2) Determining whether a process node jump condition is met according to the state information of the subtasks processed by each electronic device and the user-defined logic configured by the current process node;
(3) And if the flow node jump condition is met, pushing the execution flow of the total task to jump from the current flow node to the next flow node.
The pushing of the whole task execution flow can be responsible for a flow engine process, when the whole task execution flow is pushed to a certain flow node (represented by a current flow node), whether the flow node jump condition is met or not can be determined according to the state information of the subtasks processed by each electronic device of the link-down networking and the user-defined logic configured by the current flow node, if the flow node jump condition is met, the execution flow of the whole task is pushed to jump from the current flow node to the next flow node, otherwise, the whole task execution flow is kept at the current flow node. The state information of the subtasks processed by the electronic device may include states such as unexecuted, executing, executed, and intermediate results of waiting for dependency. The user can customize the skip condition of each flow node, for example, when a certain flow node monitors that a certain subtask has been executed and outputs a result, the output result meets the user-defined logic configured by the flow node (the user-defined logic can be a section of script written by the user, and the script can input the current network state, the resource state and the intermediate result of task execution to calculate, so as to optimize and accelerate the execution of the whole task flow), and then the next flow node can be skipped. The execution flow of the overall task (create-execute-get results) can be considered a state machine that is modeled with a flow (i.e., a flow instance), and each flow node executing the flow can be considered a state of the state machine.
203. In the process of sequentially pushing the execution flow of the whole task, scheduling decision information is acquired by calling an intelligent contract every time any one flow node is reached; creating subtasks to be scheduled according to node task information and scheduling decision information contained in the flow node; selecting a second electronic device from the at least two electronic devices according to the scheduling decision information; and distributing the subtasks to be scheduled to the second electronic equipment for processing.
In the process of sequentially pushing the execution flow of the whole task, jumping from one flow node to another flow node, creating a subtask corresponding to any flow node when the subtask reaches any flow node, and scheduling the subtask to be distributed to corresponding electronic equipment for processing.
In an implementation manner of the embodiment of the present application, node task information included in any one of the process nodes records a subtask to be executed by the any one of the process nodes and task dependency information of the subtask to be executed, where the scheduling decision information includes execution states of all subtasks included in the overall task; the creating the subtasks to be scheduled according to the node task information and the scheduling decision information contained in any one flow node may include:
And determining and creating the subtasks to be scheduled from the subtasks to be executed according to the task dependency information and the scheduling information of the subtasks to be executed and the execution states of the subtasks of the whole task.
When the execution flow reaches a certain flow node, the subtasks to be executed by the flow node and the task dependency information of the subtasks can be determined according to the node task information of the flow node, and then the subtasks to be scheduled can be created by combining the scheduling information of the subtasks (for example, whether the corresponding electronic equipment is scheduled to execute the subtasks) and the execution state of each subtask (for example, which subtasks are executed and which subtasks are not executed). For example, if when the flow node a is reached, it may be determined according to the node task information of the flow node that the subtasks to be executed are the subtask 1, the subtask 2 and the subtask 3, where the scheduling information of the subtask 1 is scheduled, the scheduling information of the subtask 2 and the subtask 3 are both unscheduled, and the subtasks on which the subtask 2 and the subtask 3 depend are already executed and obtain corresponding intermediate results, the subtask 2 and the subtask 3 may be determined as the subtasks to be scheduled, and at this time, the first electronic device may create the subtask 2 and the subtask 3 through the task management process, and then re-allocate the subtask 2 and the subtask 3 to the corresponding electronic devices for processing.
In one implementation manner of the embodiment of the application, each electronic device submits the state information of the subtasks processed by the electronic device to a task contract of a blockchain, and submits the device resource information to a flow engine contract of the blockchain, wherein the task contract and the flow engine contract are intelligent contracts deployed in the blockchain; the method for acquiring the scheduling decision information by calling the intelligent contract may include:
(1) Acquiring state information of subtasks processed by each electronic device by calling a task contract;
(2) Acquiring respective device resource information of each electronic device by calling a flow engine contract;
(3) And determining the state information of the subtasks processed by each electronic device and the device resource information of each electronic device as scheduling decision information.
In the process of advancing the execution flow of the overall task, each electronic device can submit the state information of the subtasks processed by each electronic device to the task contract of the blockchain in real time. For example, each electronic device may submit the execution status (such as not executing, executing or completing, etc.) of the subtasks processed by the respective task management process, and information such as the intermediate status of task execution, the upstream and downstream execution status of the tasks with dependency relationships, etc. to the task contracts on the chain in real time. On the other hand, each electronic device may monitor, through a respective process engine process, respective current device resource information, such as device memory, CPU usage, etc., and uplink the device resource information, which may specifically be a process engine contract submitted to the blockchain. In this way, the first electronic device may obtain the scheduling decision information by calling the on-chain intelligent contract, for example, may obtain the state information of the subtasks processed by each electronic device by calling the task contract, and may obtain the device resource information and the network condition information of each electronic device by calling the flow engine contract, where these information are used as scheduling decision information to determine to which electronic device the subtasks are allocated for processing.
Further, the selecting, according to the scheduling decision information, the second electronic device from the at least two electronic devices may include:
(1) Selecting candidate electronic equipment from the at least two electronic equipment according to the state information of the subtasks processed by each electronic equipment;
(2) And selecting a second electronic device from the candidate electronic devices according to the respective device resource information of each electronic device.
After the process engine process of the first electronic device obtains the scheduling decision information, the subtask to be scheduled can be allocated and executed according to the subtask execution state, the task execution intermediate result, the total task scheduling and subtask scheduling state, the device resource use condition of each electronic device and other information in the scheduling decision information. Specifically, the first electronic device may select candidate electronic devices from the at least two electronic devices according to the state information of the subtasks processed by each electronic device, for example, the electronic device currently in an idle state may be selected as the candidate electronic device after the execution of the subtasks; and then selecting a second electronic device from the candidate electronic devices according to the device resource information of each electronic device, for example, the electronic device with the lowest resource utilization rate can be selected from the candidate electronic devices as the second electronic device, and finally, the subtasks to be scheduled are distributed to the second electronic device for processing. After determining the second electronic device, the first electronic device may send information of the subtask to be scheduled to the second electronic device, and the second electronic device may execute the subtask to be scheduled. It should be noted that the number of the sub-tasks to be scheduled may be one or more, and the number of the second electronic devices performing the tasks may be one or more, for example, if there are 2 sub-tasks to be scheduled, the 2 sub-tasks may be allocated to the same electronic device for processing, or may be allocated to 2 different electronic devices for processing.
In addition, the process engine process of the first electronic device can also monitor the running state of each electronic device in real time, and if a fault or abnormality occurs in one electronic device, the subtask migration processing processed by the electronic device can be allocated to other normal electronic devices for execution. In the execution flow of the total task and the subtask, the flow engine process of the first electronic device can call the task management process to create a new subtask, pause the subtask or resume the subtask operation according to the information such as the task scheduling information, the device resource information, the task state information and the like, and meanwhile, the new task scheduling state can be written into a flow engine contract on a chain, and finally, the execution result of the total task is obtained.
In general, the process engine process of the first electronic device may construct a process instance of an overall task according to the task combination and the dependency relationship thereof, for example, the overall task is formed by 7 subtasks, subtask 1 and subtask 2 form a process node, subtask 3 and subtask 4 form another process node, subtask 5 may be scheduled after the subtask 2 and subtask 4 are executed, subtask 6 may have to wait for an intermediate result of subtask 1 and be a CPU intensive task, and the process engine process may create a process instance according to these information. Then, the process engine process pushes the process nodes of the process instance to jump, and subtasks are created and distributed to the corresponding electronic devices for execution in the middle according to the task execution condition and the resource use condition of each electronic device.
In the embodiment of the application, when the electronic equipment which is networked under the chain is required to execute a certain overall task, a task scheduling process can be initiated by any one electronic equipment, a process instance for scheduling the overall task is obtained, and the execution process of the overall task is sequentially pushed according to the process node contained in the process instance. In addition, in the process of pushing the execution flow of the whole task, scheduling decision information can be obtained by calling an intelligent contract every time any flow node is reached; creating subtasks to be scheduled according to node task information and scheduling decision information contained in the flow node; and then, making a decision according to the scheduling decision information, so that the subtasks to be scheduled are distributed to corresponding electronic equipment for processing. By the arrangement, each subtask to be scheduled can be divided according to the execution flow of the whole task, and the subtasks are allocated to which electronic devices to execute according to the obtained scheduling decision information, so that the distributed parallel processing of the multitasking is realized, namely, the tasks can be efficiently executed by using a plurality of electronic devices which are networked under a chain.
In summary, the embodiment of the present application proposes a method for distributing intelligent task arrangement based on a flow engine and an on-chain intelligent contract, where a task initiator creates a flow instance of an overall task, and pushes a jump of each flow node through the flow engine, and a corresponding subtask can be created at each flow node, and the task initiator can obtain scheduling decision information by calling the intelligent contract, and can distribute the created subtask to a corresponding electronic device for processing according to the scheduling decision information, so as to finally implement efficient execution of the task.
It should be understood that the sequence numbers of the steps in the foregoing embodiments do not mean the order of execution, and the execution order of the processes should be determined by the functions and the internal logic, and should not be construed as limiting the implementation process of the embodiments of the present application.
A task scheduling method is mainly described above, and a task scheduling apparatus will be described below.
Referring to fig. 4, an embodiment of a task scheduling device applied to a first electronic device (the first electronic device is any one of at least two electronic devices that are networked) in an embodiment of the present application includes:
A process instance obtaining module 401, configured to obtain a process instance for scheduling an overall task; the process instance comprises each process node of the execution process of the overall task, and each process node comprises respective node task information;
a flow pushing module 402, configured to sequentially push the execution flow of the overall task from the first flow node to the last flow node in the respective flow nodes;
the task scheduling module 403 is configured to obtain scheduling decision information by calling an intelligent contract when any one process node is reached in a process of sequentially pushing execution processes of the overall task; creating subtasks to be scheduled according to node task information and the scheduling decision information contained in any flow node; selecting a second electronic device from the at least two electronic devices according to the scheduling decision information; and distributing the subtasks to be scheduled to the second electronic equipment for processing.
In an implementation manner of the embodiment of the present application, the task scheduling device may further include:
the script file acquisition module is used for acquiring a task script file input by a user;
The script file analysis module is used for analyzing the task script file to obtain meta-information of a total task contained in the overall task, information of each subtask contained in the total task and task dependency information among the subtasks;
and the flow instance creation module is used for creating the flow instance according to the meta-information of the total task, the information of each subtask contained in the total task and the task dependency information among the subtasks.
Further, the first electronic device is provided with a task management process and a flow engine process, wherein the task management process is a daemon process for realizing task management, and the flow engine process is a daemon process for realizing overall task flow promotion; the script file parsing module may include:
the script file analysis unit is used for analyzing the task script file through the task management process to obtain meta-information of the total task, information of each subtask contained in the total task and task dependency information among the subtasks;
the flow instance creation module may include:
the information transfer unit is used for transferring the meta-information of the total task, the information of each subtask contained in the total task and the task dependency information among the subtasks to the process engine process through the task management process;
The process instance creation unit is used for creating the process instance by combining process configuration information set by a user based on the received meta-information of the total task, the information of each subtask contained in the total task and the task dependency information among the subtasks through the process engine process.
In one implementation manner of the embodiment of the present application, each electronic device submits state information of a subtask that is processed separately to a task contract of a blockchain, and submits device resource information of each electronic device to a flow engine contract of the blockchain, where the task contract and the flow engine contract are both intelligent contracts deployed in the blockchain; the task scheduling module may include:
the task state acquisition unit is used for acquiring state information of each subtask processed by each electronic device by calling the task contract;
the device resource acquisition unit is used for acquiring the respective device resource information of each electronic device by calling the flow engine contract;
and the scheduling decision information determining unit is used for determining the state information of the subtasks processed by each electronic device and the device resource information of each electronic device as the scheduling decision information.
Further, the task scheduling module may include:
the first equipment selecting unit is used for selecting candidate electronic equipment from the at least two electronic equipment according to the state information of the subtasks processed by each electronic equipment;
and the second equipment selecting unit is used for selecting the second electronic equipment from the candidate electronic equipment according to the equipment resource information of each electronic equipment.
Further, the flow pushing module may include:
a process node determining unit, configured to determine a current process node of the execution flow of the overall task;
the jump condition judging unit is used for determining whether the jump condition of the flow node is met or not according to the state information of the subtasks processed by each electronic device and the user-defined logic configured by the current flow node;
and the flow node jumping unit is used for pushing the execution flow of the whole task to jump from the current flow node to the next flow node if the flow node jumping condition is met.
In an implementation manner of the embodiment of the present application, the node task information included in the arbitrary flow node records subtasks to be executed by the arbitrary flow node and task dependency information of the subtasks to be executed, where the scheduling decision information includes execution states of all the subtasks of the overall task; the task scheduling module may include:
And the subtask creation unit is used for determining and creating the subtask to be scheduled from the subtasks to be executed according to the task dependency information and the scheduling information of the subtasks to be executed and the execution state of each subtask of the overall task.
The embodiment of the application also provides a computer readable storage medium, wherein the computer readable storage medium stores a computer program, and the computer program realizes the task scheduling method described in any embodiment when being executed by a processor.
Embodiments of the present application also provide a computer program product which, when run on an electronic device, causes the electronic device to perform a task scheduling method as described in any of the embodiments above.
Fig. 5 is a schematic diagram of an electronic device according to an embodiment of the present application. As shown in fig. 5, the electronic apparatus 5 of this embodiment includes: a processor 50, a memory 51 and a computer program 52 stored in said memory 51 and executable on said processor 50. The processor 50, when executing the computer program 52, implements the steps of the embodiments of the respective task scheduling methods described above, such as steps 201 to 203 shown in fig. 2. Alternatively, the processor 50, when executing the computer program 52, performs the functions of the modules/units of the apparatus embodiments described above, e.g., the functions of the modules 401 to 403 shown in fig. 4.
The computer program 52 may be divided into one or more modules/units which are stored in the memory 51 and executed by the processor 50 to complete the present application. The one or more modules/units may be a series of computer program instruction segments capable of performing the specified functions, which instruction segments are used to describe the execution of the computer program 52 in the electronic device 5.
The processor 50 may be a central processing unit (Central Processing Unit, CPU), other general purpose processors, digital signal processors (Digital Signal Processor, DSP), application specific integrated circuits (Application Specific Integrated Circuit, ASIC), off-the-shelf programmable gate arrays (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The memory 51 may be an internal storage unit of the electronic device 5, such as a hard disk or a memory of the electronic device 5. The memory 51 may be an external storage device of the electronic device 5, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card) or the like, which are provided on the electronic device 5. Further, the memory 51 may also include both an internal storage unit and an external storage device of the electronic device 5. The memory 51 is used for storing the computer program and other programs and data required by the electronic device. The memory 51 may also be used to temporarily store data that has been output or is to be output.
It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-described division of the functional units and modules is illustrated, and in practical application, the above-described functional distribution may be performed by different functional units and modules according to needs, i.e. the internal structure of the apparatus is divided into different functional units or modules to perform all or part of the above-described functions. The functional units and modules in the embodiment may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit, where the integrated units may be implemented in a form of hardware or a form of a software functional unit. In addition, the specific names of the functional units and modules are only for distinguishing from each other, and are not used for limiting the protection scope of the present application. The specific working process of the units and modules in the above system may refer to the corresponding process in the foregoing method embodiment, which is not described herein again.
It will be clear to those skilled in the art that, for convenience and brevity of description, specific working procedures of the above-described systems, apparatuses and units may refer to corresponding procedures in the foregoing method embodiments, which are not repeated herein.
In the foregoing embodiments, the descriptions of the embodiments are emphasized, and in part, not described or illustrated in any particular embodiment, reference is made to the related descriptions of other embodiments.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other manners. For example, the system embodiments described above are merely illustrative, e.g., the division of the modules or units is merely a logical functional division, and there may be additional divisions when actually implemented, e.g., multiple units or components may be combined or integrated into another system, or some features may be omitted, or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection via interfaces, devices or units, which may be in electrical, mechanical or other forms.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the embodiment of the present application.
In addition, each functional unit in the embodiments of the present application may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units may be implemented in hardware or in software functional units.
The integrated units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer readable storage medium. Based on such understanding, the present application may implement all or part of the flow of the method of the above embodiment, or may be implemented by a computer program to instruct related hardware, where the computer program may be stored in a computer readable storage medium, and when the computer program is executed by a processor, the computer program may implement the steps of each of the method embodiments described above. Wherein the computer program comprises computer program code which may be in source code form, object code form, executable file or some intermediate form etc. The computer readable medium may include: any entity or device capable of carrying the computer program code, a recording medium, a U disk, a removable hard disk, a magnetic disk, an optical disk, a computer Memory, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), an electrical carrier signal, a telecommunications signal, a software distribution medium, and so forth. It should be noted that the computer readable medium may include content that is subject to appropriate increases and decreases as required by jurisdictions in which such content is subject to legislation and patent practice, such as in certain jurisdictions in which such content is not included as electrical carrier signals and telecommunication signals.
The above embodiments are only for illustrating the technical solution of the present application, and not for limiting the same; although the application has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present application, and are intended to be included in the scope of the present application.

Claims (10)

1. The task scheduling method is applied to a first electronic device, wherein the first electronic device is any one of at least two electronic devices which are networked, and is characterized by comprising the following steps:
acquiring a flow instance for scheduling the overall task; the process instance comprises each process node of the execution process of the overall task, and each process node comprises respective node task information;
starting from the first flow node to the last flow node in the flow nodes, and sequentially pushing the execution flow of the whole task;
In the process of sequentially pushing the execution flow of the whole task, acquiring scheduling decision information by calling an intelligent contract when any flow node is reached; creating subtasks to be scheduled according to node task information and the scheduling decision information contained in any flow node; selecting a second electronic device from the at least two electronic devices according to the scheduling decision information; and distributing the subtasks to be scheduled to the second electronic equipment for processing.
2. The method of claim 1, further comprising, prior to obtaining a flow instance for scheduling the overall task:
acquiring a task script file input by a user;
analyzing the task script file to obtain meta-information of a total task contained in the overall task, information of all subtasks contained in the total task and task dependency information among all subtasks;
and creating and obtaining the flow instance according to the meta-information of the total task, the information of each subtask contained in the total task and the task dependency information among the subtasks.
3. The method of claim 2, wherein the first electronic device is provided with a task management process and a flow engine process, the task management process being a daemon for implementing task management, the flow engine process being a daemon for implementing overall task flow promotion; analyzing the task script file to obtain meta-information of a total task included in the overall task, information of each subtask included in the total task, and task dependency information among the subtasks, wherein the meta-information comprises:
Analyzing the task script file through the task management process to obtain meta-information of the total task, information of all subtasks contained in the total task and task dependency information among all subtasks;
the creating the process instance according to the meta information of the total task, the information of each subtask contained in the total task and the task dependency information among the subtasks, includes:
the meta-information of the total task, the information of each subtask contained in the total task and the task dependency information among the subtasks are transmitted to the process engine process through the task management process;
and establishing the process instance by combining process configuration information set by a user based on the received meta-information of the total task, the information of each subtask contained in the total task and the task dependency information among the subtasks through the process of the process engine.
4. The method of claim 1, wherein each of the electronic devices submits state information of a respective processed subtask to a task contract of a blockchain, and submits respective device resource information to a flow engine contract of the blockchain, the task contract and the flow engine contract being intelligent contracts deployed in the blockchain; the method for acquiring the scheduling decision information by calling the intelligent contract comprises the following steps:
Acquiring state information of each subtask processed by each electronic device by calling the task contract;
acquiring respective device resource information of each electronic device by calling the flow engine contract;
and determining the state information of the subtasks processed by each electronic device and the device resource information of each electronic device as the scheduling decision information.
5. The method of claim 4, wherein the selecting a second electronic device from the at least two electronic devices based on the scheduling decision information comprises:
selecting candidate electronic equipment from the at least two electronic equipment according to the state information of the subtasks processed by each electronic equipment;
and selecting the second electronic equipment from the candidate electronic equipment according to the equipment resource information of each electronic equipment.
6. The method of claim 4, wherein sequentially pushing the execution flow of the overall task from the first flow node to the last flow node of the respective flow nodes comprises:
determining a current flow node of the execution flow of the overall task;
Determining whether a process node jump condition is met according to the state information of the subtasks processed by each electronic device and the user-defined logic configured by the current process node;
and if the flow node jump condition is met, pushing the execution flow of the whole task to jump from the current flow node to the next flow node.
7. A method according to any one of claims 1 to 6, wherein the node task information included in any one of the process nodes records subtasks to be executed by the any one of the process nodes and task dependency information of the subtasks to be executed, and the scheduling decision information includes execution states of respective subtasks of the overall task; the creating a subtask to be scheduled according to the node task information and the scheduling decision information contained in the arbitrary flow node includes:
and determining and creating the subtasks to be scheduled from the subtasks to be executed according to the task dependency information and the scheduling information of the subtasks to be executed and the execution states of all the subtasks of the overall task.
8. A task scheduling device applied to a first electronic device, where the first electronic device is any one of at least two electronic devices that are networked, the device comprising:
the flow instance acquisition module is used for acquiring a flow instance for scheduling the whole task; the process instance comprises each process node of the execution process of the overall task, and each process node comprises respective node task information;
the flow pushing module is used for sequentially pushing the execution flow of the whole task from the first flow node to the last flow node in the flow nodes;
the task scheduling module is used for acquiring scheduling decision information by calling an intelligent contract when any one process node is reached in the process of sequentially pushing the execution processes of the whole tasks; creating subtasks to be scheduled according to node task information and the scheduling decision information contained in any flow node; selecting a second electronic device from the at least two electronic devices according to the scheduling decision information; and distributing the subtasks to be scheduled to the second electronic equipment for processing.
9. An electronic device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the task scheduling method of any one of claims 1 to 7 when executing the computer program.
10. A computer readable storage medium storing a computer program, wherein the computer program when executed by a processor implements the task scheduling method of any one of claims 1 to 7.
CN202310792750.6A 2023-06-29 2023-06-29 Task scheduling method and device, electronic equipment and storage medium Pending CN116880973A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310792750.6A CN116880973A (en) 2023-06-29 2023-06-29 Task scheduling method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310792750.6A CN116880973A (en) 2023-06-29 2023-06-29 Task scheduling method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN116880973A true CN116880973A (en) 2023-10-13

Family

ID=88254004

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310792750.6A Pending CN116880973A (en) 2023-06-29 2023-06-29 Task scheduling method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN116880973A (en)

Similar Documents

Publication Publication Date Title
US20070016907A1 (en) Method, system and computer program for automatic provisioning of resources to scheduled jobs
CN109656782A (en) Visual scheduling monitoring method, device and server
CN110209484B (en) Credible cloud task scheduling system and method based on multiple clouds and security mapping
CN111932257B (en) Block chain parallelization processing method and device
CN102541657A (en) Method and device for function distribution amid operation of a hardware accelerator
KR20150042873A (en) Fault tolerant batch processing
US8065681B2 (en) Generic shared memory barrier
US20080040725A1 (en) Method and apparatus for a parallel model of tasks including abstracted execution and software development
CN109189572B (en) Resource estimation method and system, electronic equipment and storage medium
US20180101404A1 (en) Resource and latency estimation-based scheduling
CN109901818B (en) System and method for software architecture design
US8458136B2 (en) Scheduling highly parallel jobs having global interdependencies
Choi et al. An enhanced data-locality-aware task scheduling algorithm for hadoop applications
CN110225082B (en) Task processing method and device, electronic equipment and computer readable medium
CN1783121A (en) Method and system for executing design automation
US10503548B2 (en) Resource and latency estimation-based scheduling in a distributed computing environment
CN116880973A (en) Task scheduling method and device, electronic equipment and storage medium
CN116719623A (en) Job scheduling method, job result processing method and device
CN111190731A (en) Cluster task scheduling system based on weight
CN115712572A (en) Task testing method and device, storage medium and electronic device
CN110659125A (en) Analysis task execution method, device and system and electronic equipment
Zhang et al. Start time configuration for strictly periodic real-time task systems
CN115543577A (en) Kubernetes resource scheduling optimization method based on covariates, storage medium and equipment
CN111338775B (en) Method and equipment for executing timing task
CN117009063A (en) Task execution method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination