[go: up one dir, main page]

CN112860394B - Scheduled task scheduling execution method, device, electronic device and storage medium - Google Patents

Scheduled task scheduling execution method, device, electronic device and storage medium Download PDF

Info

Publication number
CN112860394B
CN112860394B CN202110083321.2A CN202110083321A CN112860394B CN 112860394 B CN112860394 B CN 112860394B CN 202110083321 A CN202110083321 A CN 202110083321A CN 112860394 B CN112860394 B CN 112860394B
Authority
CN
China
Prior art keywords
timing task
task
service
timing
application service
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202110083321.2A
Other languages
Chinese (zh)
Other versions
CN112860394A (en
Inventor
周崧
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Technology Shenzhen Co Ltd
Original Assignee
Ping An Technology Shenzhen 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 Ping An Technology Shenzhen Co Ltd filed Critical Ping An Technology Shenzhen Co Ltd
Priority to CN202110083321.2A priority Critical patent/CN112860394B/en
Publication of CN112860394A publication Critical patent/CN112860394A/en
Application granted granted Critical
Publication of CN112860394B publication Critical patent/CN112860394B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • G06F9/4881Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention relates to big data technology, and discloses a timing task scheduling execution method, which comprises the following steps: receiving a timing task request, and generating a timing task corresponding to the timing task request based on a remote dictionary service; storing parameters of the timing task in the remote dictionary service according to the timing task request; determining a target application service based on a preset monitor and a distributed lock; and executing the timing task by using the target application service and the parameters. Furthermore, the present invention relates to blockchain techniques, where the timing tasks may be stored at nodes of the blockchain. The invention also provides a timing task scheduling execution device, electronic equipment and a computer readable storage medium. The invention can solve the problems of low dependence on the database and low scheduling efficiency.

Description

Timing task scheduling execution method and device, electronic equipment and storage medium
Technical Field
The present invention relates to the field of computer data processing technologies, and in particular, to a method and apparatus for scheduling and executing a timing task, an electronic device, and a computer readable storage medium.
Background
With the explosive growth of data and traffic, a single server cannot meet the requirement, most of the current service systems are deployed in a cluster mode, timing tasks are very common in the service systems, and the scheduling processing of the timing tasks plays an important role for the service systems.
The traditional timing task scheduling execution mode uses Quartz (a Schmitt formula), but the mode depends on a database, a plurality of tables need to be created, the efficiency is low, and the method cannot be applied to micro-services independent of the database.
Disclosure of Invention
The invention provides a method and a device for scheduling and executing a timing task and a computer readable storage medium, and mainly aims to solve the problems of low dependency on a database and low scheduling efficiency.
In order to achieve the above object, the present invention provides a method for scheduling and executing a timing task, including:
receiving a timing task request, and generating a timing task corresponding to the timing task request based on a remote dictionary service;
storing parameters of the timing task in the remote dictionary service according to the timing task request;
Determining a target application service based on a preset monitor and a distributed lock;
And executing the timing task by using the target application service and the parameters.
Optionally, the generating, based on the remote dictionary service, a timing task corresponding to the timing task request includes:
combining the type in the timing task request and the universal unique identification code according to a preset format to generate a main key;
Determining an expiration time by a specific parameter in the timed task request;
a timed task corresponding to the primary key and the expiration time is generated in the remote dictionary service.
Optionally, the obtaining the expiration time by performing time calculation on the specific parameter in the timed task request includes:
acquiring timing task execution time from the specific parameters of the timing task request;
Acquiring the current time;
And calculating the time interval between the timing task execution time and the current time to obtain the expiration time.
Optionally, the storing the parameter of the timing task in the remote dictionary service according to the timing task request includes:
adding a preset suffix to generate a parameter main key after the main key of the timing task generates the parameter;
Acquiring specific parameters in the timing task request;
And writing the specific parameters into the remote dictionary service as values corresponding to the parameter primary keys.
Optionally, said performing said timing task with said target application service and said parameter comprises:
Splicing the main key of the timing task with a preset suffix to obtain a corresponding parameter main key;
Searching parameters of the timing task corresponding to the parameter primary key from the remote dictionary service;
and executing the timing task in the target application service by using the parameters.
Optionally, the determining the target application service based on the preset listener and the distributed lock includes:
judging whether the expiration time of the timing task arrives;
When the expiration time arrives, determining a plurality of application services receiving the message by using a preset monitor;
and determining the application service for acquiring the distributed lock from the plurality of application services according to a preset command to obtain a target application service.
Optionally, the determining, according to a preset command, to obtain the application service of the distributed lock from the plurality of application services, to obtain the target application service includes:
Executing the preset command in the application services according to the main key of the timing task to obtain a plurality of execution results;
and acquiring the application service which corresponds to the successful execution result in the execution results, and judging that the application service acquires the distributed lock to obtain the target application service.
In order to solve the above problems, the present invention also provides a timed task scheduling and executing device, the device comprising:
the task generation module is used for receiving a timing task request and generating a timing task corresponding to the timing task request based on a remote dictionary service;
A parameter storage module, configured to store parameters of the timing task in the remote dictionary service according to the timing task request;
The service determining module is used for determining target application service based on a preset monitor and a distributed lock;
and the task execution module is used for executing the timing task by utilizing the target application service and the parameters.
In order to solve the above-mentioned problems, the present invention also provides an electronic apparatus including:
A memory storing at least one instruction; and
And the processor executes the instructions stored in the memory to realize the timing task scheduling execution method.
In order to solve the above-mentioned problems, the present invention also provides a computer-readable storage medium having stored therein at least one instruction that is executed by a processor in an electronic device to implement the above-mentioned timed task schedule execution method.
According to the embodiment of the invention, a timing task request is received, a timing task corresponding to the timing task request is generated based on a remote dictionary service, and parameters of the timing task can be written into the content by utilizing the remote dictionary service, so that the dependence on a database is avoided; the target application service is determined based on the preset monitor and the distributed lock, the timed task can be quickly acquired through the monitor, meanwhile, the timed task can be scheduled by using the preset command as the distributed lock, the timed task is prevented from being repeatedly executed by a plurality of application services, and the task scheduling efficiency is improved; and executing the timing task by using the target application service, so that the execution of the timing task is ensured, and the working efficiency is improved. Therefore, the timing task scheduling execution method, the timing task scheduling execution device, the electronic equipment and the computer readable storage medium can solve the problems of low dependence on a database and low scheduling efficiency.
Drawings
FIG. 1 is a flow chart of a method for performing timing task scheduling according to an embodiment of the present invention;
FIG. 2 is a functional block diagram of a timing task scheduling and executing device according to an embodiment of the present invention;
fig. 3 is a schematic structural diagram of an electronic device for implementing the method for performing timing task scheduling according to an embodiment of the present invention.
The achievement of the objects, functional features and advantages of the present invention will be further described with reference to the accompanying drawings, in conjunction with the embodiments.
Detailed Description
It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the invention.
The embodiment of the application provides a timing task scheduling execution method. The execution body of the timing task scheduling execution method includes, but is not limited to, at least one of a server, a terminal and the like capable of being configured to execute the method provided by the embodiment of the application. In other words, the timed task schedule execution method may be executed by software or hardware installed in a terminal device or a server device, and the software may be a blockchain platform. The service end includes but is not limited to: a single server, a server cluster, a cloud server or a cloud server cluster, and the like.
Referring to fig. 1, a flow chart of a method for performing timing task scheduling according to an embodiment of the present invention is shown. In this embodiment, the method for scheduling and executing the timing task includes:
s1, receiving a timing task request, and generating a timing task corresponding to the timing task request based on a remote dictionary service.
In the embodiment of the invention, the timing task request is an HTTP protocol request sent by a client, and the timing task request comprises a type, a universal unique identification code (uuid) and specific parameters.
Further, the embodiment of the invention processes the timing task based on a remote dictionary service (Remote Dictionary Server, redis) to obtain the timing task corresponding to the timing task request. The redis is an open-source log-type Key-Value database which is written by ANSIC languages, supports a network, can be based on a memory and can be persistent, and provides APIs of multiple languages. The redis can directly store data in a memory instead of a database, and can avoid dependence on the database.
In detail, the generating the timing task corresponding to the timing task request based on the remote dictionary service includes:
combining the type in the timing task request and the universal unique identification code according to a preset format to generate a main key;
Obtaining expiration time by carrying out time calculation on specific parameters in the timing task request;
a timed task corresponding to the primary key and the expiration time is generated in the remote dictionary service.
The embodiment of the invention can generate a timing task corresponding to the timing task request in the remote dictionary service after receiving the timing task request.
For example, the type of the timed task request is tel, tel represents a phone reminding task, uuid is 998009e5bb1d291a16ec97b3ee8d870, the main key is the type plus uuid, namely tel_998009e5bb1d291a16ec97b3ee8d870, the value (value) corresponding to the main key can be set at will, the main key and the corresponding value are written into a remote dictionary service, and an expiration time is set according to a specific parameter in the timed task request, so that a timed task can be obtained, and after the expiration time arrives, the timed task can be deleted in the remote dictionary service.
To further ensure privacy and security of the timing tasks, the timing tasks may also be stored in nodes of a blockchain.
Further, the obtaining the expiration time by performing time calculation on the specific parameter in the timing task request includes:
acquiring timing task execution time from the specific parameters of the timing task request;
Acquiring the current time;
And calculating the time interval between the timing task execution time and the current time to obtain an expiration time, and setting the expiration time in the remote dictionary service.
For example, the timed task execution time is 2020-11-30:00 and the current time is 2020-11-30:17:00, and the expiration time is set to be the timed task execution time-current time, i.e., 3600 (in default seconds).
S2, storing parameters of the timing task in the remote dictionary service according to the timing task request.
In detail, the storing the parameters of the timing task in the remote dictionary service according to the timing task request includes:
adding a preset suffix to generate a parameter main key after the main key of the timing task generates the parameter;
Acquiring specific parameters in the timing task request;
And writing the specific parameters into the remote dictionary service together as values corresponding to the parameter primary keys.
Further, the parameter main key corresponds to the main key of the timing task, and the parameter main key can be generated by adding a preset suffix to the main key of the timing task, for example, if the main key of the timing task is tel_998009 bb1d291a16ec97b3ee8d870, the parameter main key is tel_998009e5bb1d2911 a16ec97b3 e8d870_params.
The specific parameters are specific parameters required for executing the timing task, for example, tel=123456 and content=three-afternoon meeting, that is, the timing task is specifically to make a call 123456 to remind, and the content is the three-afternoon meeting.
And S3, determining a target application service based on a preset monitor and a distributed lock.
Before determining the target application service based on the preset monitor and the distributed lock, the embodiment of the invention further comprises the following steps: and starting an expiration monitoring function in a plurality of preset application services.
Further, the function of starting the expiration monitoring is to start a monitoring event in each application service, after the expiration time of the timing task arrives, because the application service sets the monitoring event in advance, the monitor can capture the corresponding monitoring event and send a message to a plurality of application services, and the message includes a main key of the timing task corresponding to the expiration time.
In detail, the determining the target application service based on the preset listener and the distributed lock includes:
judging whether the expiration time of the timing task arrives;
When the expiration time arrives, determining a plurality of application services receiving the message by using a preset monitor;
and determining the application service for acquiring the distributed lock from the plurality of application services according to a preset command to obtain a target application service.
Further, the determining, according to the preset command, to obtain the application service of the distributed lock, to obtain the target application service includes:
Executing the preset command in the application services according to the main key of the timing task to obtain a plurality of execution results;
and acquiring the application service which corresponds to the successful execution result in the execution results, and judging that the application service acquires the distributed lock to obtain the target application service.
The preset command may be setnx commands, the setnx commands use a key (key) as a parameter, and only if the key does not exist, the value corresponding to the key is set, and the corresponding execution result is successful; when the primary key exists, no action is performed, and the corresponding execution result is failure. In the case where multiple application services execute setnx commands simultaneously, after one application service is successfully executed, all other application services fail to execute.
S4, executing the timing task by using the target application service and the parameters.
In detail, the performing the timing task using the target application service and the parameter includes:
Splicing the main key of the timing task with a preset suffix to obtain a corresponding parameter main key;
Searching parameters of the timing task corresponding to the parameter primary key from the remote dictionary service;
and executing the timing task in the target application service by using the parameters.
For example, after determining that the target application service is the outbound service platform, a corresponding parameter primary key can be obtained by adding a preset suffix to the primary key of the timing task. And obtaining a value corresponding to the parameter primary key from the remote dictionary service to obtain the specific parameter of the timing task, such as tel=123456 and content=three-afternoon meeting. The outbound service platform starts to execute a timing task, namely dials a telephone 123456 to remind, and the reminding content is a three-point afternoon meeting.
Optionally, if the timing task fails to execute, determining re-executing time according to the timing task; and regenerating the timing task according to the re-execution time, and re-executing the timing task.
In the embodiment of the invention, the parameters of the timing task are saved and can be used as the history record of the timing task for inquiry.
According to the embodiment of the invention, a timing task request is received, a timing task corresponding to the timing task request is generated based on a remote dictionary service, and parameters of the timing task can be written into the content by utilizing the remote dictionary service, so that the dependence on a database is avoided; the target application service is determined based on the preset monitor and the distributed lock, the timed task can be quickly acquired through the monitor, meanwhile, the timed task can be scheduled by using the preset command as the distributed lock, the timed task is prevented from being repeatedly executed by a plurality of application services, and the task scheduling efficiency is improved; and executing the timing task by using the target application service, so that the execution of the timing task is ensured, and the working efficiency is improved. Therefore, the timing task scheduling execution method, the timing task scheduling execution device, the electronic equipment and the computer readable storage medium can solve the problems of low dependence on a database and low scheduling efficiency.
Fig. 2 is a functional block diagram of a timed task scheduling and executing device according to an embodiment of the present invention.
The timed task schedule execution device 100 of the present invention may be installed in an electronic apparatus. The timed task schedule execution device 100 may include a task generation module 101, a parameter saving module 102, a service determination module 103, and a task execution module 104 according to the implemented functions. The module of the invention, which may also be referred to as a unit, refers to a series of computer program segments, which are stored in the memory of the electronic device, capable of being executed by the processor of the electronic device and of performing a fixed function.
In the present embodiment, the functions concerning the respective modules/units are as follows:
The task generating module 101 is configured to receive a timed task request, and generate a timed task corresponding to the timed task request based on a remote dictionary service.
In the embodiment of the invention, the timing task request is an HTTP protocol request sent by a client, and the timing task request comprises a type, a universal unique identification code (uuid) and specific parameters.
Further, the embodiment of the invention processes the timing task based on a remote dictionary service (Remote Dictionary Server, redis) to obtain the timing task corresponding to the timing task request. The redis is an open-source log-type Key-Value database which is written by ANSIC languages, supports a network, can be based on a memory and can be persistent, and provides APIs of multiple languages. The redis can directly store data in a memory instead of a database, and can avoid dependence on the database.
In detail, when generating a timed task corresponding to the timed task request based on a remote dictionary service, the task generation module 101 specifically performs the following operations:
combining the type in the timing task request and the universal unique identification code according to a preset format to generate a main key;
Obtaining expiration time by carrying out time calculation on specific parameters in the timing task request;
a timed task corresponding to the primary key and the expiration time is generated in the remote dictionary service.
The embodiment of the invention can generate a timing task corresponding to the timing task request in the remote dictionary service after receiving the timing task request.
For example, the type of the timed task request is tel, tel represents a phone reminding task, uuid is 998009e5bb1d291a16ec97b3ee8d870, the main key is the type plus uuid, namely tel_998009e5bb1d291a16ec97b3ee8d870, the value (value) corresponding to the main key can be set at will, the main key and the corresponding value are written into a remote dictionary service, and an expiration time is set according to a specific parameter in the timed task request, so that a timed task can be obtained, and after the expiration time arrives, the timed task can be deleted in the remote dictionary service.
To further ensure privacy and security of the timing tasks, the timing tasks may also be stored in nodes of a blockchain.
Further, the obtaining the expiration time by performing time calculation on the specific parameter in the timing task request includes:
acquiring timing task execution time from the specific parameters of the timing task request;
Acquiring the current time;
And calculating the time interval between the timing task execution time and the current time to obtain an expiration time, and setting the expiration time in the remote dictionary service.
For example, the timed task execution time is 2020-11-30:00 and the current time is 2020-11-30:17:00, and the expiration time is set to be the timed task execution time-current time, i.e., 3600 (in default seconds).
The parameter saving module 102 is configured to save parameters of the timed task in the remote dictionary service according to the timed task request.
In detail, the parameter saving module 102 is specifically configured to:
adding a preset suffix to generate a parameter main key after the main key of the timing task generates the parameter;
Acquiring specific parameters in the timing task request;
And writing the specific parameters into the remote dictionary service together as values corresponding to the parameter primary keys.
Further, the parameter main key corresponds to the main key of the timing task, and the parameter main key can be generated by adding a preset suffix to the main key of the timing task, for example, if the main key of the timing task is tel_998009 bb1d291a16ec97b3ee8d870, the parameter main key is tel_998009e5bb1d2911 a16ec97b3 e8d870_params.
The specific parameters are specific parameters required for executing the timing task, for example, tel=123456 and content=three-afternoon meeting, that is, the timing task is specifically to make a call 123456 to remind, and the content is the three-afternoon meeting.
The service determining module 103 is configured to determine a target application service based on a preset listener and a distributed lock.
Before determining the target application service based on the preset monitor and the distributed lock, the embodiment of the invention further comprises the following steps: and starting an expiration monitoring function in a plurality of preset application services.
Further, the function of starting the expiration monitoring is to start a monitoring event in each application service, after the expiration time of the timing task arrives, because the application service sets the monitoring event in advance, the monitor can capture the corresponding monitoring event and send a message to a plurality of application services, and the message includes a main key of the timing task corresponding to the expiration time.
In detail, the service determining module 103 is specifically configured to:
judging whether the expiration time of the timing task arrives;
When the expiration time arrives, determining a plurality of application services receiving the message by using a preset monitor;
and determining the application service for acquiring the distributed lock from the plurality of application services according to a preset command to obtain a target application service.
Further, the determining, according to the preset command, to obtain the application service of the distributed lock, to obtain the target application service includes:
Executing the preset command in the application services according to the main key of the timing task to obtain a plurality of execution results;
and acquiring the application service which corresponds to the successful execution result in the execution results, and judging that the application service acquires the distributed lock to obtain the target application service.
The preset command may be setnx commands, the setnx commands use a key (key) as a parameter, and only if the key does not exist, the value corresponding to the key is set, and the corresponding execution result is successful; when the primary key exists, no action is performed, and the corresponding execution result is failure. In the case where multiple application services execute setnx commands simultaneously, after one application service is successfully executed, all other application services fail to execute.
The task execution module 104 is configured to execute the timed task using the target application service and the parameter.
In detail, the task execution module 104 is specifically configured to:
Splicing the main key of the timing task with a preset suffix to obtain a corresponding parameter main key;
Searching parameters of the timing task corresponding to the parameter primary key from the remote dictionary service;
and executing the timing task in the target application service by using the parameters.
For example, after determining that the target application service is the outbound service platform, a corresponding parameter primary key can be obtained by adding a preset suffix to the primary key of the timing task. And obtaining a value corresponding to the parameter primary key from the remote dictionary service to obtain the specific parameter of the timing task, such as tel=123456 and content=three-afternoon meeting. The outbound service platform starts to execute a timing task, namely dials a telephone 123456 to remind, and the reminding content is a three-point afternoon meeting.
Optionally, if the timing task fails to execute, determining re-executing time according to the timing task; and regenerating the timing task according to the re-execution time, and re-executing the timing task.
In the embodiment of the invention, the parameters of the timing task are saved and can be used as the history record of the timing task for inquiry.
Fig. 3 is a schematic structural diagram of an electronic device for implementing a method for performing timed task scheduling according to an embodiment of the present invention.
The electronic device 1 may comprise a processor 10, a memory 11 and a bus, and may further comprise a computer program, such as a timed task schedule execution program 12, stored in the memory 11 and executable on the processor 10.
The memory 11 includes at least one type of readable storage medium, including flash memory, a mobile hard disk, a multimedia card, a card memory (e.g., SD or DX memory, etc.), a magnetic memory, a magnetic disk, an optical disk, etc. The memory 11 may in some embodiments be an internal storage unit of the electronic device 1, such as a removable hard disk of the electronic device 1. The memory 11 may in other embodiments also be an external storage device of the electronic device 1, such as a plug-in mobile hard disk, a smart memory card (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 1. Further, the memory 11 may also include both an internal storage unit and an external storage device of the electronic device 1. The memory 11 may be used not only for storing application software installed in the electronic device 1 and various types of data, such as codes of the timed task scheduling executor 12, but also for temporarily storing data that has been output or is to be output.
The processor 10 may be comprised of integrated circuits in some embodiments, for example, a single packaged integrated circuit, or may be comprised of multiple integrated circuits packaged with the same or different functions, including one or more central processing units (Central Processing unit, CPU), microprocessors, digital processing chips, graphics processors, combinations of various control chips, and the like. The processor 10 is a Control Unit (Control Unit) of the electronic device, connects respective components of the entire electronic device using various interfaces and lines, and executes various functions of the electronic device 1 and processes data by running or executing programs or modules (e.g., a timed task scheduling execution program, etc.) stored in the memory 11, and calling data stored in the memory 11.
The bus may be a peripheral component interconnect standard (PERIPHERAL COMPONENT INTERCONNECT, PCI) bus, or an extended industry standard architecture (extended industry standard architecture, EISA) bus, among others. The bus may be classified as an address bus, a data bus, a control bus, etc. The bus is arranged to enable a connection communication between the memory 11 and at least one processor 10 etc.
Fig. 3 shows only an electronic device with components, it being understood by a person skilled in the art that the structure shown in fig. 3 does not constitute a limitation of the electronic device 1, and may comprise fewer or more components than shown, or may combine certain components, or may be arranged in different components.
For example, although not shown, the electronic device 1 may further include a power source (such as a battery) for supplying power to each component, and preferably, the power source may be logically connected to the at least one processor 10 through a power management device, so that functions of charge management, discharge management, power consumption management, and the like are implemented through the power management device. The power supply may also include one or more of any of a direct current or alternating current power supply, recharging device, power failure detection circuit, power converter or inverter, power status indicator, etc. The electronic device 1 may further include various sensors, bluetooth modules, wi-Fi modules, etc., which will not be described herein.
Further, the electronic device 1 may also comprise a network interface, optionally the network interface may comprise a wired interface and/or a wireless interface (e.g. WI-FI interface, bluetooth interface, etc.), typically used for establishing a communication connection between the electronic device 1 and other electronic devices.
The electronic device 1 may optionally further comprise a user interface, which may be a Display, an input unit, such as a Keyboard (Keyboard), or a standard wired interface, a wireless interface. Alternatively, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode) touch, or the like. The display may also be referred to as a display screen or display unit, as appropriate, for displaying information processed in the electronic device 1 and for displaying a visual user interface.
It should be understood that the embodiments described are for illustrative purposes only and are not limited to this configuration in the scope of the patent application.
The timed task schedule execution program 12 stored in the memory 11 in the electronic device 1 is a combination of instructions that, when executed in the processor 10, may implement:
receiving a timing task request, and generating a timing task corresponding to the timing task request based on a remote dictionary service;
storing parameters of the timing task in the remote dictionary service according to the timing task request;
Determining a target application service based on a preset monitor and a distributed lock;
And executing the timing task by using the target application service and the parameters.
Specifically, the specific implementation method of the above instructions by the processor 10 may refer to descriptions of related steps in the corresponding embodiments of fig. 1 to 3, which are not repeated herein.
Further, the modules/units integrated in the electronic device 1 may be stored in a computer readable storage medium if implemented in the form of software functional units and sold or used as separate products. The computer readable storage medium may be volatile or nonvolatile. For example, 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).
The present invention also provides a computer readable storage medium storing a computer program which, when executed by a processor of an electronic device, can implement:
receiving a timing task request, and generating a timing task corresponding to the timing task request based on a remote dictionary service;
storing parameters of the timing task in the remote dictionary service according to the timing task request;
Determining a target application service based on a preset monitor and a distributed lock;
And executing the timing task by using the target application service and the parameters.
In the several embodiments provided in the present invention, it should be understood that the disclosed apparatus, device and method may be implemented in other manners. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the modules is merely a logical function division, and there may be other manners of division when actually implemented.
The modules described as separate components may or may not be physically separate, and components shown as modules may or may not be physical units, may be located in one place, or may be distributed over multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional module in the embodiments of the present invention 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 can be realized in a form of hardware or a form of hardware and a form of software functional modules.
It will be evident to those skilled in the art that the invention is not limited to the details of the foregoing illustrative embodiments, and that the present invention may be embodied in other specific forms without departing from the spirit or essential characteristics thereof.
The present embodiments are, therefore, to be considered in all respects as illustrative and not restrictive, the scope of the invention being indicated by the appended claims rather than by the foregoing description, and all changes which come within the meaning and range of equivalency of the claims are therefore intended to be embraced therein. Any reference signs in the claims shall not be construed as limiting the claim concerned.
The blockchain is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, consensus mechanism, encryption algorithm and the like. The blockchain (Blockchain), essentially a de-centralized database, is a string of data blocks that are generated in association using cryptographic methods, each of which contains information from a batch of network transactions for verifying the validity (anti-counterfeit) of its information and generating the next block. The blockchain may include a blockchain underlying platform, a platform product services layer, an application services layer, and the like.
Furthermore, it is evident that the word "comprising" does not exclude other elements or steps, and that the singular does not exclude a plurality. A plurality of units or means recited in the system claims can also be implemented by means of software or hardware by means of one unit or means. The terms second, etc. are used to denote a name, but not any particular order.
Finally, it should be noted that the above-mentioned embodiments are merely for illustrating the technical solution of the present invention and not for limiting the same, and although the present invention has been described in detail with reference to the preferred embodiments, it should be understood by those skilled in the art that modifications and equivalents may be made to the technical solution of the present invention without departing from the spirit and scope of the technical solution of the present invention.

Claims (8)

1. A method for scheduling execution of timed tasks, the method comprising:
receiving a timing task request, and generating a timing task corresponding to the timing task request based on a remote dictionary service;
storing parameters of the timing task in the remote dictionary service according to the timing task request;
Determining a target application service based on a preset monitor and a distributed lock;
Performing the timed task using the target application service and the parameter;
Wherein the generating a timing task corresponding to the timing task request based on the remote dictionary service includes: combining the type in the timing task request and the universal unique identification code according to a preset format to generate a main key; obtaining expiration time by carrying out time calculation on specific parameters in the timing task request; generating a timing task corresponding to the primary key and the expiration time in the remote dictionary service;
the storing, in the remote dictionary service, parameters of the timed task according to the timed task request includes: adding a preset suffix to generate a parameter main key after the main key of the timing task generates the parameter; acquiring specific parameters in the timing task request; and writing the specific parameters into the remote dictionary service as values corresponding to the parameter primary keys.
2. The method for scheduling and executing a timed task according to claim 1, wherein the obtaining the expiration time by performing time calculation on the specific parameter in the timed task request comprises:
acquiring timing task execution time from the specific parameters of the timing task request;
Acquiring the current time;
And calculating the time interval between the timing task execution time and the current time to obtain the expiration time.
3. The timed task scheduling and execution method of claim 1, wherein said executing said timed task with said target application service and said parameters comprises:
Splicing the main key of the timing task with a preset suffix to obtain a corresponding parameter main key;
Searching parameters of the timing task corresponding to the parameter primary key from the remote dictionary service;
and executing the timing task in the target application service by using the parameters.
4. The timed task schedule execution method of claim 1, wherein the target application service is determined based on a preset listener and a distributed lock, comprising:
judging whether the expiration time of the timing task arrives;
When the expiration time arrives, determining a plurality of application services receiving the message by using a preset monitor;
and determining the application service for acquiring the distributed lock from the plurality of application services according to a preset command to obtain a target application service.
5. The method for performing timed task scheduling according to claim 4, wherein determining, according to a preset command, an application service for acquiring a distributed lock from the plurality of application services, and obtaining a target application service, includes:
Executing the preset command in the application services according to the main key of the timing task to obtain a plurality of execution results;
and acquiring the application service which corresponds to the successful execution result in the execution results, and judging that the application service acquires the distributed lock to obtain the target application service.
6. A timed task scheduling execution device for implementing the timed task scheduling execution method according to any one of claims 1 to 5, characterized in that the device comprises:
the task generation module is used for receiving a timing task request and generating a timing task corresponding to the timing task request based on a remote dictionary service;
A parameter storage module, configured to store parameters of the timing task in the remote dictionary service according to the timing task request;
The service determining module is used for determining target application service based on a preset monitor and a distributed lock;
and the task execution module is used for executing the timing task by utilizing the target application service and the parameters.
7. An electronic device, the electronic device comprising:
At least one processor; and
A memory communicatively coupled to the at least one processor; wherein,
The memory stores instructions executable by the at least one processor to enable the at least one processor to perform the timed task schedule execution method of any one of claims 1 to 5.
8. A computer readable storage medium storing a computer program, wherein the computer program when executed by a processor implements the timed task scheduling execution method of any one of claims 1 to 5.
CN202110083321.2A 2021-01-21 2021-01-21 Scheduled task scheduling execution method, device, electronic device and storage medium Active CN112860394B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110083321.2A CN112860394B (en) 2021-01-21 2021-01-21 Scheduled task scheduling execution method, device, electronic device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110083321.2A CN112860394B (en) 2021-01-21 2021-01-21 Scheduled task scheduling execution method, device, electronic device and storage medium

Publications (2)

Publication Number Publication Date
CN112860394A CN112860394A (en) 2021-05-28
CN112860394B true CN112860394B (en) 2024-11-22

Family

ID=76008897

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110083321.2A Active CN112860394B (en) 2021-01-21 2021-01-21 Scheduled task scheduling execution method, device, electronic device and storage medium

Country Status (1)

Country Link
CN (1) CN112860394B (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110532083A (en) * 2019-09-04 2019-12-03 深圳市思迪信息技术股份有限公司 Timed task dispatching method and device
CN111400330A (en) * 2020-03-13 2020-07-10 深圳前海微众银行股份有限公司 Task processing method, apparatus, device, and computer-readable storage medium

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110569113A (en) * 2018-06-06 2019-12-13 海通证券股份有限公司 Method and system for scheduling distributed tasks and computer readable storage medium
CN110018893B (en) * 2019-03-12 2024-08-16 河北和熙网络科技有限公司 Task scheduling method based on data processing and related equipment

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110532083A (en) * 2019-09-04 2019-12-03 深圳市思迪信息技术股份有限公司 Timed task dispatching method and device
CN111400330A (en) * 2020-03-13 2020-07-10 深圳前海微众银行股份有限公司 Task processing method, apparatus, device, and computer-readable storage medium

Also Published As

Publication number Publication date
CN112860394A (en) 2021-05-28

Similar Documents

Publication Publication Date Title
CN111835467B (en) Message sending method, device, computer equipment and storage medium
CN111787171B (en) Automatic outbound method, device, electronic equipment and computer readable storage medium
US8260321B1 (en) Systems and methods for event attendance notification
CN112015815B (en) Data synchronization method, device and computer readable storage medium
CN111429121B (en) Block chain-based electronic ticket processing method, device, equipment and storage medium
CN113259429B (en) Session maintenance management and control method, device, computer equipment and medium
CN114722437A (en) Cross-APP unique identifier generation method, device, equipment and storage medium
CN114399397A (en) Renewal tracking method, device, equipment and medium
CN112256783A (en) Data export method and device, electronic equipment and storage medium
CN109669867B (en) Test apparatus, automated test method, and computer-readable storage medium
CN113485742B (en) Host application version registration method and device
CN112667244B (en) Data verification method, device, electronic equipment and computer readable storage medium
CN112860394B (en) Scheduled task scheduling execution method, device, electronic device and storage medium
CN112540839B (en) Information changing method, device, electronic equipment and storage medium
CN114827354A (en) Identity authentication information display method and device, electronic equipment and readable storage medium
CN112686759B (en) Account reconciliation monitoring method, device, equipment and medium
CN111552581B (en) Event delivery method, device, system and electronic equipment
CN113867145A (en) An application control method, device, electronic device and storage medium
WO2019062020A1 (en) Asynchronous task unified processing method and apparatus, and storage medium
CN112328602A (en) Method, device and equipment for writing data into Kafka
CN115147031B (en) Clearing workflow execution method, device, equipment and medium
CN112532721B (en) Cluster calling method and device, electronic equipment and storage medium
CN114723400B (en) Service authorization management method, device, equipment and storage medium
CN116450176A (en) Version updating method and device, electronic equipment and storage medium
CN112637280B (en) Data transmission method, device, electronic equipment and storage medium

Legal Events

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