CN107515883B - Method and equipment for running task - Google Patents

Method and equipment for running task Download PDF

Info

Publication number
CN107515883B
CN107515883B CN201610439675.5A CN201610439675A CN107515883B CN 107515883 B CN107515883 B CN 107515883B CN 201610439675 A CN201610439675 A CN 201610439675A CN 107515883 B CN107515883 B CN 107515883B
Authority
CN
China
Prior art keywords
configuration
task
snapshot
configuration parameters
parameters corresponding
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
CN201610439675.5A
Other languages
Chinese (zh)
Other versions
CN107515883A (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.)
Alibaba Singapore Holdings Pte Ltd
Original Assignee
Alibaba Group Holding 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 Alibaba Group Holding Ltd filed Critical Alibaba Group Holding Ltd
Priority to CN201610439675.5A priority Critical patent/CN107515883B/en
Publication of CN107515883A publication Critical patent/CN107515883A/en
Application granted granted Critical
Publication of CN107515883B publication Critical patent/CN107515883B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/958Organisation or management of web site content, e.g. publishing, maintaining pages or automatic linking

Landscapes

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

Abstract

The embodiment of the application relates to the technical field of computers, in particular to a method and equipment for running a task, which are used for solving the problem that in the prior art, configuration parameters corresponding to the task can only be modified after the task stops running. According to the method and the device, the configuration snapshot is generated according to the configuration parameters, and the task is operated according to the configuration snapshot when the task is operated, so that the configuration parameters can be modified at any time without influencing the task which is in operation, a manual monitoring task which is performed because the configuration parameters are modified is not needed, and the cost for modifying the configuration parameters is reduced.

Description

Method and equipment for running task
Technical Field
The present application relates to the field of computer technologies, and in particular, to a method and an apparatus for executing a task.
Background
There are many types of tasks in a web site system, such as: a task for notifying the user of website operation rule change items; tasks for recommending information recently published by the website to the user, and the like.
Generally, when a certain task is executed, configuration parameters corresponding to the task are loaded, so that the task is executed. When a task is running, data or logic confusion can arise if the configuration parameters used are modified.
However, in daily operation, there are many requirements for modifying task configuration, such as changing notification channels, and then configuration parameters corresponding to tasks need to be modified.
Currently, after a task is run, modifications to configuration parameters need to be frozen in order to avoid causing data or logic confusion. Therefore, the current method for adjusting the configuration parameters corresponding to the task is as follows: and after the task stops running, modifying the configuration parameters corresponding to the task.
The configuration parameters are modified at any time, but the modification mode can only monitor the task manually, and modify the configuration parameters corresponding to the task after the task stops running, if the task is started for a long time, the manual monitoring needs to be carried out for a long time, and the cost for modifying the configuration parameters is increased.
In summary, at present, the configuration parameters corresponding to the task can only be modified after the task stops running.
Disclosure of Invention
The application provides a method and equipment for running a task, which are used for solving the problem that in the prior art, configuration parameters corresponding to the task can only be modified after the task stops running.
The method for running the task provided by the embodiment of the application comprises the following steps:
determining a configuration snapshot generated by configuration parameters corresponding to the task;
and running the task according to the configuration snapshot.
According to the method and the device, the configuration snapshot is generated according to the configuration parameters, and the task is operated according to the configuration snapshot when the task is operated, so that the configuration parameters can be modified at any time without influencing the task which is in operation, a manual monitoring task which is performed because the configuration parameters are modified is not needed, and the cost for modifying the configuration parameters is reduced.
Optionally, before determining the configuration snapshot generated by the configuration parameters corresponding to the task, the method further includes:
generating a configuration snapshot according to configuration parameters corresponding to the tasks in a database, and storing the configuration snapshot;
the determining the configuration snapshot generated by the configuration parameters corresponding to the task includes:
and determining the configuration snapshot generated by the configuration parameters corresponding to the task from all the stored configuration snapshots.
Optionally, the storing the configuration snapshot includes:
and storing the configuration snapshot into a part or all of a disk cache, a memory cache and a memory of the task host.
The configuration snapshots are stored in different places, and the different places have different data storage characteristics, so that the requirements of different scenes can be met.
Optionally, the configuration snapshot is stored in the memory of the disk cache, the memory cache, and the task host;
the determining, from all the stored configuration snapshots, a configuration snapshot generated by the configuration parameters corresponding to the task includes:
determining a configuration snapshot generated by configuration parameters corresponding to the task from all configuration snapshots stored in a memory of the task host;
if the configuration snapshot cannot be determined from the memory of the task host machine, determining the configuration snapshot generated by the configuration parameters corresponding to the task from the memory cache;
and if the configuration snapshot cannot be determined from the memory cache, determining the configuration snapshot generated by the configuration parameters corresponding to the task from the disk cache.
Optionally, after determining the configuration snapshot generated by the configuration parameter corresponding to the task from all the stored configuration snapshots, the method further includes:
if the configuration snapshot generated by the configuration parameters corresponding to the task is determined from the memory cache, storing the configuration snapshot determined from the memory cache into the memory of the task host; or
And if the configuration snapshot generated by the configuration parameters corresponding to the task is determined from the disk cache, respectively storing the configuration snapshot determined from the disk cache into the memory cache and the memory of the task host.
Optionally, the determining, from all the stored configuration snapshots, a configuration snapshot generated by the configuration parameters corresponding to the task includes:
selecting all configuration snapshots corresponding to the task identifier from all stored configuration snapshots;
and selecting the configuration snapshot with the corresponding task starting time matched with the current time from all the selected configuration snapshots.
Optionally, the method further includes:
and in the task running process, when the configuration parameters corresponding to the task need to be modified, modifying the configuration parameters corresponding to the task.
Optionally, after determining the configuration snapshot generated by the configuration parameters corresponding to the task, before running the task according to the configuration snapshot, the method further includes:
determining that the configuration parameters in the configuration snapshot are complete.
An apparatus for running a task provided in an embodiment of the present application includes:
the configuration determining module is used for determining a configuration snapshot generated by the configuration parameters corresponding to the task;
and the operation module is used for operating the task according to the configuration snapshot.
Optionally, the apparatus further comprises:
the configuration generation module is used for generating a configuration snapshot according to the configuration parameters corresponding to the tasks in the database and storing the configuration snapshot;
the configuration determining module is specifically configured to:
and determining the configuration snapshot generated by the configuration parameters corresponding to the task from all the stored configuration snapshots.
Optionally, the configuration generating module is specifically configured to:
and storing the configuration snapshot into a part or all of a disk cache, a memory cache and a memory of the task host.
Optionally, the configuration snapshot is stored in the memory of the disk cache, the memory cache, and the task host;
the configuration determining module is specifically configured to:
determining a configuration snapshot generated by configuration parameters corresponding to the task from all configuration snapshots stored in a memory of the task host;
if the configuration snapshot cannot be determined from the memory of the task host machine, determining the configuration snapshot generated by the configuration parameters corresponding to the task from the memory cache;
and if the configuration snapshot cannot be determined from the memory cache, determining the configuration snapshot generated by the configuration parameters corresponding to the task from the disk cache.
Optionally, the configuration determining module is further configured to:
if the configuration snapshot generated by the configuration parameters corresponding to the task is determined from the memory cache, storing the configuration snapshot determined from the memory cache into the memory of the task host; or
And if the configuration snapshot generated by the configuration parameters corresponding to the task is determined from the disk cache, respectively storing the configuration snapshot determined from the disk cache into the memory cache and the memory of the task host.
Optionally, the configuration determining module is specifically configured to:
selecting all configuration snapshots corresponding to the task identifier from all stored configuration snapshots;
and selecting the configuration snapshot with the corresponding task starting time matched with the current time from all the selected configuration snapshots.
Optionally, the configuration determining module is further configured to:
and in the task running process, when the configuration parameters corresponding to the task need to be modified, modifying the configuration parameters corresponding to the task.
Optionally, the operation module is further specifically configured to:
and running the task after determining that the configuration parameters in the configuration snapshot are complete.
According to the method and the device, the configuration snapshot is generated for the configuration parameters, and the task is operated according to the configuration snapshot when the task is operated, so that the configuration parameters can be modified at any time without influencing the task which is in operation, a manual monitoring task which is performed for modifying the configuration parameters is not needed, and the cost for modifying the configuration parameters is reduced.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without inventive exercise.
FIG. 1 is a schematic flow chart illustrating a method for executing tasks according to an embodiment of the present disclosure;
FIG. 2 is a diagram illustrating a relationship between a storage location and a configuration snapshot according to an embodiment of the present application;
FIG. 3 is a flowchart illustrating a complete method for executing tasks according to an embodiment of the present application;
FIG. 4 is a schematic structural diagram of an apparatus for executing tasks according to an embodiment of the present application;
fig. 5 is a schematic diagram of a complete structure of a device for executing a task according to an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application clearer, the present application will be described in further detail with reference to the accompanying drawings, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
As shown in fig. 1, a method for running a task according to an embodiment of the present application includes:
step 100, starting a task;
step 101, determining a configuration snapshot generated by configuration parameters corresponding to the task;
and 102, running the task according to the configuration snapshot.
The configuration snapshot of the embodiment of the present application is similar to a commodity order snapshot of online shopping (the commodity order snapshot stores the price of the currently purchased commodity, the shipping address, and the like), and is a logical description, and this logical description can be converted into an imaging expression.
The configuration snapshot of the embodiment of the application comprises relevant information of a corresponding task, such as whether a configured channel is an email or an App end; whether a message or a short message needs to be sent; if the content is required to be sent by the mail, which content template is used and which pattern variable is adopted; if the short message is sent, which service number is used; if the data is sent by the App end, the version of the App is used, and the version of the App is an Android operating system or iOS. Task start-up times, users configuring tasks, etc. may also be included.
The embodiment of the application checks whether the set starting condition is met, such as whether a starting signal of the external device is received or not, whether the starting time is up or not, and the like. If the set start-up is met, it is determined that the task is started, i.e. the start-up of the task in step 100 is actually determined that the set start-up conditions are met.
In an implementation, the configuration snapshot may be a configuration snapshot page. For example, a common page has a table in the page, and each table entry records different information of the configuration snapshot, such as 1.1 version of App, configured iOS and Android, and related filing variable values.
The task of the embodiment of the present application may be a task of sending a notification, for example, sending a notification through an APP (application) installed by a user; or may be a task within the device, such as the main processor assigning processing tasks to other processors, etc.
Optionally, the configuration parameters of the embodiment of the present application include, but are not limited to, some or all of the following:
transmission frequency, transmission content, transmission method, and transmission target.
The meaning of different task configuration parameters also differs. Taking the task of sending the notification as an example:
the sending frequency is the interval time for sending the notification, for example, if the sending is performed once in 3 hours, the sending is performed once in each 3 cells;
the sending content is specific notification content, for example, if commodity information needs to be sent to the user, the specific content of the commodity is the notification content;
the sending mode is a notification channel, namely, which form of notification is adopted, such as notification by mail, notification by short message, notification by application, and the like;
the sending object is a notification to which users, such as notifying users of merchandise information, may notify users who have purchased the merchandise and/or the like.
According to the method and the device, the configuration snapshot is generated according to the configuration parameters, and the task is operated according to the configuration snapshot when the task is operated, so that the configuration parameters can be modified at any time without influencing the task which is in operation, a manual monitoring task which is performed because the configuration parameters are modified is not needed, and the cost for modifying the configuration parameters is reduced.
Taking task a as an example, when task a needs to be run, a configuration snapshot is generated according to configuration parameters of current task a, and task a can be run according to the configuration snapshot corresponding to task a.
And if the configuration parameters of the task A need to be modified, directly modifying, when the task A needs to be operated, generating a new configuration snapshot according to the modified configuration parameters, and operating the task A according to the new configuration snapshot.
Of course, when the configuration parameters of task a are modified once, a new configuration snapshot may be generated according to the modified configuration parameters, but since the configuration parameters may need to be modified at any time, if the configuration parameters are modified after the configuration snapshot is generated, the configuration snapshot still needs to be generated continuously, so that when task a needs to be run, a new configuration snapshot is generated according to the modified configuration parameters, thereby saving the frequency of generating the configuration snapshot and improving the efficiency.
When a new configuration snapshot is generated and stored, the previous configuration snapshot can be replaced; the previous configuration snapshot may also be retained, as described separately below.
Mode one, the previous configuration snapshot is retained.
For scenarios where the method is applicable to a previously used configuration snapshot, the method is also used in other processes, such as scenarios where manual verification of the used configuration snapshot is required.
When the configuration snapshot is stored in the first mode, the identification of the task corresponding to the configuration snapshot and the task starting time of the configuration snapshot need to be recorded.
Namely, the binding relationship among the task identifier, the task starting time and the configuration snapshot is established.
When the configuration snapshots corresponding to the tasks need to be searched, all the configuration snapshots corresponding to the task identifiers are selected from all the stored configuration snapshots;
and selecting the configuration snapshot with the corresponding task starting time matched with the current time from all the selected configuration snapshots.
For example, the identifier corresponding to the task a is 123, all configuration snapshots corresponding to the identifier 123 are selected from all configuration snapshots.
Due to different task starting times, one identifier may correspond to a plurality of configuration snapshots.
And then finding the configuration snapshot matched with the current time according to the task starting time of each selected configuration snapshot.
For example, the task start time of the selected configuration snapshot is 2016, 5, 3, 7, 30 points, and 2016, 5, month, 4, 8 points.
The current time is 7 o ' clock and 58 o ' clock in 5 month and 4 days in 2016, and the latest task starting time is 2016 in 5 month and 4 days in 5 month and 8 o ' clock.
And a second mode is to replace the previous configuration snapshot.
In the method, the identifier of each task corresponds to one configuration snapshot, so that for the second method, the identifier of the task corresponding to the configuration snapshot needs to be recorded when the configuration snapshot is stored.
I.e. a binding relationship between the task identity and the configuration snapshot is established.
And when the configuration snapshot corresponding to the task needs to be searched, selecting the configuration snapshot corresponding to the task identifier from all the stored configuration snapshots.
For example, the identifier corresponding to the task a is 123, all configuration snapshots corresponding to the identifier 123 are selected from all configuration snapshots.
Because the task is realized by running the task snapshot during running, when the configuration parameters corresponding to the task need to be modified during running of the task, modifying the configuration parameters corresponding to the task does not affect the running task.
The embodiment of the application can store the configuration parameters corresponding to the started task in a database, such as a MySQL database. Configuration parameters in the database may be modified directly when modification is required. And when the configuration snapshot needs to be generated, generating the configuration snapshot according to the configuration parameters corresponding to the tasks in the database, and storing the configuration snapshot. When determining the configuration snapshot generated by the configuration parameters corresponding to the task, determining the configuration snapshot generated by the configuration parameters corresponding to the task from all the stored configuration snapshots
Optionally, a configuration snapshot is generated according to configuration parameters corresponding to the tasks in the database, and the configuration snapshot is stored;
and when the task needs to be run, determining the configuration snapshot generated by the configuration parameters corresponding to the task from all the stored configuration snapshots.
Optionally, the embodiment of the present application may store the configuration snapshot in part or all of the following locations:
disk caches such as Tair-Ldb (persistent disk cache);
memory caches, such as Tair-Mdb (read-write efficient and non-persistent disk cache);
memory of the task host, such as LRU (Least Recently Used, Least Recently Used algorithmically allocated host memory).
The disk cache in the embodiment of the present application may be a disk cache provided by an individual server cluster, and the server cluster is accessed through a network, for example, Tair-Ldb may be an individual server cluster;
the memory cache in the embodiment of the application may be a memory cache provided by an individual server cluster, and the server cluster is accessed through a network, for example, Tair-Mdb may be an individual server cluster;
the task of the embodiment of the application runs on the task host machine, and the task host machine can be a server.
The three positions have respective characteristics:
the disk cache is characterized in that data is stored persistently but the data reading speed is not fast;
the memory cache is characterized in that the memory efficiently reads data but loses the data when power is down;
the memory of the task host is a single-machine memory object database, and compared with the disk cache, the single-machine memory has less network overhead for reading data, so the reading efficiency is higher, but compared with the disk cache, the single-machine memory has limited capacity;
in practice, therefore, the selection of which location or locations to store the configuration snapshot can be made according to application scenarios, requirements, and the like. For example, if Tair-Ldb and Tair-Mdb are used simultaneously, the characteristics of no data loss and efficient data reading are considered.
It should be noted that the three locations are only examples, and other locations capable of storing the configuration snapshot are applicable to the embodiment of the present application.
Assuming that the configuration snapshots are required to be stored in all three positions, the generated configuration snapshots can be stored in the disk cache, the configuration snapshots in the disk cache are stored in the memory cache, and finally the configuration snapshots in the memory cache are stored in the memory of the task host.
If the configuration snapshot is stored in the disk cache, the memory cache, and the memory of the task host, an optional reading sequence is as follows:
determining a configuration snapshot generated by configuration parameters corresponding to the task from all configuration snapshots stored in a memory of the task host;
if the configuration snapshot cannot be determined from the memory of the task host machine, determining the configuration snapshot generated by the configuration parameters corresponding to the task from the memory cache;
and if the configuration snapshot cannot be determined from the memory cache, determining the configuration snapshot generated by the configuration parameters corresponding to the task from the disk cache.
The above reading sequence is only one possible way, and other reading sequences are also applicable to the embodiment of the present application.
For example, fig. 2 is a read sequence. In fig. 2, the operator adds and/or modifies configuration parameters in the background and stores the configuration parameters in the database. When the operator adds and/or modifies the task configuration, the operator only reads and writes the database and does not operate the disk cache data.
When a task is started, inquiring configuration parameters of the current task from a database, serializing the configuration parameter objects by using Java language to obtain configuration snapshots, and storing the configuration snapshots in a disk cache; and loading the configuration snapshot in the disk cache into a memory cache, and then loading the configuration snapshot in the memory cache into a memory of the task host. And when the task runs, the task is run through the configuration snapshot in the memory of the task host machine.
If the configuration snapshot is stored in the disk cache, the memory cache and the memory of the task host, the configuration snapshot can be stored again because the configuration snapshot at some positions is lost due to some reasons, such as failure, power failure and the like.
Optionally, if the configuration snapshots are stored in the disk cache, the memory cache, and the memory of the task host, and the reading sequence is the sequence of the above example, after determining the configuration snapshot generated by the configuration parameters corresponding to the task from all the stored configuration snapshots:
if the configuration snapshot generated by the configuration parameters corresponding to the task is determined from the memory cache, storing the configuration snapshot determined from the memory cache into the memory of the task host; or
And if the configuration snapshot generated by the configuration parameters corresponding to the task is determined from the disk cache, respectively storing the configuration snapshot determined from the disk cache into the memory cache and the memory of the task host.
It should be noted that, the different reading order and the order of storing again after being lost may be the same or different. For example, the reading sequence is disk cache, memory cache and the memory of a task host machine; the order of the re-storage can be the memory of the task host machine, the memory cache and the disk cache; other sequences are also possible.
Since the generated configuration snapshot may have errors, after the configuration snapshot generated by the configuration parameters corresponding to the task is determined, the generated configuration snapshot may be verified before the task is run according to the configuration snapshot, and the task is run according to the configuration snapshot after the verification is determined to be passed.
The time of verification may be before the configuration snapshot is generated and not stored; or stored first and verified between running tasks.
The verification content can be that whether the configuration parameters in the configuration snapshot are complete or not is verified, and if the configuration parameters are complete, the verification is determined to be passed; otherwise, the verification is determined to fail.
As shown in fig. 3, the complete method for running tasks according to the embodiment of the present application includes:
step 300, starting a task;
step 301, querying the configuration parameters of the started task from the database.
Step 302, generating a configuration snapshot according to the inquired configuration parameters.
Step 303, saving the generated configuration snapshot in a disk cache, loading the configuration snapshot in the disk cache into a memory cache, and loading the configuration snapshot in the memory cache into a memory of the task host.
Step 304, judging whether a configuration snapshot corresponding to the started task can be searched from the memory of the task host; if so, go to step 307; otherwise, step 305 is performed.
Step 305, judging whether a configuration snapshot corresponding to the started task can be searched from the memory cache; if so, go to step 307; otherwise, step 306 is performed.
Step 306, judging whether a configuration snapshot corresponding to the started task can be searched from the disk cache; if so, go to step 307; otherwise, stopping running the task.
And 307, running the task according to the searched configuration snapshot.
Based on the same inventive concept, the embodiment of the present application further provides a base station side device, a user equipment, and a long term evolution multi-carrier upgrade system in the long term evolution multi-carrier upgrade system, and because the principle of solving the problem of these devices is similar to the method for dynamically allocating the reserved resource of the uplink control channel in the long term evolution multi-carrier upgrade system, the implementation of these devices can refer to the implementation of the method, and the repeated parts are not described again.
As shown in fig. 4, an apparatus for executing a task according to an embodiment of the present application includes:
a task starting module 400 for starting a task;
a configuration determining module 401, configured to determine a configuration snapshot generated by the configuration parameters corresponding to the task;
an operation module 402, configured to operate the task according to the configuration snapshot.
The task of the embodiment of the present application may be a task of sending a notification, for example, sending a notification through an APP (application) installed by a user; or may be a task within the device, such as the main processor assigning processing tasks to other processors, etc.
Optionally, the configuration parameters of the embodiment of the present application include, but are not limited to, some or all of the following:
transmission frequency, transmission content, transmission method, and transmission target.
The meaning of different task configuration parameters also differs. Taking the task of sending the notification as an example:
the sending frequency is the interval time for sending the notification, for example, if the sending is performed once in 3 hours, the sending is performed once in each 3 cells;
the sending content is specific notification content, for example, if commodity information needs to be sent to the user, the specific content of the commodity is the notification content;
the sending mode is a notification channel, namely, which form of notification is adopted, such as notification by mail, notification by short message, notification by application, and the like;
the sending object is a notification to which users, such as notifying users of merchandise information, may notify users who have purchased the merchandise and/or the like.
According to the method and the device, the configuration snapshot is generated according to the configuration parameters, and the task is operated according to the configuration snapshot when the task is operated, so that the configuration parameters can be modified at any time without influencing the task which is in operation, a manual monitoring task which is performed because the configuration parameters are modified is not needed, and the cost for modifying the configuration parameters is reduced.
Taking task a as an example, when task a needs to be run, a configuration snapshot is generated according to configuration parameters of current task a, and task a can be run according to the configuration snapshot corresponding to task a.
And if the configuration parameters of the task A need to be modified, directly modifying, when the task A needs to be operated, generating a new configuration snapshot according to the modified configuration parameters, and operating the task A according to the new configuration snapshot.
Of course, when the configuration parameters of task a are modified once, a new configuration snapshot may be generated according to the modified configuration parameters, but since the configuration parameters may need to be modified at any time, if the configuration parameters are modified after the configuration snapshot is generated, the configuration snapshot still needs to be generated continuously, so that when task a needs to be run, a new configuration snapshot is generated according to the modified configuration parameters, thereby saving the frequency of generating the configuration snapshot and improving the efficiency.
The apparatus of the embodiment of the present application further includes a configuration generating module 403, as shown in fig. 5.
The configuration generating module 403 is configured to generate and store a configuration snapshot, and when the configuration snapshot is stored, the previous configuration snapshot may be replaced; the previous configuration snapshot may also be retained, as described separately below.
Mode one, the previous configuration snapshot is retained.
For scenarios where the method is applicable to a previously used configuration snapshot, the method is also used in other processes, such as scenarios where manual verification of the used configuration snapshot is required.
For the first-mode configuration generating module 403, when storing the configuration snapshot, it needs to record the identifier of the task corresponding to the configuration snapshot and the task start time of the configuration snapshot.
Namely, the binding relationship among the task identifier, the task starting time and the configuration snapshot is established.
When a configuration snapshot corresponding to a task needs to be searched, the configuration determining module 401 selects all configuration snapshots corresponding to the identifier of the task from all stored configuration snapshots;
and selecting the configuration snapshot with the corresponding task starting time matched with the current time from all the selected configuration snapshots.
For example, the identifier corresponding to the task a is 123, all configuration snapshots corresponding to the identifier 123 are selected from all configuration snapshots.
Due to different task starting times, one identifier may correspond to a plurality of configuration snapshots.
And then finding the configuration snapshot matched with the current time according to the task starting time of each selected configuration snapshot.
For example, the task start time of the selected configuration snapshot is 2016, 5, 3, 7, 30 points, and 2016, 5, month, 4, 8 points.
The current time is 7 o ' clock and 58 o ' clock in 5 month and 4 days in 2016, and the latest task starting time is 2016 in 5 month and 4 days in 5 month and 8 o ' clock.
And a second mode is to replace the previous configuration snapshot.
In this way, the identifier of each task corresponds to one configuration snapshot, so that when the configuration snapshot is stored, the identifier of the task corresponding to the configuration snapshot needs to be recorded for the mode two configuration generation module 403.
I.e. a binding relationship between the task identity and the configuration snapshot is established.
When the configuration snapshot corresponding to the task needs to be searched, the configuration determining module 401 selects the configuration snapshot corresponding to the identifier of the task from all the stored configuration snapshots.
For example, the identifier corresponding to the task a is 123, all configuration snapshots corresponding to the identifier 123 are selected from all configuration snapshots.
Because the task is realized by running the task snapshot during running, when the configuration parameters corresponding to the task need to be modified during running of the task, modifying the configuration parameters corresponding to the task does not affect the running task.
The embodiment of the application can store the configuration parameters corresponding to the started task in a database, such as a MySQL database.
When determining that the user needs to modify the configuration parameters corresponding to the task, the configuration determining module 401 modifies the configuration parameters corresponding to the task according to the configuration parameters input by the user.
When the configuration snapshot needs to be generated, the configuration generation module 403 generates the configuration snapshot according to the configuration parameters corresponding to the tasks started in the database, and stores the configuration snapshot.
When determining the configuration snapshot generated by the configuration parameter corresponding to the task, the configuration determining module 401 determines the configuration snapshot generated by the configuration parameter corresponding to the task from all the stored configuration snapshots.
Optionally, the configuration generating module 403 according to this embodiment of the present application may store the configuration snapshot in part or all of the following locations:
a persistent disk cache, such as Tair-Ldb;
efficient read-write and non-persistent disk caches, such as Tair-Mdb;
memory of the task host, such as LRU.
The three positions have respective characteristics:
the disk cache is characterized in that data is stored persistently but the data reading speed is not fast;
the memory cache is characterized in that the memory efficiently reads data but loses the data when power is down;
the memory of the task host is a single-machine memory object database, and compared with the disk cache, the single-machine memory has less network overhead for reading data, so the reading efficiency is higher, but compared with the disk cache, the single-machine memory has limited capacity;
in practice, therefore, the selection of which location or locations to store the configuration snapshot can be made according to application scenarios, requirements, and the like. For example, if Tair-Ldb and Tair-Mdb are used simultaneously, the characteristics of no data loss and efficient data reading are considered.
It should be noted that the three locations are only examples, and other locations capable of storing the configuration snapshot are applicable to the embodiment of the present application.
Assuming that the configuration snapshots are required to be stored in all three positions, the generated configuration snapshots can be stored in the disk cache, the configuration snapshots in the disk cache are stored in the memory cache, and finally the configuration snapshots in the memory cache are stored in the memory of the task host.
If the configuration snapshot is stored in the disk cache, the memory cache, and the memory of the task host, an optional reading sequence is as follows:
the configuration determining module 401 determines a configuration snapshot generated by the configuration parameters corresponding to the task from all configuration snapshots stored in the memory of the task host;
if the configuration snapshot cannot be determined from the memory of the task host machine, determining the configuration snapshot generated by the configuration parameters corresponding to the task from the memory cache;
and if the configuration snapshot cannot be determined from the memory cache, determining the configuration snapshot generated by the configuration parameters corresponding to the task from the disk cache.
The above reading sequence is only one possible way, and other reading sequences are also applicable to the embodiment of the present application.
For example, fig. 2 is a read sequence. In fig. 2, the operator adds and/or modifies configuration parameters in the background and stores the configuration parameters in the MySQL database. When the operator adds and/or modifies the task configuration, only the MySQL database is read and written, and the disk cache data is not operated.
When a task is started, inquiring configuration parameters of the current task from a database, serializing the configuration parameter objects by using Java language to obtain configuration snapshots, and storing the configuration snapshots in a disk cache; and loading the configuration snapshot in the disk cache into a memory cache, and then loading the configuration snapshot in the memory cache into a memory of the task host. And when the task runs, the task is run through the configuration snapshot in the memory of the task host machine.
If the configuration snapshot is stored in the disk cache, the memory cache and the memory of the task host, the configuration snapshot can be stored again because the configuration snapshot at some positions is lost due to some reasons, such as failure, power failure and the like.
Optionally, if the configuration snapshots are stored in the disk cache, the memory cache, and the memory of the task host, and the reading sequence is the sequence of the above example, the configuration determining module determines, from all the stored configuration snapshots, a configuration snapshot generated by the configuration parameters corresponding to the task, and then:
if the configuration snapshot generated by the configuration parameters corresponding to the task is determined from the memory cache, storing the configuration snapshot determined from the memory cache into the memory of the task host; or
And if the configuration snapshot generated by the configuration parameters corresponding to the task is determined from the disk cache, respectively storing the configuration snapshot determined from the disk cache into the memory cache and the memory of the task host.
It should be noted that, the different reading order and the order of storing again after being lost may be the same or different. For example, the reading sequence is disk cache, memory cache and the memory of a task host machine; the order of the re-storage can be the memory of the task host machine, the memory cache and the disk cache; other sequences are also possible.
Since the generated configuration snapshot may have an error, the generating module 402 may further verify the generated configuration snapshot before running the task, and run the task according to the configuration snapshot after determining that the verification is passed.
The time of verification may be before the configuration snapshot is generated and not stored; or stored first and verified between running tasks.
The verification content can be that whether the configuration parameters in the configuration snapshot are complete or not is verified, and if the configuration parameters are complete, the verification is determined to be passed; otherwise, the verification is determined to fail.
The present application is described above with reference to block diagrams and/or flowchart illustrations of methods, apparatus (systems) and/or computer program products according to embodiments of the application. It will be understood that one block of the block diagrams and/or flowchart illustrations, and combinations of blocks in the block diagrams and/or flowchart illustrations, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, and/or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer and/or other programmable data processing apparatus, create means for implementing the functions/acts specified in the block diagrams and/or flowchart block or blocks.
Accordingly, the subject application may also be embodied in hardware and/or in software (including firmware, resident software, micro-code, etc.). Furthermore, the present application may take the form of a computer program product on a computer-usable or computer-readable storage medium having computer-usable or computer-readable program code embodied in the medium for use by or in connection with an instruction execution system. In the context of this application, a computer-usable or computer-readable medium may be any medium that can contain, store, communicate, propagate, or transport the program for use by or in connection with the instruction execution system, apparatus, or device.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present application without departing from the spirit and scope of the application. Thus, if such modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is intended to include such modifications and variations as well.

Claims (9)

1. A method of running a task, the method comprising:
starting a task;
determining a configuration snapshot generated by configuration parameters corresponding to the task;
running the task according to the configuration snapshot;
in the task running process, when the configuration parameters corresponding to the task need to be modified, the configuration parameters corresponding to the task are modified; and generating a new configuration snapshot according to the modified configuration parameters, and running the task according to the new configuration snapshot.
2. The method of claim 1, wherein prior to determining the configuration snapshot generated from the configuration parameters corresponding to the task, further comprising:
generating a configuration snapshot according to configuration parameters corresponding to the tasks in a database, and storing the configuration snapshot;
the determining the configuration snapshot generated by the configuration parameters corresponding to the task includes:
and determining the configuration snapshot generated by the configuration parameters corresponding to the task from all the stored configuration snapshots.
3. The method of claim 2, wherein said storing the configuration snapshot comprises:
and storing the configuration snapshot into a part or all of a disk cache, a memory cache and a memory of the task host.
4. The method of claim 3, wherein the configuration snapshot is stored in a disk cache, a memory cache, and a memory of a task host;
the determining, from all the stored configuration snapshots, a configuration snapshot generated by the configuration parameters corresponding to the task includes:
determining a configuration snapshot generated by configuration parameters corresponding to the task from all configuration snapshots stored in a memory of the task host;
if the configuration snapshot cannot be determined from the memory of the task host machine, determining the configuration snapshot generated by the configuration parameters corresponding to the task from the memory cache;
and if the configuration snapshot cannot be determined from the memory cache, determining the configuration snapshot generated by the configuration parameters corresponding to the task from the disk cache.
5. The method of claim 4, wherein after determining the configuration snapshot generated by the configuration parameters corresponding to the task from all the stored configuration snapshots, further comprising:
if the configuration snapshot generated by the configuration parameters corresponding to the task is determined from the memory cache, storing the configuration snapshot determined from the memory cache into the memory of the task host; or
And if the configuration snapshot generated by the configuration parameters corresponding to the task is determined from the disk cache, respectively storing the configuration snapshot determined from the disk cache into the memory cache and the memory of the task host.
6. The method of claim 2, wherein determining the configuration snapshot generated by the configuration parameters corresponding to the task from all stored configuration snapshots comprises:
selecting all configuration snapshots corresponding to the task identifier from all stored configuration snapshots;
and selecting the configuration snapshot with the corresponding task starting time matched with the current time from all the selected configuration snapshots.
7. The method according to any one of claims 1 to 6, wherein after determining the configuration snapshot generated by the configuration parameters corresponding to the task, before running the task according to the configuration snapshot, further comprises:
determining that the configuration parameters in the configuration snapshot are complete.
8. An apparatus for running a task, the apparatus comprising:
the task starting module is used for starting a task;
the configuration determining module is used for determining a configuration snapshot generated by the configuration parameters corresponding to the task;
the operation module is used for operating the task according to the configuration snapshot;
the operation module is also used for modifying the configuration parameters corresponding to the task when the configuration parameters corresponding to the task need to be modified in the task operation process; and generating a new configuration snapshot according to the modified configuration parameters, and running the task according to the new configuration snapshot.
9. The apparatus of claim 8, wherein the apparatus further comprises:
the configuration generation module is used for generating a configuration snapshot according to the configuration parameters corresponding to the tasks in the database and storing the configuration snapshot;
the configuration determining module is specifically configured to:
and determining the configuration snapshot generated by the configuration parameters corresponding to the task from all the stored configuration snapshots.
CN201610439675.5A 2016-06-17 2016-06-17 Method and equipment for running task Active CN107515883B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610439675.5A CN107515883B (en) 2016-06-17 2016-06-17 Method and equipment for running task

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610439675.5A CN107515883B (en) 2016-06-17 2016-06-17 Method and equipment for running task

Publications (2)

Publication Number Publication Date
CN107515883A CN107515883A (en) 2017-12-26
CN107515883B true CN107515883B (en) 2021-02-02

Family

ID=60719896

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610439675.5A Active CN107515883B (en) 2016-06-17 2016-06-17 Method and equipment for running task

Country Status (1)

Country Link
CN (1) CN107515883B (en)

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104636395A (en) * 2013-11-15 2015-05-20 北京信威通信技术股份有限公司 Count processing method and device

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100389387C (en) * 2006-03-02 2008-05-21 华为技术有限公司 Smoothing updating method and apparatus for configuration information
CN100591022C (en) * 2007-11-29 2010-02-17 上海华为技术有限公司 Method and apparatus for implementing preactivation of batch configuration
CN101582908B (en) * 2009-06-30 2013-01-09 浙江宇视科技有限公司 Parameter configuration method and equipment
CN102043687B (en) * 2009-10-20 2012-07-25 杭州华三通信技术有限公司 Copy on first write device for realizing data snapshot and control method
US9836476B2 (en) * 2014-09-25 2017-12-05 Netapp, Inc. Synchronizing configuration of partner objects across distributed storage systems using transformations
CN104980517B (en) * 2015-06-26 2018-04-06 深圳市腾讯计算机***有限公司 Cluster sensory perceptual system based on snapshot, method and apparatus
CN105446834B (en) * 2015-11-30 2018-10-19 华为技术有限公司 The generation method and device of virtual machine snapshot

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104636395A (en) * 2013-11-15 2015-05-20 北京信威通信技术股份有限公司 Count processing method and device

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
"基于运行时模型的多样化云资源管理方法";陈 星 等;《软件学报》;20140715;第25卷(第7期);第1476-1491页 *
"面向驱动配置的自动日志***方法研究";刘虎球 等;《计算机学报》;20131015;第36卷(第10期);第1982-1992页 *

Also Published As

Publication number Publication date
CN107515883A (en) 2017-12-26

Similar Documents

Publication Publication Date Title
CN108681565B (en) Block chain data parallel processing method, device, equipment and storage medium
CN109684065B (en) Resource scheduling method, device and system
CN107896162B (en) Deployment method and device of monitoring system, computer equipment and storage medium
CN110147240B (en) Cloud storage-based application program installation method, system and storage medium
CN110096424B (en) Test processing method and device, electronic equipment and storage medium
CN111866099B (en) Method, device, system, equipment and storage medium for downloading mirror image file
CN106873970B (en) Installation method and device of operating system
CN112269661B (en) Partition migration method and device based on Kafka cluster
US10318343B2 (en) Migration methods and apparatuses for migrating virtual machine including locally stored and shared data
US11297156B1 (en) System for processing data using distributed messaging system and data processing method thereof
US20220206836A1 (en) Method and Apparatus for Processing Virtual Machine Migration, Method and Apparatus for Generating Virtual Machine Migration Strategy, Device and Storage Medium
CN112631994A (en) Data migration method and system
CN107515883B (en) Method and equipment for running task
US20220229689A1 (en) Virtualization platform control device, virtualization platform control method, and virtualization platform control program
CN112286796A (en) Software testing method, device and storage medium
CN110308914B (en) Upgrade processing method, device, equipment, system and computer readable storage medium
CN116303320A (en) Real-time task management method, device, equipment and medium based on log file
CN113515387B (en) Data processing method and device and electronic device
CN114253920A (en) Transaction reordering method, device, equipment and readable storage medium
CN114489999A (en) Method and device for processing pipeline task, processor and electronic equipment
CN112052330B (en) Application keyword distribution method and device
CN111736895A (en) Method, equipment and storage medium for merging and upgrading version numbers of software products
CN112817953A (en) Data verification method and device, computer equipment and computer-readable storage medium
CN107678866B (en) Partition communication method and device based on embedded operating system
CN111324374A (en) Application program registration method and device based on application performance management system

Legal Events

Date Code Title Description
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
TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20240307

Address after: # 04-08, Lai Zanda Building 1, 51 Belarusian Road, Singapore

Patentee after: Alibaba Singapore Holdings Ltd.

Country or region after: Singapore

Address before: Cayman Islands Grand Cayman capital building, a four storey No. 847 mailbox

Patentee before: ALIBABA GROUP HOLDING Ltd.

Country or region before: Cayman Islands