Disclosure of Invention
The present invention is directed to a method, an apparatus, an electronic device, and a storage medium for task frequency conversion that overcome the above-mentioned shortcomings in the related art, and further overcome one or more of the problems due to the limitations and disadvantages of the related art, at least to some extent.
According to an aspect of the present invention, there is provided a task frequency conversion method, including:
determining the dependency relationship of each task, and associating the task frequency with each task;
and in the determined dependency relationship, when the task frequency of the dependent task is different from that of the depended task, performing task frequency conversion between at least part of the dependent task and the depended task so as to enable the task frequency of the depended task to be the same as that of the dependent task.
Optionally, in the determined dependency relationship, when the task frequency of the dependent task is different from the task frequency of the depended task, performing task frequency conversion between the dependent task and the depended task so that the task frequency of each task in the dependency relationship is the same.
Optionally, the task frequency conversion triggers the execution of the dependent task according to whether the depended task hits a predetermined trigger condition.
Optionally, when the task frequency of the depended task is less than the task frequency of the dependent task, the predetermined trigger condition includes:
the depended task is successfully executed for the first time to trigger the depended task;
in the period indicated by the task frequency of the dependent task, the dependent tasks are all executed successfully to trigger the dependent task;
the successful execution of the depended task a predetermined number of times triggers the dependent task.
Optionally, when the task frequency of the depended task is greater than the task frequency of the dependent task, the predetermined trigger condition includes:
and determining the time of the execution success or failure of the dependent task according to the period indicated by the task frequency of the dependent task, and triggering the execution of the dependent task or suspending the execution according to the determined time.
Optionally, the predetermined trigger condition is determined from at least one preconfigured trigger condition and/or at least one custom configured trigger condition.
Optionally, the task frequency comprises one or more of a yearly frequency, a monthly frequency, a weekly frequency, a daily frequency, an hourly frequency, a half-hour frequency, a 15 minute frequency, a minute frequency.
According to still another aspect of the present invention, there is also provided a task frequency conversion apparatus, including:
the determining module is used for determining the dependency relationship of each task, and the task frequency is associated with each task;
and the task frequency conversion module is used for performing task frequency conversion between at least part of the dependent tasks and the depended tasks when the task frequencies of the dependent tasks and the depended tasks are not consistent in the determined dependency relationship so as to enable the task frequency of the depended tasks to be the same as the task frequency of the dependent tasks.
According to still another aspect of the present invention, there is also provided an electronic apparatus, including: a processor; a storage medium having stored thereon a computer program which, when executed by the processor, performs the steps as described above.
According to yet another aspect of the present invention, there is also provided a storage medium having stored thereon a computer program which, when executed by a processor, performs the steps as described above.
Compared with the prior art, the invention has the advantages that:
the invention provides the step of task frequency conversion, the judgment triggering of the task frequency and the logic of task execution are separated, the task frequency conversion is independently developed and designed, and the task is only executed and executed, thereby realizing the task frequency conversion with different frequencies, not only realizing the conversion from high frequency to low frequency and from low frequency to high frequency, but also customizing the special frequency, and greatly increasing the flexibility of task configuration. And scheduling management and triggering of tasks can be guaranteed to be completed among the same-frequency tasks, cross-frequency judgment cannot be made on the verification of historical data, whether the tasks are completed and the like due to the need, and complexity of system design is greatly reduced.
Detailed Description
Example embodiments will now be described more fully with reference to the accompanying drawings. Example embodiments may, however, be embodied in many different forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the concept of example embodiments to those skilled in the art. The described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.
Furthermore, the drawings are merely schematic illustrations of the invention and are not necessarily drawn to scale. The same reference numerals in the drawings denote the same or similar parts, and thus their repetitive description will be omitted. Some of the block diagrams shown in the figures are functional entities and do not necessarily correspond to physically or logically separate entities. These functional entities may be implemented in the form of software, or in one or more hardware modules or integrated circuits, or in different networks and/or processor devices and/or microcontroller devices.
The flow charts shown in the drawings are merely illustrative and do not necessarily include all of the steps. For example, some steps may be decomposed, and some steps may be combined or partially combined, so that the actual execution sequence may be changed according to the actual situation.
Fig. 1 shows a flowchart of a task frequency conversion method according to an embodiment of the present invention. Referring to fig. 1, the task frequency conversion method includes the following steps:
step S110: determining the dependency relationship of each task, and associating the task frequency with each task;
step S120: and in the determined dependency relationship, when the task frequency of the dependent task is different from that of the depended task, performing task frequency conversion between at least part of the dependent task and the depended task so as to enable the task frequency of the depended task to be the same as that of the dependent task.
In the task frequency conversion method of the exemplary embodiment of the invention, the step of task frequency conversion is provided, the judgment triggering of the task frequency is separated from the logic of task execution, the task frequency conversion is separately developed and designed, and the task is only executed and responsible for execution, so that the task frequency conversion with different frequencies is realized, the conversion from high frequency to low frequency and from low frequency to high frequency can be realized, the special frequency can be customized, and the flexibility of task configuration is greatly increased. And scheduling management and triggering of tasks can be guaranteed to be completed among the same-frequency tasks, cross-frequency judgment cannot be made on the verification of historical data, whether the tasks are completed and the like due to the need, and complexity of system design is greatly reduced.
Specifically, in various embodiments of the present invention, the task frequency includes one or more of a yearly frequency, a monthly frequency, a weekly frequency, a daily frequency, an hourly frequency, a half-hour frequency, a 15-minute frequency, and a minute frequency. The present invention is not limited thereto, and half-year frequency, quarter frequency or other custom frequency are all within the scope of the present invention. The invention provides the step of task frequency conversion, so that the system can support any user-defined frequency and has high flexibility.
Specifically, in each embodiment of the present invention, in the step S120, when the task frequencies of the dependent tasks and the dependent tasks in the determined dependency relationship are not consistent, task frequency conversion may be performed between the dependent tasks and the dependent tasks so that the task frequencies of the tasks in the dependency relationship are the same. It can be understood that when the task frequency of the dependent task is inconsistent with that of the depended task, the task frequency conversion is carried out between the dependent task and the depended task which are partially inconsistent, so that the flexibility of the system is improved; and performing task frequency conversion between all inconsistent dependent tasks and depended tasks, so that the expandability of the system is improved, and the complexity of the system design is reduced.
Specifically, in various embodiments of the present invention, the task frequency conversion may be to trigger the execution of the dependent task according to whether the dependent task hits a predetermined trigger condition. Therefore, the triggering condition and the task execution are decoupled, and the judgment of the triggering condition in the task is not needed. Further, the predetermined trigger condition is determined from at least one preconfigured trigger condition and/or at least one custom configured trigger condition. In other words, the user may set a plurality of preconfigured trigger conditions from which the predetermined trigger condition may be selected for the dependent task and the depended task of the current dependency relationship. In other embodiments, the user may configure the trigger condition for the dependent task and the depended task in the current dependency relationship in a customized manner (for example, when there is a custom task frequency in the current dependency relationship), and thus, the customized configuration trigger condition may be selected as the predetermined trigger condition. The present invention is not limited thereto, and will not be described herein again.
An embodiment of the present invention is described below with reference to fig. 2, and fig. 2 shows a schematic diagram of a task frequency conversion method according to an embodiment of the present invention. FIG. 2 shows a dependent task 203 and a depended task 201 and a depended task 202 of the dependent task 203. The task frequency of the dependent task 203 is an antenna frequency, the task frequency of the depended task 201 is an antenna frequency, and the task frequency of the depended task 202 is an hour frequency. In this dependency relationship, the frequencies of the depended-on tasks 202 and the dependent tasks 203 do not coincide, and therefore, the task frequency conversion of step S210 is performed at the depended-on tasks 202 and the dependent tasks 203.
In the present embodiment, the task frequency of the depended tasks 202 is less than the task frequency of the dependent tasks 203. Thus, the predetermined trigger condition for task frequency conversion may include: the depended task is successfully executed for the first time to trigger the depended task; in the period indicated by the task frequency of the dependent task, the dependent tasks are all executed successfully to trigger the dependent task; the successful execution of the depended task a predetermined number of times triggers the dependent task.
For example, for a depended task which is successfully executed for the first time to trigger the dependent task, in an actual scene, a day task is triggered after an hourly task is successfully executed for the first time, an hourly task 202 is executed for the first time as a point 0, and when the hourly task is successfully executed at the point 0, an hourly task 203 can be executed (under the condition that an hourly task 201 is successfully executed); when the hourly tasks 202 fail to be executed at the point 0, the hourly tasks are executed again at the point 1 until the hourly tasks 202 are successfully executed, i.e., the daily tasks 203 (in case the daily tasks 201 are successfully executed) can be executed. This configuration is generally applicable to hourly tasks of data coverage
For another example, for a period indicated by the task frequency of the dependent task, the dependent tasks are all successfully executed to trigger the dependent task, and in practical applications, the period (24 hours) indicated by the task frequency of the day-to-day task 203 may be set, and when the tasks 202 with the time-to-hour frequency are all successfully executed within 24 hours, the task frequency of the day-to-day task 203 may be executed (in a case where the task frequency of the day-to-day task 201 is successfully executed). This arrangement is generally applicable to an hourly task time-sliced by data scenario, i.e., a task is not completed until 24 hours and every hour are successful before the task is required
For another example, for the dependent task triggered by the predetermined number of successful executions of the depended task, in practical applications, the predetermined number of times N (N is an integer greater than 1) may be set, and the hourly task 202 may be executed N times later to execute the daily task 203 (in case of successful executions of the daily task 201). This scenario applies to the case where data has been collected from 0-N hours ago.
The above is only a schematic description of a plurality of embodiments of the present invention, and the predetermined trigger condition of the present invention is not limited thereto, and for example, the predetermined trigger condition may further include setting the executed dependent task to not less than N times of failure, odd number of times of execution, even number of times of execution, and the like, which are not described herein again.
An embodiment of the present invention is described below with reference to fig. 3, and fig. 3 shows a schematic diagram of a task frequency conversion method according to another embodiment of the present invention. FIG. 3 shows a dependent task 303 and a depended task 301 and a depended task 302 of the dependent task 303. The task frequency of the dependent task 303 is an hourly frequency, the task frequency of the depended task 301 is an hourly frequency, and the task frequency of the depended task 302 is an daily frequency. In this dependency relationship, the frequencies of the depended-on tasks 302 and the dependent tasks 303 do not coincide, and therefore, the task frequency conversion of step S310 is performed in the depended-on tasks 302 and the dependent tasks 303.
In this embodiment, the task frequency of the depended tasks 302 is greater than the task frequency of the dependent tasks 303. Thus, the predetermined trigger condition for task frequency conversion may include: and determining the time of the execution success or failure of the dependent task according to the period indicated by the task frequency of the dependent task, and triggering the execution of the dependent task or suspending the execution according to the determined time. For example, in the present embodiment, if the depended task 302 succeeds in executing at 6 points, the depended task 303 is triggered every hour from 7 points; or the executed dependent task 302 is successfully executed at 6 points, the dependent task 303 is triggered from 0 point to 6 points every hour, and the triggering is stopped after 7 points.
The above description is only illustrative of the embodiments of the present invention, and the present invention is not limited thereto.
Referring now to fig. 4, fig. 4 is a schematic diagram illustrating a task frequency conversion apparatus according to an embodiment of the present invention. The method is applied to each node server of the public cloud cluster. The task frequency conversion device and each module can be realized in the form of software and/or hardware. The task frequency conversion apparatus 400 includes: a determining module 410 and a task frequency converting module 420.
The determining module 410 is configured to determine a dependency relationship of each task, where each task is associated with a task frequency;
the task frequency conversion module 420 is configured to perform task frequency conversion between at least part of the dependent tasks and the depended tasks when the task frequencies of the dependent tasks and the depended tasks are not consistent in the determined dependency relationship, so that the task frequency of the depended tasks is the same as the task frequency of the dependent tasks.
In the task frequency conversion device of the exemplary embodiment of the invention, the step of task frequency conversion is provided, the judgment triggering and the task execution logic are separated, the task frequency conversion is separately developed and designed, and the task is only executed and responsible for execution, so that the task frequency conversion with different frequencies is realized, the conversion from high frequency to low frequency and from low frequency to high frequency can be realized, the special frequency can be customized, and the flexibility of task configuration is greatly increased. And scheduling management and triggering of tasks can be guaranteed to be completed among the same-frequency tasks, cross-frequency judgment cannot be made on the verification of historical data, whether the tasks are completed and the like due to the need, and complexity of system design is greatly reduced.
Fig. 4 is a schematic diagram illustrating the task frequency conversion apparatus 400 provided by the present invention, and the splitting, combining, and adding of modules are within the scope of the present invention without departing from the concept of the present invention.
In an exemplary embodiment of the present invention, a computer-readable storage medium is further provided, on which a computer program is stored, which when executed by, for example, a processor, may implement the steps of the task frequency conversion method described in any one of the above embodiments. In some possible embodiments, aspects of the present invention may also be implemented in the form of a program product comprising program code means for causing a terminal device to carry out the steps according to various exemplary embodiments of the present invention described in the task frequency conversion method section above of this description, when said program product is run on the terminal device.
Referring to fig. 5, a program product 700 for implementing the above method according to an embodiment of the present invention is described, which may employ a portable compact disc read only memory (CD-ROM) and include program code, and may be run on a terminal device, such as a personal computer. However, the program product of the present invention is not limited in this regard and, in the present document, a readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
The program product may employ any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples (a non-exhaustive list) of the readable storage medium include: an electrical connection having one or more wires, a portable disk, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
The computer readable storage medium may include a propagated data signal with readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A readable storage medium may also be any readable medium that is not a readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a readable storage medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Program code for carrying out operations for aspects of the present invention may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, C + + or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the tenant computing device, partly on the tenant device, as a stand-alone software package, partly on the tenant computing device and partly on a remote computing device, or entirely on the remote computing device or server. In the case of remote computing devices, the remote computing devices may be connected to the tenant computing device through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computing device (e.g., through the internet using an internet service provider).
In an exemplary embodiment of the invention, there is also provided an electronic device that may include a processor and a memory for storing executable instructions of the processor. Wherein the processor is configured to execute the steps of the task frequency conversion method in any one of the above embodiments via executing the executable instructions.
As will be appreciated by one skilled in the art, aspects of the present invention may be embodied as a system, method or program product. Thus, various aspects of the invention may be embodied in the form of: an entirely hardware embodiment, an entirely software embodiment (including firmware, microcode, etc.) or an embodiment combining hardware and software aspects that may all generally be referred to herein as a "circuit," module "or" system.
An electronic device 500 according to this embodiment of the invention is described below with reference to fig. 6. The electronic device 500 shown in fig. 6 is only an example and should not bring any limitation to the functions and the scope of use of the embodiments of the present invention.
As shown in fig. 6, the electronic device 500 is embodied in the form of a general purpose computing device. The components of the electronic device 500 may include, but are not limited to: at least one processing unit 510, at least one memory unit 520, a bus 530 that couples various system components including the memory unit 520 and the processing unit 510, a display unit 540, and the like.
Wherein the storage unit stores program code executable by the processing unit 510 to cause the processing unit 510 to perform steps according to various exemplary embodiments of the present invention described in the task frequency conversion method section above in this specification. For example, the processing unit 510 may perform the steps as shown in fig. 1.
The memory unit 520 may include a readable medium in the form of a volatile memory unit, such as a random access memory unit (RAM)5201 and/or a cache memory unit 5202, and may further include a read only memory unit (ROM) 5203.
The memory unit 520 may also include a program/utility 5204 having a set (at least one) of program modules 5205, such program modules 5205 including, but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which, or some combination thereof, may comprise an implementation of a network environment.
Bus 530 may be one or more of any of several types of bus structures including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.
The electronic device 500 may also communicate with one or more external devices 600 (e.g., keyboard, pointing device, bluetooth device, etc.), with one or more devices that enable a tenant to interact with the electronic device 500, and/or with any devices (e.g., router, modem, etc.) that enable the electronic device 500 to communicate with one or more other computing devices. Such communication may occur via input/output (I/O) interfaces 550. Also, the electronic device 500 may communicate with one or more networks (e.g., a Local Area Network (LAN), a Wide Area Network (WAN), and/or a public network, such as the internet) via the network adapter 560. The network adapter 560 may communicate with other modules of the electronic device 500 via the bus 530. It should be appreciated that although not shown in the figures, other hardware and/or software modules may be used in conjunction with the electronic device 500, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, among others.
Through the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein may be implemented by software, or by software in combination with necessary hardware. Therefore, the technical solution according to the embodiment of the present invention may be embodied in the form of a software product, which may be stored in a non-volatile storage medium (which may be a CD-ROM, a usb disk, a removable hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which may be a personal computer, a server, or a network device, etc.) to execute the task frequency conversion method according to the embodiment of the present invention.
Compared with the prior art, the invention has the advantages that:
the invention provides the step of task frequency conversion, the judgment triggering of the task frequency and the logic of task execution are separated, the task frequency conversion is independently developed and designed, and the task is only executed and executed, thereby realizing the task frequency conversion with different frequencies, not only realizing the conversion from high frequency to low frequency and from low frequency to high frequency, but also customizing the special frequency, and greatly increasing the flexibility of task configuration. And scheduling management and triggering of tasks can be guaranteed to be completed among the same-frequency tasks, cross-frequency judgment cannot be made on the verification of historical data, whether the tasks are completed and the like due to the need, and complexity of system design is greatly reduced.
Other embodiments of the invention will be apparent to those skilled in the art from consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the invention following, in general, the principles of the invention and including such departures from the present disclosure as come within known or customary practice within the art to which the invention pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the invention being indicated by the following claims.