CN115914394A - Task information acquisition method and device, electronic equipment and readable storage medium - Google Patents
Task information acquisition method and device, electronic equipment and readable storage medium Download PDFInfo
- Publication number
- CN115914394A CN115914394A CN202211572977.1A CN202211572977A CN115914394A CN 115914394 A CN115914394 A CN 115914394A CN 202211572977 A CN202211572977 A CN 202211572977A CN 115914394 A CN115914394 A CN 115914394A
- Authority
- CN
- China
- Prior art keywords
- information
- task information
- task
- client
- identification information
- 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.)
- Granted
Links
- 238000000034 method Methods 0.000 title claims abstract description 52
- 238000004891 communication Methods 0.000 claims description 16
- 238000004590 computer program Methods 0.000 claims description 7
- 230000004044 response Effects 0.000 claims description 7
- 238000001514 detection method Methods 0.000 claims description 2
- 238000012545 processing Methods 0.000 description 10
- 230000008569 process Effects 0.000 description 9
- 239000002699 waste material Substances 0.000 description 6
- 230000009471 action Effects 0.000 description 3
- 238000010586 diagram Methods 0.000 description 3
- 238000005516 engineering process Methods 0.000 description 2
- 238000009825 accumulation Methods 0.000 description 1
- 238000013500 data storage Methods 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 239000000835 fiber Substances 0.000 description 1
- 230000006870 function Effects 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 230000002093 peripheral effect Effects 0.000 description 1
- 230000002085 persistent effect Effects 0.000 description 1
- 238000012552 review Methods 0.000 description 1
- 239000004065 semiconductor Substances 0.000 description 1
- 239000007787 solid Substances 0.000 description 1
- 238000012546 transfer Methods 0.000 description 1
Images
Classifications
-
- Y—GENERAL 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
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02P—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
- Y02P90/00—Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
- Y02P90/02—Total factory control, e.g. smart factories, flexible manufacturing systems [FMS] or integrated manufacturing systems [IMS]
Landscapes
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The embodiment of the invention provides a task information acquisition method, a task information acquisition device, electronic equipment and a readable storage medium, wherein the method comprises the following steps: receiving first request information sent by a first client, wherein the first request information is used for acquiring first task information and comprises a query condition of the first task information; responding to the first request information, and acquiring first identification information from a preset database, wherein the first identification information is used for identifying first task information meeting the query condition; under the condition that the control equipment does not comprise the first identification information, storing the first identification information, and acquiring first task information from a preset database; and sending the first task information to the first client. According to the embodiment of the invention, the task information can be prevented from being repeatedly acquired.
Description
Technical Field
The present invention relates to the field of data processing technologies, and in particular, to a method and an apparatus for acquiring task information, an electronic device, and a readable storage medium.
Background
At present, with the development of information technology, the number of task information and the number of clients for processing task information are increasing continuously, and when a plurality of clients send data acquisition requests to a preset database, a situation that a plurality of data acquisition requests are all used for requesting the same task information may occur.
At this time, the same task information is obtained by two or more clients. Therefore, the task information is repeatedly acquired, and resource waste is caused.
Disclosure of Invention
The embodiment of the invention aims to provide a task information acquisition method, a task information acquisition device, an electronic device and a readable storage medium, which can avoid task information from being acquired repeatedly. The specific technical scheme is as follows:
in a first aspect of the present invention, first, a task information obtaining method is provided, which is applied to a control device, where the control device communicates with a first client and a preset database, and the method includes:
receiving first request information sent by a first client, wherein the first request information is used for acquiring first task information and comprises a query condition of the first task information;
responding to the first request information, and acquiring first identification information from a preset database, wherein the first identification information is used for identifying first task information meeting the query condition;
under the condition that the control equipment does not comprise the first identification information, storing the first identification information, and acquiring first task information from a preset database;
and sending the first task information to the first client.
In a second aspect of the present invention, there is further provided a task information obtaining apparatus, applied to a control device, where the control device communicates with a first client and a preset database, respectively, and the task information obtaining apparatus includes:
the system comprises a receiving module, a sending module and a receiving module, wherein the receiving module is used for receiving first request information sent by a first client, the first request information is used for acquiring first task information, and the first request information comprises a query condition of the first task information;
the acquisition module is used for responding to the first request information and acquiring first identification information from a preset database, wherein the first identification information is used for identifying first task information meeting the query condition;
the storage module is used for storing the first identification information and acquiring first task information from a preset database under the condition that the control equipment does not comprise the first identification information;
and the sending module is used for sending the first task information to the first client.
In yet another aspect of the present invention, there is also provided a computer-readable storage medium having stored therein instructions, which when run on a computer, cause the computer to execute any one of the above-mentioned task information acquisition methods.
In yet another aspect of the present invention, there is also provided a computer program product containing instructions which, when run on a computer, cause the computer to perform any one of the above-mentioned task information acquisition methods.
The task information acquiring method provided by the embodiment of the invention receives first request information which is sent by a first client and used for acquiring first task information, wherein the first request information comprises a query condition of the first task information; responding to the first request information, and acquiring first identification information for identifying first task information meeting the query condition from a preset database; under the condition that the control equipment does not include the first identification information, the first identification information is stored and the first task information is acquired from a preset database, which means that only one piece of first identification information can be stored in the control equipment at most, that is, if the first identification information and the first task information are acquired by other clients, the control equipment comprises the first identification information; correspondingly, if the first identification information and the first task information are not acquired by other clients, the control device does not include the first identification information. Therefore, under the condition that the control device does not include the first identification information, it is indicated that the first task information is not acquired by other clients, at this time, the first identification information can be stored and the first task information can be acquired from the preset database, so that the condition that the first task information is acquired by the first client again under the condition that the first task information is already acquired by other clients can be avoided, that is, the first identification information can be prevented from being repeatedly acquired by two or more clients and the first task information can be prevented from being repeatedly processed by two or more clients, and the waste of resources is avoided. And finally, sending the first task information to the first client so that the first client can process the first task information.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below.
Fig. 1 is a schematic application environment diagram of a task information obtaining method according to an embodiment of the present invention;
fig. 2 is a flowchart of a task information obtaining method according to an embodiment of the present invention;
fig. 3 is a flowchart for implementing a task information obtaining method according to an embodiment of the present invention;
FIG. 4 is a schematic structural diagram of a task information obtaining apparatus according to an embodiment of the present invention;
fig. 5 is a schematic diagram of a hardware structure of an electronic device according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be described below with reference to the drawings in the embodiments of the present invention.
The task information obtaining method provided by the embodiment of the invention can be applied to the following application scenarios, which are explained below.
At present, for example, when a worker reviews videos, the worker has a plurality of corresponding clients, the videos to be reviewed are a plurality of videos, and the plurality of clients send data acquisition requests to acquire the videos to be reviewed, because one of the clients does not know what task information the other clients are prepared to acquire, a situation that the plurality of data acquisition requests are all used for requesting the same task information (i.e., the videos to be reviewed) occurs, and the following problems are easily caused:
firstly, the problem of repeated acquisition is that two or more clients acquire the same task information, and the task information is repeatedly acquired, thereby causing resource waste; secondly, the problem of slow picking-up speed is that two or more clients acquire the same task information, and if the task information can only be processed by one client, the client to which the task information should be distributed cannot be determined, so that the task information cannot be issued to the client, and the task information cannot be processed; then, the number of the task information retrieved by the client is less than the number of the tasks requested by the client, that is, the processing resources of the client cannot be fully used, which causes resource waste.
Based on the application scenario, the following describes in detail a task information acquisition method provided by an embodiment of the present invention.
As shown in fig. 1, the control device is in communication with the first client and the preset database, respectively, and the control device is responsible for information transfer between the first client and the preset database.
First, a first client sends first request information, wherein the first request information is used for acquiring first task information, and the first request information comprises a query condition of the first task information.
Then, the control device receives first request information sent by the first client, responds to the first request information, and obtains first identification information from a preset database, wherein the first identification information is used for identifying first task information meeting query conditions.
Next, in a case where the first identification information is not included in the control apparatus, the first identification information is stored and the first task information is acquired from a preset database.
Under the condition that the control equipment does not include the first identification information, the first identification information is stored, which indicates that the control equipment can only store one piece of first identification information at most, that is, if the first identification information and the first task information are acquired by other clients, the control equipment comprises the first identification information, and the control equipment cannot store the first identification information repeatedly; accordingly, if the first identification information and the first task information are not obtained by other clients, the control device does not include the first identification information, and the control device may store the first identification information at this time.
Therefore, in the case that the control device does not include the first identification information, it is stated that the first task information is not obtained by other clients, and at this time, the first identification information may be stored and the first task information may be obtained from the preset database, so that a situation that the first task information is obtained by the first client again when the first task information is already obtained by other clients can be avoided, that is, the first identification information is repeatedly obtained by two or more clients and the first task information is repeatedly processed by two or more clients can be avoided. Finally, the control device sends the first task information to the first client so that the first task information can be efficiently processed by the client.
Fig. 2 is a flowchart of a task information obtaining method according to an embodiment of the present invention;
as shown in fig. 2, the task information obtaining method may include steps 210 to 240, which are specifically as follows:
In the embodiment of the invention, first request information which is sent by a first client and used for acquiring first task information is received, wherein the first request information comprises a query condition of the first task information; responding to the first request information, and acquiring first identification information for identifying first task information meeting the query condition from a preset database; under the condition that the control equipment does not include the first identification information, the first identification information is stored and the first task information is acquired from a preset database, which means that only one piece of first identification information can be stored in the control equipment at most, that is, if the first identification information and the first task information are acquired by other clients, the control equipment comprises the first identification information; correspondingly, if the first identification information and the first task information are not acquired by other clients, the control device does not include the first identification information. Therefore, in the case that the control device does not include the first identification information, it is stated that the first task information is not obtained by other clients, and at this time, the first identification information may be stored and the first task information may be obtained from the preset database, so that a situation that the first task information is obtained by the first client again when the first task information is already obtained by other clients can be avoided, that is, the first identification information is repeatedly obtained by two or more clients and the first task information is repeatedly processed by two or more clients can be avoided. And finally, sending the first task information to the first client so that the first client can process the first task information.
Specific implementations of the above steps are described below.
Receiving first request information sent by a first client, wherein the first request information is used for acquiring first task information and comprises a query condition of the first task information.
And responding to the first request information, and acquiring first identification information from a preset database, wherein the first identification information is used for identifying first task information meeting the query condition.
The query condition may include: the system comprises a task information publisher, task information keywords and labels.
For example, the first request message includes the following query conditions: and if the video publisher is 'small A', inquiring first task information of the video publisher which is 'small A' from a preset database, and then acquiring first identification information from the preset database.
In one possible embodiment, the predetermined database includes: task information respectively corresponding to the preset tags, where the first request information includes a first tag corresponding to the client, and step 220 includes:
responding to the first request information, and determining a second tag corresponding to the first task information from preset tags;
under the condition that the first label is matched with the second label, acquiring first identification information from a preset database; the first label is used for marking the category of the task information processed by the first client, and the second label is used for marking the category of the first task information.
At present, under the condition that two or more clients acquire the same task information, if the task information can only be processed by one client, it cannot be determined to which client the task information should be distributed, so that the task information cannot be issued to the client, which results in that the task information cannot be processed, and the processing efficiency of the task information is affected.
In order to improve the processing efficiency of the task information, the task information in the preset database can be divided according to the preset tags, so that the task information respectively corresponding to the preset tags is obtained, namely the preset database comprises: and task information respectively corresponding to the preset labels.
The first label is used for marking the category of the task information processed by the first client, and if the first label is 'short video', the category of the task information processed by the first client can be represented as short video; if the first tag is "long video," it may indicate that the type of the task information processed by the first client is long video.
The second label is used for marking the category of the first task information. If the second label is "short video", it may indicate that the category of the first task information is short video; if the second label is "long video", it may indicate that the category of the first task information is long video.
In addition, the first tag may be specifically used to mark a category and a keyword of the task information processed by the first client. If the first label is 'food short video', the type of the task information processed by the first client can be represented as food short video; namely, the category of the task information is 'short video', and the keyword of the task information is 'food'.
The second tag may specifically be used to label the category and keyword of the first task information. If the second label is the food short video, it may indicate that the category of the first task information is the food short video.
The first request information comprises a first label corresponding to the client, the second label is used for marking the category of task information processed by the first client, then the second label corresponding to the first task information is determined, then the first label and the second label are verified, under the condition that the first label is matched with the second label, the first client can obtain the first task information, and at the moment, the first identification information is obtained from a preset database.
For example, when the first tag and the second tag are both "short videos", that is, the first tag and the second tag are matched, that is, the first client matches the first task information, the first identification information may be obtained from a preset database;
and when the first label is the short video and the second label is the long video, namely the first label is not matched with the second label, namely the first client is not matched with the first task information, the first identification information is refused to be acquired from the preset database.
Here, by checking the first tag corresponding to the first client and the second tag corresponding to the first task information, it is possible to divide the massive task data into more detailed categories, reduce the probability that two or more clients acquire the same task information, reduce the conflict of task information retrieval, and thereby improve the probability of task information retrieval success.
In a possible embodiment, the first request information includes a first quantity information, the first quantity information is used for identifying a first quantity, and the first quantity is greater than a second quantity for which the first client needs to obtain the task information, and step 220 includes:
acquiring second identification information from a preset database by taking the first quantity as a target query quantity, wherein the second identification information is used for identifying second task information meeting query conditions; the second task information is a third quantity;
and acquiring the second number of first identification information from the second identification information when the third number is larger than or equal to the second number.
The first request information includes first quantity information, where the first quantity information is used to identify a first quantity, where the first quantity is greater than a second quantity of the task information that the client needs to obtain, for example, the second quantity of the task information that the client needs to obtain is 95, the first quantity of the first quantity information identifiers included in the first request information is 100, and the second identification information actually obtained from the preset database is 98.
If the number of queries that the first client needs to acquire task information is taken as the target number, that is, the second number of task information that the first client needs to acquire is 95, but there are 2 pieces of task information that the first client needs to acquire and are also requested to acquire by other clients at the same time, the 2 pieces of task information cannot determine to which client the task information should be allocated, that is, the 2 pieces of task information cannot be allocated. That is to say, the number of the task information that can be actually acquired by the first client is 93, the requirement of the first client for acquiring the task information is not met, the computing resources of the first client cannot be fully utilized, and resource waste is caused; or, the task information required by the first client needs to be acquired by requesting the preset database again, which causes resource waste.
In the embodiment of the invention, the first quantity which is larger than the second quantity of the task information required to be obtained by the client is taken as the target query quantity, and the second identification information is obtained from the preset database, namely the target query quantity is 100, so that even if the situation that 2 pieces of the task information required to be obtained by the client are simultaneously requested to be obtained by other clients occurs, the requirement of the first client for obtaining the task information can still be met due to the fact that the second identification information actually obtained from the preset database is 98, the problem of picking failure caused by task information conflict can be remedied to a certain extent, and the probability of picking failure of the task information can be reduced.
Under the condition that the third quantity of the acquired second task information is larger than the second quantity of the task information required to be acquired by the first client, the first identification information of the first quantity is randomly acquired from the second identification information, that is, 95 pieces of first identification information can be randomly acquired from 98 pieces of second identification information, so that the step of repeatedly executing the step of acquiring the identification information from the preset database due to insufficient acquired second task information can be avoided, the second quantity of the task information required to be acquired by the client can be acquired at one time, and processing resources are saved.
After the step of acquiring the second identification information from the preset database by taking the first quantity as the target query quantity, the method further comprises the following steps:
and under the condition that the third number is smaller than the second number, repeatedly executing the step of acquiring the second identification information from the preset database until the number of times of acquiring the second identification information is larger than the preset number of times, or until the third number is larger than or equal to the second number.
When the second identification information actually acquired from the preset database is less than the task information that the client needs to acquire, the obtaining logic may be executed multiple times by increasing the obtaining batch, that is, the step of acquiring the second identification information from the preset database is repeatedly executed until the number of times of acquiring the second identification information is greater than the preset number of times, or until the third number is greater than or equal to the second number. For example, the number of times of acquiring the second identification information is 4, and the preset number of times is 3, that is, if the number of times of acquiring the second identification information is greater than the preset number of times, the step of acquiring the second identification information from the preset database may be stopped from being repeatedly executed. Or, if the third amount of the acquired second task information is greater than the second amount of the task information that the first client needs to acquire, the step of acquiring the second identification information from the preset database may be stopped from being repeatedly executed. Therefore, the problem that the second identification information is not enough to be received can be solved, and the problem that the received task information is not enough can be solved.
Step 230 is involved.
In the case where the first identification information is not included in the control apparatus, the first identification information is stored, and the first task information is acquired from a preset database.
In the case where the first identification information is not included in the control apparatus, the first identification information is stored. That is, if the first identification information is already included in the control device, it indicates that the first task information has already been acquired by other clients, and at this time, the control device does not repeatedly store the first identification information and subsequently does not acquire the first task information. On the contrary, if the control device does not include the first identification information, which indicates that the first task information is not obtained by other clients, the first identification information may be stored, and the first task information may be obtained from a preset database.
Specifically, the first identification information may be stored through an operation of joining the Remote field service (Remote Dictionary Server, redis) "when the Remote field service (Remote Dictionary Server, redis)" does not exist. Where the operation "join without existence" is used to indicate that a key is newly added if it does not exist and that the existing value is not changed if it exists. If said first identification information is not included in the control device, said first identification information is stored (newly added if the key is not present), if said first identification information is included in the control device (the already existing value is not changed if the key is present). The Redis supports network, can be based on a log-type database and a Key-Value database which can also be persistent, and provides application program interfaces of multiple languages.
Under the condition that two or more clients acquire the same task information, the situation that the same task information is simultaneously acquired is easy to occur, and at this time, under the condition that the control equipment does not comprise the first identification information, the first identification information is stored, so that the problem of repeatedly acquiring the task information is solved.
Generally, the distributed database includes a master database and a slave database, the master database can read data and write data, the slave database can only read data, if the client has obtained the first task information from the master database, there is a certain delay in the synchronization process between the master database and the slave database, that is, when other clients query from the slave database, the data queryable from the slave database still includes the first task information. At this time, the other clients also initiate request information for obtaining the first task information from the database, and the first task information is obtained from the master database, so that the problem of repeated obtaining occurs.
In an embodiment of the present invention, if the client has obtained the first task information from the master database through the control device, the control device includes the first identification information, so that, even if there is a delay in synchronizing the master database and the slave database, when the other client obtains the first task information from the slave database, the first identification information is obtained from the master database because the first identification information is already included in the control device. According to an embodiment of the present invention, in a case where the first identification information is not included in the control apparatus, the first identification information may be stored and the first task information may be acquired from a preset database. Since the first identification information is already included in the control device, other clients cannot acquire the first task information from the database, so that the problem of repeated acquisition can be avoided.
Therefore, the first identification information is stored under the condition that the first identification information meets the preset storage condition, and the problem of repeated picking caused by master-slave synchronization delay of the database can be solved.
In a possible embodiment, after step 230, the following steps may be further included:
receiving second request information sent by a second client, wherein the second request information is used for acquiring first task information;
and in response to detecting that the first identification information is included in the control equipment, sending prompt information to the second client, wherein the prompt information is used for prompting that the first task information is acquired by the first client.
And in response to detecting that the control device includes the first identification information, which indicates that the first identification information has been acquired from the preset database, the control device cannot repeatedly store the first identification information, that is, the second client cannot acquire the first task information any more, and then sends a prompt message to the second client, where the prompt message is used to prompt that the first task information has been acquired by the first client.
Therefore, when the first identification information is included in the control device, the prompt information is sent to the second client, and the prompt information is used for prompting that the first task information is acquired, so that the situation that the second client repeatedly acquires the first task information can be avoided.
In a possible embodiment, after step 230, the following steps are further included:
and sending first updating information to a preset database, wherein the first updating information is used for updating the information state of the first task information in the preset database to an acquired state, the task information in the acquired state is not used for being acquired by a client, and the client is a client communicated with the control device.
After the first identification information is stored and the first task information is acquired from the preset database, first updating information for updating the information state of the first task information in the preset database to the acquired state may be sent to the preset database, and after the first updating information is received by the preset database, the information state of the first task information may be updated to the acquired state by the preset database. The task information in the acquired state is not used for being acquired by the client, namely the task information in the acquired state is not in the query range of the client request information, and here, the query range of the preset database can be reduced, and the query efficiency is improved.
Step 240 is involved. And sending the first task information to the first client.
In a possible embodiment, after step 240, the following steps are further included:
accumulating the time length from the moment when the first client receives the first task information to the current moment to obtain a first time length;
acquiring the information state of the first task information under the condition that the first time length is longer than the preset time length;
sending second updating information to a preset database under the condition that the information state of third task information in the first task information is a state which is not processed by the first client, wherein the second updating information is used for updating the information state of the third task information in the preset database to be a non-acquired state;
and deleting the third identification information corresponding to the third task information.
Accumulating the time length from the moment when the first client receives the first task information to the current moment to obtain a first time length; when the first duration is longer than the preset duration, the information state of the first task information may be obtained to determine whether the first task information is processed by the first client.
The information state of the first task information can be determined according to the operation information of the first client. If the operation information of the first client on the first task information is detected, the information state of the first task information is a state processed by the first client; if the operation information of the first client on the first task information is not detected, the information state of the first task information is a state which is not processed by the first client.
If the information state of the third task information in the first task information is the state processed by the first client, no processing is needed. And sending second updating information to the preset database under the condition that the information state of the third task information in the first task information is a state which is not processed by the first client, wherein the second updating information is used for updating the information state of the third task information in the preset database to be a non-acquired state, and the task information in the non-acquired state is used for being acquired by the client.
And deleting the third identification information corresponding to the third task information, and storing the first identification information under the condition that the control device does not comprise the first identification information. Similarly, if the control device already includes the third identification information, it indicates that the third task information has already been acquired by other clients, and the control device does not repeatedly store the third identification information any more, that is, other clients cannot acquire the third task information corresponding to the third identification information through the control device.
Here, the control device does not include the third identification information by deleting the third identification information corresponding to the third task information, and at this time, if the other client requests to acquire the third identification information, the control device may store the third identification information, that is, the other client may acquire the third task information corresponding to the third identification information through the control device.
Therefore, the third identification information corresponding to the third task information which is not processed by the first client and exceeds the preset time length can be deleted, so that other clients can obtain the third identification information and the third task information corresponding to the third identification information conveniently, and the task obtaining and processing efficiency is improved.
The preset duration may be determined according to the task type, for example, the preset duration corresponding to the long video may be ten minutes, and the preset duration corresponding to the short video may be five minutes.
In summary, by receiving first request information sent by a first client and used for acquiring first task information, the first request information includes a query condition of the first task information; responding to the first request information, and acquiring first identification information for identifying first task information meeting the query condition from a preset database; under the condition that the control equipment does not comprise the first identification information, storing the first identification information and acquiring the first task information from a preset database, which means that at most one piece of first identification information can be stored in the control equipment, that is, if the first identification information and the first task information are acquired by other clients, the control equipment comprises the first identification information; correspondingly, if the first identification information and the first task information are not obtained by other clients, the control device does not include the first identification information. Therefore, in the case that the control device does not include the first identification information, it is stated that the first task information is not obtained by other clients, and at this time, the first identification information may be stored and the first task information may be obtained from the preset database, so that a situation that the first task information is obtained by the first client again when the first task information is already obtained by other clients can be avoided, that is, the first identification information is repeatedly obtained by two or more clients and the first task information is repeatedly processed by two or more clients can be avoided. And finally, sending the first task information to the first client so that the first client can process the first task information.
Fig. 3 is a flowchart of a method for implementing task information acquisition according to an embodiment of the present invention, and as shown in fig. 3, the method for implementing task information acquisition may include:
and 310, dividing the task information in the preset database according to the preset labels to obtain task information respectively corresponding to the preset labels.
Specifically, the preset database includes: and task information respectively corresponding to the preset labels.
Specifically, the query condition may include: the system comprises a task information publisher, task information keywords and labels.
Specifically, the first tag and the second tag are checked, for example, the first tag may be specifically used to mark a category and a keyword of the task information processed by the first client. If the first tag is the food short video, it may indicate that the category of the task information processed by the first client is the food short video, the second tag may be specifically used to mark the category and the keyword of the first task information, and if the second tag is the food short video, it may indicate that the category of the first task information is the food short video.
Under the condition that the first label is matched with the second label, acquiring a target query quantity with a first quantity from a preset database, and acquiring second identification information from the preset database, wherein the first quantity is larger than a second quantity of task information required to be acquired by the client, for example, the first quantity is 1.5 times of the second quantity.
In step 340, in case the second identification information is not included in the control device, the second identification information is stored.
Specifically, in the case where the second identification information is not included in the control apparatus, the second identification information is stored. That is, if the control device already includes the second identification information, it indicates that the second task information has already been acquired by other clients, and at this time, the control device will not repeatedly store the second identification information and subsequently acquire the second task information. On the contrary, if the control device does not include the second identification information, which indicates that the second task information is not obtained by other clients, the second identification information may be stored, and the second task information may be obtained from the preset database.
Under the condition that two or more clients acquire the same task information, the situation that the same task information is simultaneously acquired is easy to occur, and at this time, under the condition that the control equipment does not comprise second identification information, the second identification information is stored, so that the problem of repeatedly acquiring the task information is solved.
Specifically, when the third number is greater than or equal to the second number, the second number of first identification information is acquired from the second identification information;
in a case where the third number is smaller than the second number, the step of acquiring the second identification information from the preset database is repeatedly performed, and the number of times of acquiring the second identification information is accumulated.
Specifically, under the condition that the third quantity of the acquired second task information is larger than the second quantity of the task information required to be acquired by the first client, the first identification information of the first quantity is randomly acquired from the second identification information, so that the step of repeatedly executing the step of acquiring the identification information from the preset database due to insufficient acquired second task information can be avoided, the second quantity of the task information required to be acquired by the client can be acquired at one time, and processing resources are saved.
Specifically, the number of times of obtaining the second identification information is 4, and the preset number of times is 3, that is, the number of times of obtaining the second identification information is greater than the preset number of times, the step of obtaining the second identification information from the preset database may be stopped from being repeatedly executed, and the step of subsequently sending the first update information to the preset database may be executed.
If the number of times of obtaining the second identification information is not greater than the preset number of times, the step of obtaining the second identification information from the preset database may be continuously performed.
Specifically, the preset database updates the information state of the first task information to the acquired state after receiving the first update information. The task information in the acquired state is not used for being acquired by the client, namely the task information in the acquired state is not in the query range of the client request information, and here, the queryable range of the preset database can be reduced, and the query efficiency is improved.
After the first task information is obtained from the preset database, the first task information may be sent to the first client.
Based on the task information obtaining method shown in fig. 2, an embodiment of the present invention further provides a task information obtaining apparatus, as shown in fig. 4, the task information obtaining apparatus 400 may include:
a receiving module 410, configured to receive first request information sent by a first client, where the first request information is used to obtain first task information, and the first request information includes a query condition of the first task information;
an obtaining module 420, configured to, in response to the first request information, obtain first identification information from a preset database, where the first identification information is used to identify first task information that meets a query condition;
the storage module 430 is configured to store the first identification information and obtain the first task information from a preset database when the control device does not include the first identification information;
the sending module 440 is configured to send the first task information to the first client.
In one possible embodiment, the predetermined database includes: task information corresponding to the preset tag respectively, where the first request information includes a first tag corresponding to the first client, and the obtaining module 420 is specifically configured to:
responding to the first request information, and determining a second tag corresponding to the first task information from preset tags;
under the condition that the first label is matched with the second label, acquiring first identification information from a preset database; the first label is used for marking the category of the task information processed by the first client, and the second label is used for marking the category of the first task information.
In a possible embodiment, the task information obtaining apparatus 400 may further include:
the first receiving module is used for receiving second request information sent by a second client, and the second request information is used for acquiring first task information;
and the first sending module is used for responding to the detection that the control equipment comprises the first identification information, and sending prompt information to the second client, wherein the prompt information is used for prompting that the first task information is acquired by the first client.
In a possible embodiment, the first request information includes first quantity information, the first quantity information is used to identify a first quantity, the first quantity is greater than a second quantity that the first client needs to acquire the task information, and the acquiring module 420 is specifically configured to:
acquiring second identification information from a preset database by taking the first quantity as a target query quantity, wherein the second identification information is used for identifying second task information meeting query conditions; the second task information is a third quantity;
and acquiring the second number of first identification information from the second identification information when the third number is larger than or equal to the second number.
In a possible embodiment, the task information obtaining apparatus 400 may further include:
and the repeating module is used for repeating the step of acquiring the second identification information from the preset database under the condition that the third quantity is less than the second quantity until the times of acquiring the second identification information is more than the preset times, or until the third quantity is more than or equal to the second quantity.
In a possible embodiment, the task information obtaining device 400 may further include:
the second sending module is used for sending first updating information to the preset database, wherein the first updating information is used for updating the information state of the first task information in the preset database to an acquired state, the task information in the acquired state is not used for being acquired by the client, and the client is a client communicated with the control device.
In a possible embodiment, the task information obtaining apparatus 400 may further include:
the accumulation module is used for accumulating the time length from the moment when the first client receives the first task information to the current moment to obtain a first time length;
the first obtaining module is used for obtaining the information state of the first task information under the condition that the first time length is longer than the preset time length;
the third sending module is configured to send second update information to the preset database when an information state of third task information in the first task information is a state that is not processed by the first client, where the second update information is used to update an information state of the third task information in the preset database to an unacquired state;
and the deleting module is used for deleting the third identification information corresponding to the third task information.
In summary, in the embodiment of the present invention, by receiving first request information sent by a first client and used for acquiring first task information, the first request information includes a query condition of the first task information; responding to the first request information, and acquiring first identification information for identifying first task information meeting the query condition from a preset database; under the condition that the control equipment does not include the first identification information, the first identification information is stored and the first task information is acquired from a preset database, which means that only one piece of first identification information can be stored in the control equipment at most, that is, if the first identification information and the first task information are acquired by other clients, the control equipment comprises the first identification information; correspondingly, if the first identification information and the first task information are not acquired by other clients, the control device does not include the first identification information. Therefore, in the case that the control device does not include the first identification information, it is stated that the first task information is not obtained by other clients, and at this time, the first identification information may be stored and the first task information may be obtained from the preset database, so that a situation that the first task information is obtained by the first client again when the first task information is already obtained by other clients can be avoided, that is, the first identification information is repeatedly obtained by two or more clients and the first task information is repeatedly processed by two or more clients can be avoided. And finally, sending the first task information to the first client so that the first client processes the first task information.
An embodiment of the present invention further provides an electronic device, as shown in fig. 5, which includes a processor 501, a communication interface 502, a memory 503 and a communication bus 504, where the processor 501, the communication interface 502 and the memory 503 complete mutual communication through the communication bus 504,
a memory 503 for storing a computer program;
the processor 501, when executing the program stored in the memory 503, implements the following steps:
receiving first request information sent by a first client, wherein the first request information is used for acquiring first task information and comprises a query condition of the first task information; responding to the first request information, and acquiring first identification information from a preset database, wherein the first identification information is used for identifying first task information meeting the query condition; under the condition that the control equipment does not comprise the first identification information, storing the first identification information, and acquiring first task information from a preset database; and sending the first task information to the first client. According to the embodiment of the invention, the task information acquisition efficiency can be improved.
The communication bus mentioned in the above terminal may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown, but this is not intended to represent only one bus or type of bus.
The communication interface is used for communication between the terminal and other equipment.
The Memory may include a Random Access Memory (RAM) or a non-volatile Memory (non-volatile Memory), such as at least one disk Memory. Optionally, the memory may also be at least one memory device located remotely from the processor.
The Processor may be a general-purpose Processor, and includes a Central Processing Unit (CPU), a Network Processor (NP), and the like; the Integrated Circuit may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, a discrete Gate or transistor logic device, or a discrete hardware component.
In another embodiment of the present invention, a computer-readable storage medium is further provided, where instructions are stored in the computer-readable storage medium, and when the instructions are executed on a computer, the computer is caused to execute the task information acquiring method in any one of the above embodiments.
In another embodiment of the present invention, there is also provided a computer program product containing instructions, which when run on a computer, causes the computer to execute the task information acquiring method described in any of the above embodiments.
In the above embodiments, the implementation may be wholly or partially realized by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed on a computer, cause the processes or functions described in accordance with the embodiments of the invention to be performed in whole or in part. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored in a computer readable storage medium or transmitted from one computer readable storage medium to another computer readable storage medium, for example, the computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device, such as a server, a data center, etc., that incorporates one or more of the available media. The usable medium may be a magnetic medium (e.g., floppy Disk, hard Disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid State Disk (SSD)), among others.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising a … …" does not exclude the presence of another identical element in a process, method, article, or apparatus that comprises the element.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the system embodiment, since it is substantially similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
The above description is only for the preferred embodiment of the present invention, and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention shall fall within the protection scope of the present invention.
Claims (10)
1. A task information acquisition method is applied to control equipment, the control equipment is respectively communicated with a first client and a preset database, and the method comprises the following steps:
receiving first request information sent by the first client, wherein the first request information is used for acquiring first task information, and the first request information comprises a query condition of the first task information;
responding to the first request information, and acquiring first identification information from the preset database, wherein the first identification information is used for identifying first task information meeting the query condition;
under the condition that the control equipment does not comprise the first identification information, storing the first identification information, and acquiring the first task information from the preset database;
and sending the first task information to the first client.
2. The method of claim 1, wherein the predetermined database comprises: task information respectively corresponding to a preset tag, where the first request information includes a first tag corresponding to the first client, and the obtaining, in response to the first request information, first identification information from the preset database includes:
responding to the first request information, and determining a second tag corresponding to the first task information from the preset tags;
under the condition that the first label is matched with the second label, acquiring the first identification information from the preset database; the first tag is used for marking the category of the task information processed by the first client, and the second tag is used for marking the category of the first task information.
3. The method according to claim 1, wherein after storing the first identification information in a case where the first identification information is not included in the control apparatus, and acquiring the first task information from the preset database, the method further comprises:
receiving second request information sent by a second client, wherein the second request information is used for acquiring the first task information;
and responding to the detection that the first identification information is included in the control equipment, and sending prompt information to the second client, wherein the prompt information is used for prompting that the first task information is acquired by the first client.
4. The method according to claim 1, wherein the first request information includes a first amount information, the first amount information is used to identify a first amount, the first amount is greater than a second amount of task information that the first client needs to obtain, and the obtaining the first identification information from the preset database in response to the first request information includes:
acquiring second identification information from the preset database by taking the first quantity as a target query quantity, wherein the second identification information is used for identifying second task information meeting the query condition; the second task information is a third quantity;
and acquiring the second number of first identification information from the second identification information when the third number is greater than or equal to the second number.
5. The method according to claim 4, wherein after the obtaining second identification information from the preset database with the first number as the target query number, the method further comprises:
and under the condition that the third quantity is smaller than the second quantity, repeatedly executing the step of acquiring second identification information from the preset database until the times of acquiring the second identification information are larger than the preset times, or until the third quantity is larger than or equal to the second quantity.
6. The method according to claim 1, wherein after storing the first identification information in a case where the first identification information is not included in the control apparatus, and acquiring the first task information from the preset database, the method further comprises:
and sending first updating information to the preset database, wherein the first updating information is used for updating the information state of the first task information in the preset database to an acquired state, the task information in the acquired state is not used for being acquired by a client, and the client is a client communicated with the control device.
7. The method of claim 6, wherein after the sending the first task information to the first client, the method further comprises:
accumulating the time length from the time of receiving the first task information to the current time of the first client to obtain a first time length;
acquiring the information state of the first task information under the condition that the first time length is longer than a preset time length;
sending second update information to the preset database when the information state of third task information in the first task information is a state which is not processed by the first client, wherein the second update information is used for updating the information state of the third task information in the preset database to an unacquired state;
and deleting the third identification information corresponding to the third task information.
8. A task information acquisition device is applied to a control device, the control device is respectively communicated with a first client and a preset database, and the device comprises:
a receiving module, configured to receive first request information sent by the first client, where the first request information is used to obtain first task information, and the first request information includes a query condition of the first task information;
an obtaining module, configured to obtain, in response to the first request information, first identification information from the preset database, where the first identification information is used to identify first task information that satisfies the query condition;
the storage module is used for storing the first identification information and acquiring the first task information from the preset database under the condition that the control equipment does not comprise the first identification information;
and the sending module is used for sending the first task information to the first client.
9. An electronic device is characterized by comprising a processor, a communication interface, a memory and a communication bus, wherein the processor and the communication interface are used for realizing mutual communication by the memory through the communication bus;
a memory for storing a computer program;
a processor for implementing the method steps of any one of claims 1 to 7 when executing a program stored in a memory.
10. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the method according to any one of claims 1-7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211572977.1A CN115914394B (en) | 2022-12-08 | 2022-12-08 | Task information acquisition method and device, electronic equipment and readable storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211572977.1A CN115914394B (en) | 2022-12-08 | 2022-12-08 | Task information acquisition method and device, electronic equipment and readable storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN115914394A true CN115914394A (en) | 2023-04-04 |
CN115914394B CN115914394B (en) | 2024-09-24 |
Family
ID=86496789
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202211572977.1A Active CN115914394B (en) | 2022-12-08 | 2022-12-08 | Task information acquisition method and device, electronic equipment and readable storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN115914394B (en) |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2018036168A1 (en) * | 2016-08-22 | 2018-03-01 | 平安科技(深圳)有限公司 | Method and device for executing data processing task, execution server, and storage medium |
CN107861811A (en) * | 2017-10-24 | 2018-03-30 | 平安科技(深圳)有限公司 | Mission bit stream transmission method, device and computer equipment in Workflow system |
CN109408286A (en) * | 2018-09-17 | 2019-03-01 | 北京京东金融科技控股有限公司 | Data processing method, device, system, computer readable storage medium |
CN110991154A (en) * | 2019-12-20 | 2020-04-10 | 深圳前海环融联易信息科技服务有限公司 | Report generation method, system, computer equipment and computer readable storage medium |
CN113592305A (en) * | 2021-07-29 | 2021-11-02 | 北京百度网讯科技有限公司 | Test method, test device, electronic device, and storage medium |
CN113688175A (en) * | 2020-05-18 | 2021-11-23 | 北京沃东天骏信息技术有限公司 | Data processing method and device |
-
2022
- 2022-12-08 CN CN202211572977.1A patent/CN115914394B/en active Active
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2018036168A1 (en) * | 2016-08-22 | 2018-03-01 | 平安科技(深圳)有限公司 | Method and device for executing data processing task, execution server, and storage medium |
CN107861811A (en) * | 2017-10-24 | 2018-03-30 | 平安科技(深圳)有限公司 | Mission bit stream transmission method, device and computer equipment in Workflow system |
CN109408286A (en) * | 2018-09-17 | 2019-03-01 | 北京京东金融科技控股有限公司 | Data processing method, device, system, computer readable storage medium |
CN110991154A (en) * | 2019-12-20 | 2020-04-10 | 深圳前海环融联易信息科技服务有限公司 | Report generation method, system, computer equipment and computer readable storage medium |
CN113688175A (en) * | 2020-05-18 | 2021-11-23 | 北京沃东天骏信息技术有限公司 | Data processing method and device |
CN113592305A (en) * | 2021-07-29 | 2021-11-02 | 北京百度网讯科技有限公司 | Test method, test device, electronic device, and storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN115914394B (en) | 2024-09-24 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN107315825B (en) | Index updating system, method and device | |
CN108255620B (en) | Service logic processing method, device, service server and system | |
CN109450969B (en) | Method and device for acquiring data from third-party data source server and server | |
CN108156252B (en) | Data access method and device, server and client | |
CN112115200B (en) | Data synchronization method, device, electronic equipment and readable storage medium | |
CN110851290A (en) | Data synchronization method and device, electronic equipment and storage medium | |
CN111382206A (en) | Data storage method and device | |
CN109995612A (en) | A kind of service method for inspecting, device and electronic equipment | |
CN115080272A (en) | Business data processing method, electronic device and storage medium | |
CN108154024B (en) | Data retrieval method and device and electronic equipment | |
CN110311975B (en) | Data request processing method and device | |
CN111367691B (en) | Data feedback method and device, electronic equipment and storable medium | |
CN110430070B (en) | Service state analysis method, device, server, data analysis equipment and medium | |
CN111597259A (en) | Data storage system, method, device, electronic equipment and storage medium | |
CN111125240B (en) | Distributed transaction realization method and device, electronic equipment and storage medium | |
CN115914394B (en) | Task information acquisition method and device, electronic equipment and readable storage medium | |
CN110727895B (en) | Sensitive word sending method and device, electronic equipment and storage medium | |
CN112653736A (en) | Parallel source returning method and device and electronic equipment | |
CN110955460A (en) | Service process starting method and device, electronic equipment and storage medium | |
CN111291127B (en) | Data synchronization method, device, server and storage medium | |
CN110941568B (en) | Cache updating method, device, system, electronic equipment and medium | |
CN113760854A (en) | Method for identifying data in HDFS memory and related equipment | |
CN108763291B (en) | Data management method and device and electronic equipment | |
CN112596867A (en) | Suspension transaction processing method and distributed database system | |
CN112035498A (en) | Data block scheduling method and device, scheduling layer node and storage layer node |
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 |