CN111913808A - Task allocation method, device, equipment and storage medium - Google Patents
Task allocation method, device, equipment and storage medium Download PDFInfo
- Publication number
- CN111913808A CN111913808A CN202010839246.3A CN202010839246A CN111913808A CN 111913808 A CN111913808 A CN 111913808A CN 202010839246 A CN202010839246 A CN 202010839246A CN 111913808 A CN111913808 A CN 111913808A
- Authority
- CN
- China
- Prior art keywords
- task
- tasks
- distributed
- target
- determining
- 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 69
- 238000012545 processing Methods 0.000 claims abstract description 70
- 230000015654 memory Effects 0.000 claims description 19
- 238000012163 sequencing technique Methods 0.000 claims description 5
- 230000006870 function Effects 0.000 abstract description 9
- 238000005516 engineering process Methods 0.000 abstract description 2
- 230000008569 process Effects 0.000 description 11
- 238000012552 review Methods 0.000 description 7
- 238000010586 diagram Methods 0.000 description 5
- 238000004891 communication Methods 0.000 description 4
- 238000004590 computer program Methods 0.000 description 4
- 238000012986 modification Methods 0.000 description 3
- 230000004048 modification Effects 0.000 description 3
- 238000012550 audit Methods 0.000 description 2
- 238000012217 deletion Methods 0.000 description 2
- 230000037430 deletion Effects 0.000 description 2
- 230000003993 interaction Effects 0.000 description 2
- 239000004973 liquid crystal related substance Substances 0.000 description 2
- 238000013515 script Methods 0.000 description 2
- 238000004458 analytical method Methods 0.000 description 1
- 238000004364 calculation method Methods 0.000 description 1
- 230000001413 cellular effect Effects 0.000 description 1
- 238000010276 construction Methods 0.000 description 1
- 238000013500 data storage Methods 0.000 description 1
- 230000007547 defect Effects 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 238000007726 management method Methods 0.000 description 1
- 238000010295 mobile communication Methods 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 230000001953 sensory effect Effects 0.000 description 1
- 239000007787 solid Substances 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 230000000007 visual effect Effects 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/50—Allocation of resources, e.g. of the central processing unit [CPU]
- G06F9/5083—Techniques for rebalancing the load in a distributed system
- G06F9/5088—Techniques for rebalancing the load in a distributed system involving task migration
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/23—Updating
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/90—Details of database functions independent of the retrieved data types
- G06F16/95—Retrieval from the web
- G06F16/957—Browsing optimisation, e.g. caching or content distillation
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/90—Details of database functions independent of the retrieved data types
- G06F16/95—Retrieval from the web
- G06F16/958—Organisation or management of web site content, e.g. publishing, maintaining pages or automatic linking
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Databases & Information Systems (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Data Mining & Analysis (AREA)
- Software Systems (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The application discloses a method, a device, equipment and a storage medium for task allocation, and relates to the fields of internet technology, browser data processing and the like. The specific implementation scheme is as follows: according to a task acquisition instruction, determining a target task from tasks to be allocated, and locking the determined target task; so that the locked target task can be acquired only by the task processor which sends the task acquisition instruction; and sending the target task to the task processing party according to the task processing progress of the task processing party. The method can be used as a functional module of the browser or the application program to be coupled in the browser or the application program, and the functions of the browser can be enriched without independently developing the functional codes of the browser. And the reusability is strong, and the method can be suitable for any task allocation use scene.
Description
Technical Field
The application relates to the field of data processing, in particular to the fields of internet technology, browser data processing and the like.
Background
Generally, a task processing system is constructed, and a set of task picking procedures are separately developed and maintained and coupled in task processing. In addition, some of the functions are not robust or perfect for the process, such as: the same task to be processed is repeatedly processed by a plurality of processing parties, so that the processing timeliness is influenced, and the task processing resources are wasted.
Disclosure of Invention
The application provides a method, a device, equipment and a storage medium for task allocation.
According to an aspect of the present application, there is provided a method of task allocation, including the steps of:
according to a task acquisition instruction, determining a target task from tasks to be allocated, and locking the determined target task; so that the locked target task can be acquired only by the task processor which sends the task acquisition instruction;
and sending the target task to the task processing party according to the task processing progress of the task processing party.
According to another aspect of the present application, there is provided an apparatus for task allocation, including:
the target task locking module is used for determining a target task from the tasks to be distributed according to the task acquisition instruction and locking the determined target task; so that the locked target task can be acquired only by the task processor which sends the task acquisition instruction;
and the target task sending module is used for sending the target task to the task processing party according to the task processing progress of the task processing party.
According to a third aspect of the present application, an embodiment of the present application provides an electronic device, including:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein,
the memory stores instructions executable by the at least one processor to cause the at least one processor to perform a method provided by any one of the embodiments of the present application.
According to a fourth aspect of the present application, embodiments of the present application provide a non-transitory computer-readable storage medium storing computer instructions for causing a computer to perform a method provided by any one of the embodiments of the present application.
According to the scheme of the application, the determined target task is locked after the task obtaining instruction is received, so that the locked target task can only be obtained by a task processing party which sends the task obtaining instruction. The method overcomes the problem of repeated task acquisition in the prior art, and improves the efficiency of task allocation and processing. The method can be used as a functional module of the browser or the application program to be coupled in the browser or the application program, and the functions of the browser can be enriched without independently developing the functional codes of the browser. And the reusability is strong, and the method can be suitable for any task allocation use scene.
It should be understood that the statements in this section do not necessarily identify key or critical features of the embodiments of the present application, nor do they limit the scope of the present application. Other features of the present application will become apparent from the following description.
Drawings
The drawings are included to provide a better understanding of the present solution and are not intended to limit the present application. Wherein:
FIG. 1 is a flow chart of a method of task assignment according to the present application;
FIG. 2 is a flow chart of determining a target task according to the present application;
FIG. 3 is a flow chart of determining a target task according to the present application;
FIG. 4 is a flow chart of a method of task assignment according to the present application;
FIG. 5 is a schematic diagram of a device for task assignment according to the present application;
FIG. 6 is a scenario diagram of a method of task assignment that may implement an embodiment of the present application;
FIG. 7 is a scenario diagram of a method of task assignment that may implement an embodiment of the present application;
FIG. 8 is a block diagram of an electronic device for implementing a method of task assignment according to an embodiment of the present application.
Detailed Description
The following description of the exemplary embodiments of the present application, taken in conjunction with the accompanying drawings, includes various details of the embodiments of the application for the understanding of the same, which are to be considered exemplary only. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the present application. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
In one embodiment of the present application, as illustrated in fig. 1, a method of task allocation is provided, which may include the steps of:
s101: according to a task acquisition instruction, determining a target task from tasks to be allocated, and locking the determined target task; so that the locked target task can be acquired only by the task processor which sends the task acquisition instruction;
s102: and sending the target task to the task processing party according to the task processing progress of the task processing party.
The scheme of the application can be executed in the task allocation module, and the module can be an independent task allocation module or can be used as a component of a system. For example, it can be used as a component of a task auditing system or task authentication system.
The embodiment of the application takes a task allocation module as an example to be explained as a component of a task auditing system. The task operator can upload the completed task to the task allocation module, and the uploaded task can be stored in a database (DB, Data Base) of the task allocation module as a task to be allocated.
The task allocation module analyzes the information of the tasks to be allocated and can generate a task list to be allocated according to the analysis result. The list of tasks to be allocated may be in the form of a pool of tasks to be allocated or a queue of tasks to be allocated.
The information of the task to be distributed may include an ID of a task operator, a type of the task to be distributed, and the like. The type of the task to be allocated may be used as a description of the task to be allocated, for example, the type of the task to be allocated may be used to describe a file type of the task to be allocated, such as a text type, a graphics-text type, a video type, or the like. For another example, the type of the task to be distributed may be a type of processing the task to be distributed, such as account authentication, content auditing, and the like.
For each task to be allocated in the task list to be allocated, a predetermined rule may be adopted for sorting. For example, the predetermined rules may include weights, upload times of tasks to be assigned, or IDs of task operators, etc.
The task processing party may send a task obtaining instruction to the task allocation module, where the task obtaining instruction may include information such as an ID of the task processing party, and the number of target tasks to be obtained. There may be a plurality of task processing parties.
The task allocation module can determine a target task from the task list to be allocated according to a task acquisition instruction of the task processing party, and for the task processing party, the target task is the task to be processed. The target task can be finally sent to a task auditor for processing, such as auditing, authentication and the like.
For example, in the same time period, there is a task acquisition instruction issued by both the first task processor and the second task processor. And the task allocation module determines a target task to be sent to the first task processing party according to the task acquisition instruction of the first task processing party, and locks the target task to be sent to the first task auditing party. And locking the target task, so that the locked target task can be acquired only by the first task processing party.
And similarly, the task allocation module determines the target task to be sent to the second task processor and performs locking processing.
And the task allocation module sends the determined target task to the task processing party according to the task processing progress of the task processing party so that the task processing party executes task processing.
By the scheme, the determined target task is locked after the task acquisition instruction is received, so that the locked target task can only be acquired by the task processing party which sends the task acquisition instruction. The method overcomes the problem of repeated task acquisition in the prior art, and improves the efficiency of task allocation and processing.
As shown in fig. 2, in one embodiment, step S101 may include the following sub-steps:
s1011: determining the acquisition number N of target tasks from the task acquisition instruction, wherein N is a positive integer;
s1012: and determining the target tasks from the tasks to be distributed according to the acquired number N.
According to the number N of the target tasks contained in the received task acquisition instruction, different modes for determining the target tasks can be adopted. Taking the review scenario as an example, for example, the review content has a larger text space, more characters, and longer review content time, so the number of target tasks included in the task obtaining instruction can be set to be smaller, for example, 1 or 2. For the examination with less characters such as pictures and titles, the number of target tasks included in the task obtaining instruction may be set to be larger, for example, 20 or 30. The specific numbers are merely illustrative.
And under the condition that the number N of the target tasks is not higher than the number threshold, performing polling locking attempt on the tasks to be allocated in the task list to be allocated until N tasks to be allocated are locked. And the determined N tasks to be distributed can be used as target tasks.
For example, the number N of target tasks is small. For example, the number N is 2, and a plurality of candidate tasks to be allocated may be pre-selected from front to back in the list of tasks to be allocated according to the order. Illustratively, 10 candidate tasks to be assigned may be pre-selected. And performing polling locking attempt on the 10 candidate tasks to be allocated, and if the current candidate task to be allocated is in a locking state and indicates that the current candidate task to be allocated is selected by other task processing parties, continuing polling the next candidate task to be allocated. Until 2 tasks to be allocated are successfully locked in the 10 candidate tasks to be allocated, the 2 tasks to be allocated can be used as target tasks.
If the 2 tasks to be distributed are not successfully locked in the 10 candidate tasks to be distributed, the 10 candidate tasks to be distributed are pre-selected continuously for polling locking attempt.
For another example, when the number N of target tasks is higher than the number threshold, a direct locking manner may be adopted to lock N to-be-allocated tasks in the audit task list. The locked N tasks to be distributed can be used as target tasks.
The reason for adopting different schemes is that under the condition that the numerical value of the quantity N is small, the resource occupied by the polling locking mode is less, and the implementation is convenient.
In the case of a large number N, polling lock attempts may result in increased time and power consumption. This is because, in a case of high concurrency, for example, a case where a plurality of task processing sides issue a task acquisition instruction in the same time period. If the polling locking attempt scheme is adopted, for each task processing party, polling locking is carried out in the task list to be distributed. Due to the fact that the number of the task processing parties is multiple, the situation that the N target tasks cannot be successfully locked can be caused continuously. Both wasting time and increasing power consumption. Therefore, the task allocation efficiency can be improved by adopting a direct locking mode.
By the scheme, different processing modes can be adopted according to the number of the target tasks in different task acquisition instructions, so that task allocation can be optimized.
As shown in fig. 3, in one embodiment, step S1012 may include the following sub-steps:
s10121: under the condition that the obtained number N is not higher than the number threshold, M tasks to be distributed are determined from the tasks to be distributed, wherein M is a positive integer, and M is larger than N;
s10122: traversing the M tasks to be distributed to determine N unlocked tasks to be distributed;
s10123: and determining the N unlocked tasks to be distributed as target tasks.
In the current embodiment, the number threshold may be set to 5. And under the condition that the number N of target tasks contained in the received task acquisition instruction is less than 5, determining M candidate tasks to be distributed from the task list to be distributed. Illustratively, M ═ 10.
And traversing the 10 candidate tasks to be distributed, and checking the locking states of the candidate tasks to be distributed.
And if the current candidate task to be distributed is locked, continuously checking the next candidate task to be distributed.
If the current candidate task to be allocated is not locked, the current candidate task to be allocated can be locked. The locked candidate task to be assigned is then determined as the target task.
And through traversal, determining N unlocked tasks to be distributed from the M candidate tasks to be distributed. And determining the N unlocked tasks to be distributed as target tasks, and locking the N target tasks.
The database can be a mysql database, and the locking mode can be an incr instruction in a remote dictionary service (redis).
Through the scheme, the method has the advantages of simple implementation process, high implementation speed and little occupied resource.
In one embodiment, the method further comprises: and under the condition that the M tasks to be distributed are traversed and the N unlocked tasks to be distributed cannot be determined, continuously determining the M tasks to be distributed from the tasks to be distributed to be traversed until the N unlocked tasks to be distributed are determined.
Through the scheme, N unlocked tasks to be distributed need to be determined in the database finally so as to complete the execution of the task acquisition instruction.
In one embodiment, step S1012 may include the following sub-steps:
under the condition that the acquired number N is higher than the number threshold, determining N tasks to be allocated from the tasks to be allocated, and determining the N tasks to be allocated as target tasks;
the N tasks to be distributed are tasks with atomicity.
Still taking the number threshold as 5 for example, when the number N of target tasks included in the received task obtaining instruction is higher than 5, the task to be allocated may be determined in a direct locking manner.
For example, a first task handler and a second task handler are included. In the task acquisition instruction of the first task processor, the number of target tasks is 30. In the task acquisition instruction of the second task processor, the number of target tasks is 20. Then, according to the task obtaining instruction of the first task processing party, directly determining the first 30 tasks to be allocated from the task list to be allocated, determining 30 tasks to be allocated as target tasks, and performing locking processing.
Directly determining the tasks to be distributed which are ranked at the top 30 as target tasks, wherein the determined 30 target tasks have atomicity, that is, the 30 target tasks are an atomic unit which can not be divided. In making the determination of the target task, 30 determinations are needed together to ensure that no determinations are made by other reviewers.
After the locking process is performed, the to-be-allocated task list may be updated. In addition, according to the task acquisition instruction of the second task processing party, the task to be allocated which is sequenced at the top 20 is directly determined as the target task from the task list to be allocated, and locking processing is carried out. After the locking process is performed, the to-be-allocated task list may be updated again.
For example, the information of the tasks to be distributed is stored in a pending queue (zset) of a remote dictionary service (redis) and a database, respectively. And sequencing the tasks to be checked by utilizing the characteristic that the queue to be checked can be automatically sequenced according to the scores. This score may correspond to information such as weight value, upload time, etc. And after receiving the task acquisition instruction of the first task processing party, locking the tasks to be distributed which are arranged at the top 30 in the queue to be examined, and deleting the tasks from the queue to be examined. The locking mode may be performed using lua scripts. And after deletion, synchronously updating the information of the queue to be examined and the database. And subsequently receiving a task acquisition instruction of a second task processing party, locking the tasks to be allocated which are ranked in the front 20 from the rest tasks to be allocated in the queue to be checked, and deleting the tasks from the queue to be checked. And after deletion, synchronously updating the pending queue and the information of the database again.
Through the scheme, under the condition that the number of the target tasks is large, the target tasks can be determined in a direct locking mode. The above scheme may be more efficient than the way polling locks requires multiple lock attempts.
It is supplementary to be added that the tasks to be distributed uploaded by the task worker can be stored in the pending queue and the database at the same time. Under the condition that the acquisition number N1 of the target tasks in the received task acquisition instruction is not higher than the number threshold, a certain number of tasks to be allocated can be directly acquired in the database, the tasks to be allocated of the certain number are polled according to the arrangement sequence, so that N1 unlocked tasks to be allocated are locked, and the locking information is synchronously updated in the queue to be checked and the database. Furthermore, in the case that the fetch number N2 of the target task in the received task fetch instruction is higher than the number threshold, the first N2 tasks to be allocated may be locked in the pending queue in the order of the queue. And deleting the locked tasks to be distributed from the pending queue, and synchronously updating the locking information in the pending queue and the database. Thus, in the case where the acquisition number N1 is not higher than the number threshold, the database is directly operated in a polling manner, which has the advantages of consuming less resources and satisfying the time of the locking operation. When the acquisition number N2 is higher than the number threshold, the queue to be examined is operated, that is, the tasks to be allocated in the queue to be examined are locked, so that time consumption caused by repeatedly polling the database can be avoided. Therefore, the method and the device adopt different modes of determining the target task aiming at the acquisition quantity, and can obtain better balance in resource consumption and task allocation time.
In one embodiment, the method may further include the steps of:
determining the weight value of each task to be distributed according to the information of the task to be distributed;
sorting the tasks to be distributed according to the weight values;
based on this, in step S101, the determining a target task from the tasks to be allocated may further include:
and determining a target task from the tasks to be distributed according to the weight value.
After receiving the tasks to be distributed uploaded by the task operator, the task distribution module can determine the weight value of each task to be distributed according to the information of the tasks to be distributed.
For example, the weight value may be determined according to the reception time, and the earlier the reception time, the higher the weight value.
For another example, the weight value may be determined based on the ID of the task operator. Illustratively, the identity of the task operator (name, rating, registration time, etc.) may be determined from the task operator's ID. Further, the weight value can be determined according to the identity of the task operator.
For example, the weight value may be determined based on the ID of the task operator and the reception time. Illustratively, a first weight value is determined according to the ID of the task operator, on the basis of the first weight value, a task to be distributed with an earlier receiving time is set to be a relatively higher weight, and a task to be distributed with a later receiving time is set to be a relatively lower weight.
In the task list to be allocated, the tasks to be allocated may be sorted according to the weight values. Therefore, when the target task is determined from the task list to be distributed, the target task can be determined from the task list to be distributed according to the weight value, and the task to be distributed with higher importance is preferentially audited.
As shown in fig. 4, in one embodiment, the method may further include:
s103: acquiring the locking duration of a target task;
s104: and under the condition that the locking time length exceeds a time length threshold value and the target task is not sent to the task processing party, unlocking the target task.
After the target task is determined according to the task acquisition instruction, the locking information of the target task can be generated immediately. The lock information may include an ID of the task processor, a time to start locking, and the like. That is, the task handler and the lock duration for each target task may be recorded.
After determining the time to begin locking, a lock duration calculation may be performed, where the lock duration exceeds a duration threshold, indicating that the target task has not yet been processed. In this case, the target task may be unlocked. The task to be distributed after unlocking can still be determined as the target task by other task processing parties.
By the scheme, the overtime tasks to be distributed can be released in a timed mode, and the tasks to be distributed can be timely processed by the task processing party.
The task allocation method can be implemented by a main execution body of a screen-equipped intelligent device or a cloud terminal, for example, a desktop computer, a notebook computer, a smart phone, and/or a screen-equipped smart speaker.
In the case where the execution subject is a screened smart device, the operator enters the target page through a browser or an application of the screened smart device. The worker may act as a role in uploading the task to be assigned. For example, the comment text and/or comment picture of the worker on the news, commodities, stores, etc. on the target page may be used as the task to be distributed, and for example, the original or forwarded audio/video file and the image/text information uploaded by the worker on the target page may also be used as the task to be distributed.
The task allocation system generates a task list to be allocated according to information (ID of task operator, type of task to be allocated, etc.) of the task to be allocated.
The task processor can be an auditor for auditing the tasks to be distributed. The task processing party can also log in the task distribution system through a browser or an application program of the intelligent device with the screen. And sending a task acquisition instruction to the task distribution system. When the review texts and/or review pictures of news, commodities, shops and the like are checked, the time for checking each task to be checked is short. Therefore, the acquisition number of the target tasks may be higher than the number threshold, for example, 30 tasks to be audited are acquired at a time. And the task distribution system locks and sends a corresponding number of tasks to be audited to the auditor by adopting the mode that the obtained number N is higher than the number threshold value. The process can be executed locally by the intelligent equipment with the screen, and can also be executed at the cloud end so as to send a task locking instruction to be checked, a task sending instruction to be checked and the like to the intelligent equipment with the screen. Therefore, the auditor can obtain the corresponding number of tasks to be audited. In addition, when the auditor needs to audit the original or forwarded contents of the audio/video file, the image-text information and the like, a long auditing time may be needed, so that the number of acquired target tasks may be lower than a number threshold, for example, only 1 task to be audited is acquired at a time. And the task distribution system locks and sends the corresponding number of tasks to be audited to the auditor by adopting the mode that the obtained number N is not higher than the number threshold.
Logging in the task distribution system through a browser or an application program. On the one hand, the functions of the browser or the application program are enriched, so that the browser or the application program can realize the distribution of the tasks. On the other hand, the task distribution system can be used as a functional module of the browser or the application program to be coupled in the browser or the application program, and the functions of the browser can be enriched without independently developing the functional codes of the browser. And the reusability is strong, and the method can be suitable for any task allocation use scene.
As shown in fig. 5, an embodiment of the present application provides a task allocation apparatus, which may include:
a target task locking module 501, configured to determine a target task from the tasks to be allocated according to the task obtaining instruction, and lock the determined target task; so that the locked target task can be acquired only by the task processor which sends the task acquisition instruction;
and the target task sending module 502 is configured to send the target task to the task processor according to the task processing progress of the task processor.
In one embodiment, the targeted task locking module 501 may include:
the target task acquisition number determining submodule 5011 is configured to determine an acquisition number N of target tasks from the task acquisition instruction, where N is a positive integer;
and the target task determining submodule 5012 is configured to determine a target task from the tasks to be allocated according to the obtained number N.
In one embodiment, the target task determination submodule 5012 may include:
the task to be allocated determining unit 50121 is configured to determine, when the obtained number N is not higher than the number threshold, M tasks to be allocated from the tasks to be allocated, where M is a positive integer and M > N;
a task to be allocated traversing unit 50122, configured to traverse the M tasks to be allocated to determine N unlocked tasks to be allocated;
and determining the N unlocked tasks to be distributed as target tasks.
In one embodiment, the to-be-assigned task traversal unit 50122 is further configured to: and under the condition that the M tasks to be distributed are traversed and the N unlocked tasks to be distributed cannot be determined, continuously determining the M tasks to be distributed from the tasks to be distributed to be traversed until the N unlocked tasks to be distributed are determined.
In one embodiment, the target task determination submodule 5012 is further operable to:
under the condition that the acquired number N is higher than the number threshold, determining N tasks to be allocated from the tasks to be allocated, and determining the N tasks to be allocated as target tasks;
the N tasks to be distributed are tasks with atomicity.
In one embodiment, the method further comprises:
a weight value determining module 503, configured to determine a weight value of each task to be allocated according to information of the task to be allocated;
a sorting module 504, configured to sort the tasks to be allocated according to the weight values;
the target task locking module 501 is specifically configured to:
and determining a target task from the task list to be distributed according to the weight value.
In one embodiment, the method further comprises:
a locking duration obtaining module 505, configured to obtain a locking duration of the target task;
and the unlocking module 506 is used for unlocking the target task under the condition that the locking time length exceeds the time length threshold and the target task is not sent to the task processing party.
As shown in fig. 6, an embodiment of the present application provides a method for task allocation, where the method is applied to a task review scenario when the number N of target tasks obtained from a task obtaining instruction is not higher than a number threshold, and includes the following four steps:
(1) go to and examine
And receiving the task to be audited uploaded by the task operator. And assembling the tasks to be audited into a task pool or queue to be audited. And presenting task information of the task to be audited, such as id, category, weight value and the like, in the task pool or queue to be audited. And storing the assembled task information into a database. The database may be a relational database, such as mysql.
(2) Get tasks
According to a task obtaining instruction (in the example, N is 1), the information of the first 10 to-be-examined tasks is obtained from the database according to the weight.
And performing locking attempt one by one from the 10 pieces of information of the tasks to be audited from high to low according to the weight until 1 task to be audited is successfully locked, wherein the locked task to be audited is marked as a target task. The locking may be by way of an incr instruction in a remote dictionary service (redis). If the returned result is 1, the locking is considered to be successful, and the locking is considered to be failed in addition.
And updating information in the database, and marking the determined target task as a locked state, for example, fields of "lock time" (lock _ time) and "lock user" (lock _ user) may be added, and the lock user is an auditor.
(3) Examination and approval
And the auditor acquires the target task and approves the target task. During the approval process and after the approval is completed, the approval progress needs to be returned. Such as returning information such as "processing", "processed completion", etc., so that the target task can be deleted from the database.
(4) Timed release
The method aims to process tasks locked by auditors but not approved for a long time. The operation is to set the "lock time" (lock _ time) and the "lock user" (lock _ user) of the task which is locked in the database and does not receive the information of "processing" and "processed completion" for a certain time, and the task can be normally acquired by other auditors after being set to be empty.
As shown in fig. 7, an embodiment of the present application provides a method for task allocation, where the method is applied to a task review scenario when the number N of target tasks obtained from a task obtaining instruction is higher than a number threshold, and includes the following four steps:
(1) go to and examine
And receiving the task to be audited uploaded by the task operator. And assembling the tasks to be audited into a task pool or queue to be audited. And presenting task information of the task to be audited, such as id, category, weight value and the like, in the task pool or queue to be audited.
And respectively storing the assembled task information into a pending queue (zset) of the redis and a database. And sequencing the tasks to be audited by utilizing the characteristic that zset can be automatically sequenced according to the scores. This score may correspond to a weight value.
(2) Get tasks
According to the task acquisition instruction (in this example, N is 30), the information of the top 30 ranked pending tasks is acquired from the pending queue by score (weight).
And clearing the acquired information of the top 30 ranked pending tasks from the pending queue. This step can be realized through the lua script to guarantee the atomicity of 30 tasks to be examined.
That is, only the first auditor is allowed to acquire the information of the top 30 pending tasks from the pending queue first, and the 30 pieces of information are deleted from the pending queue, that is, the 30 pieces of information are successfully locked, and the pending tasks corresponding to the 30 pieces of information are acquired by the first auditor in an exclusive manner. And then allowing the second auditor to continue to acquire the remaining tasks to be audited.
And synchronizing the transformed queue to be examined with the database. Namely, the "lock time" (lock _ time) and the "lock user" (lock _ user) of the task to be audited in the database are updated.
The above process is very time-consuming for an auditor to have three service operations (two operations on the pending queue, one operation on the database).
(3) Examination and approval
And the auditor acquires the target task and approves the target task. During the approval process and after the approval is completed, the approval progress needs to be returned. Such as returning information such as "processing", "processed completion", etc., so that the target task can be deleted from the database.
(4) Timed release
The method aims to process tasks locked by auditors but not approved for a long time. The operation is to set the "locking time" (lock _ time) and the "locking user" (lock _ user) of the task which is locked in the database and has not received the information of "processing" and "processed" for a certain time, and rewrite the task to be audited after the "locking time" (lock _ user) is set to be empty into the queue to be audited, and the task to be audited can be normally acquired by other auditors.
According to an embodiment of the present application, an electronic device and a readable storage medium are also provided.
Fig. 8 is a block diagram of an electronic device according to a task assignment method according to an embodiment of the present application. Electronic devices are intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be examples only, and are not meant to limit implementations of the present application that are described and/or claimed herein.
As shown in fig. 8, the electronic apparatus includes: one or more processors 810, a memory 820, and interfaces for connecting the various components, including a high-speed interface and a low-speed interface. The various components are interconnected using different buses and may be mounted on a common motherboard or in other manners as desired. The processor may process instructions for execution within the electronic device, including instructions stored in or on the memory to display graphical information of a GUI on an external input/output apparatus (such as a display device coupled to the interface). In other embodiments, multiple processors and/or multiple buses may be used, along with multiple memories and multiple memories, as desired. Also, multiple electronic devices may be connected, with each device providing portions of the necessary operations (e.g., as a server array, a group of blade servers, or a multi-processor system). In fig. 8, one processor 810 is taken as an example.
The memory 820 is a non-transitory computer readable storage medium provided herein. Wherein the memory stores instructions executable by at least one processor to cause the at least one processor to perform the method of task allocation provided herein. The non-transitory computer readable storage medium of the present application stores computer instructions for causing a computer to perform the method of task assignment provided herein.
The memory 820 is a non-transitory computer readable storage medium, and can be used for storing non-transitory software programs, non-transitory computer executable programs, and modules, such as program instructions/modules corresponding to the method for task allocation in the embodiment of the present application (for example, the to-be-allocated task list generating module 501, the target task locking module 502, and the target task sending module 503 shown in fig. 5). The processor 810 executes various functional applications of the server and data processing, i.e., a method of implementing task allocation in the above-described method embodiments, by executing non-transitory software programs, instructions, and modules stored in the memory 820.
The memory 820 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application program required for at least one function; the storage data area may store data created according to the use of the electronic device of the method of task allocation, and the like. Further, the memory 820 may include high speed random access memory, and may also include non-transitory memory, such as at least one magnetic disk storage device, flash memory device, or other non-transitory solid state storage device. In some embodiments, memory 820 may optionally include memory located remotely from processor 810, which may be connected to the electronics of the method of task assignment via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The electronic device of the method for task assignment may further include: an input device 830 and an output device 840. The processor 810, the memory 820, the input device 830, and the output device 840 may be connected by a bus or other means, such as the bus connection in fig. 8.
The input device 830 may receive input numeric or character information and generate key signal inputs related to user settings and function control of the electronic device of the method of task assignment, such as a touch screen, a keypad, a mouse, a track pad, a touch pad, a pointing stick, one or more mouse buttons, a track ball, a joystick, or other input devices. The output device 840 may include a display device, an auxiliary lighting device (e.g., an LED), a haptic feedback device (e.g., a vibration motor), and the like. The display device may include, but is not limited to, a Liquid Crystal Display (LCD), a Light Emitting Diode (LED) display, and a plasma display. In some implementations, the display device can be a touch screen.
Various implementations of the systems and techniques described here can be realized in digital electronic circuitry, integrated circuitry, application specific ASICs (application specific integrated circuits), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs that are executable and/or interpretable on a programmable system including at least one programmable processor, which may be special or general purpose, receiving data and instructions from, and transmitting data and instructions to, a storage system, at least one input device, and at least one output device.
These computer programs (also known as programs, software applications, or code) include machine instructions for a programmable processor, and may be implemented using high-level procedural and/or object-oriented programming languages, and/or assembly/machine languages. As used herein, the terms "machine-readable medium" and "computer-readable medium" refer to any computer program product, apparatus, and/or device (e.g., magnetic discs, optical disks, memory, Programmable Logic Devices (PLDs)) used to provide machine instructions and/or data to a programmable processor, including a machine-readable medium that receives machine instructions as a machine-readable signal. The term "machine-readable signal" refers to any signal used to provide machine instructions and/or data to a programmable processor.
To provide for interaction with a user, the systems and techniques described here can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and a pointing device (e.g., a mouse or a trackball) by which a user can provide input to the computer. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form, including acoustic, speech, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a back-end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back-end, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local Area Networks (LANs), Wide Area Networks (WANs), and the Internet.
The computer system may include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The server can be a cloud server, also called a cloud computing server or a cloud host, and is a host product in a cloud computing service system, so that the defects of high management difficulty and weak service expansibility in the traditional physical host and VPS service are overcome.
It should be understood that various forms of the flows shown above may be used, with steps reordered, added, or deleted. For example, the steps described in the present application may be executed in parallel, sequentially, or in different orders, as long as the desired results of the technical solutions disclosed in the present application can be achieved, and the present invention is not limited herein.
The above-described embodiments should not be construed as limiting the scope of the present application. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may be made in accordance with design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present application shall be included in the protection scope of the present application.
Claims (16)
1. A method of task allocation, comprising:
according to a task acquisition instruction, determining a target task from tasks to be allocated, and locking the determined target task; so that the locked target task can be acquired only by the task processor which issues the task acquisition instruction;
and sending the target task to the task processing party according to the task processing progress of the task processing party.
2. The method of claim 1, wherein the determining a target task from the tasks to be distributed according to the task obtaining instruction comprises:
determining the acquisition number N of target tasks from the task acquisition instruction, wherein N is a positive integer;
and determining a target task from the tasks to be distributed according to the acquired number N.
3. The method according to claim 2, wherein the determining a target task from the tasks to be allocated according to the obtained number N includes:
under the condition that the obtained number N is not higher than a number threshold, determining M tasks to be distributed from the tasks to be distributed, wherein M is a positive integer and is greater than N;
traversing the M tasks to be distributed to determine N unlocked tasks to be distributed;
and determining the N unlocked tasks to be distributed as target tasks.
4. The method of claim 3, further comprising: and under the condition that the M tasks to be distributed are traversed and the N unlocked tasks to be distributed cannot be determined, continuously determining the M tasks to be distributed from the tasks to be distributed to be traversed until the N unlocked tasks to be distributed are determined.
5. The method according to claim 2, wherein the determining a target task from the tasks to be allocated according to the obtained number N includes:
under the condition that the acquired number N is higher than a number threshold, determining N tasks to be allocated from the tasks to be allocated, and determining the N tasks to be allocated as target tasks;
the N tasks to be distributed are tasks with atomicity.
6. The method of claim 1 or 2, further comprising:
determining the weight value of each task to be distributed according to the information of the tasks to be distributed;
sequencing the tasks to be distributed according to the weight values;
the step of determining a target task from the tasks to be distributed comprises the following steps:
and determining a target task from the tasks to be distributed according to the weight value.
7. The method of any of claims 1 to 5, further comprising:
acquiring the locking duration of the target task;
and under the condition that the locking duration exceeds a duration threshold and the target task is not sent to the task processing party, unlocking the target task.
8. An apparatus for task assignment, comprising:
the target task locking module is used for determining a target task from the tasks to be distributed according to the task acquisition instruction and locking the determined target task; so that the locked target task can be acquired only by the task processor which issues the task acquisition instruction;
and the target task sending module is used for sending the target task to the task processing party according to the task processing progress of the task processing party.
9. The apparatus of claim 8, wherein the target task locking module comprises:
a target task acquisition number determining submodule, configured to determine an acquisition number N of target tasks from the task acquisition instruction, where N is a positive integer;
and the target task determining submodule is used for determining a target task from the tasks to be distributed according to the acquisition number N.
10. The apparatus of claim 9, wherein the target task determination submodule comprises:
a task to be distributed determining unit, configured to determine M tasks to be distributed from the tasks to be distributed under the condition that the obtained number N is not higher than a number threshold, where M is a positive integer and M > N;
the task to be distributed traversing unit is used for traversing the M tasks to be distributed so as to determine N unlocked tasks to be distributed;
and determining the N unlocked tasks to be distributed as target tasks.
11. The apparatus of claim 10, wherein the to-be-assigned task traversing unit is further configured to: and under the condition that the M tasks to be distributed are traversed and the N unlocked tasks to be distributed cannot be determined, continuously determining the M tasks to be distributed from the tasks to be distributed to be traversed until the N unlocked tasks to be distributed are determined.
12. The apparatus of claim 9, the target task determination sub-module further to:
under the condition that the acquired number N is higher than a number threshold, determining N tasks to be allocated from the tasks to be allocated, and determining the N tasks to be allocated as target tasks;
the N tasks to be distributed are tasks with atomicity.
13. The apparatus of claim 8 or 9, further comprising:
the weight value determining module is used for determining the weight value of each task to be distributed according to the information of the tasks to be distributed;
the sequencing module is used for sequencing the tasks to be distributed according to the weight values;
the target task locking module is specifically configured to:
and determining a target task from the tasks to be distributed according to the weight value.
14. The apparatus of any of claims 8 to 12, further comprising:
the locking duration acquisition module is used for acquiring the locking duration of the target task;
and the unlocking module is used for unlocking the target task under the condition that the locking duration exceeds a duration threshold and the target task is not sent to the task processor.
15. An electronic device, comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of any one of claims 1 to 7.
16. A non-transitory computer readable storage medium storing computer instructions for causing a computer to perform the method of any one of claims 1 to 7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010839246.3A CN111913808B (en) | 2020-08-19 | 2020-08-19 | Method, device, equipment and storage medium for task allocation |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010839246.3A CN111913808B (en) | 2020-08-19 | 2020-08-19 | Method, device, equipment and storage medium for task allocation |
Publications (2)
Publication Number | Publication Date |
---|---|
CN111913808A true CN111913808A (en) | 2020-11-10 |
CN111913808B CN111913808B (en) | 2024-07-30 |
Family
ID=73278178
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010839246.3A Active CN111913808B (en) | 2020-08-19 | 2020-08-19 | Method, device, equipment and storage medium for task allocation |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111913808B (en) |
Cited By (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112596915A (en) * | 2020-12-26 | 2021-04-02 | 中国农业银行股份有限公司 | Distributed lock scheduling method, device, equipment and medium |
CN112598529A (en) * | 2020-12-15 | 2021-04-02 | 泰康保险集团股份有限公司 | Data processing method and device, computer readable storage medium and electronic equipment |
CN112633443A (en) * | 2021-01-05 | 2021-04-09 | 浪潮软件股份有限公司 | Warehousing operation process management method based on RFID reader-writer |
CN113240318A (en) * | 2021-05-31 | 2021-08-10 | 康键信息技术(深圳)有限公司 | Method, device and equipment for processing business tasks and storage medium |
CN113344375A (en) * | 2021-06-01 | 2021-09-03 | 北京十一贝科技有限公司 | Task management method, device, electronic equipment and medium in insurance service process |
CN114265697A (en) * | 2021-12-29 | 2022-04-01 | 北京百度网讯科技有限公司 | Distribution method, device and system of audit tasks, electronic equipment and storage medium |
CN114565366A (en) * | 2022-03-11 | 2022-05-31 | 西安热工研究院有限公司 | Method, system, device and storage medium for state management and control in to-do task approval |
CN117391388A (en) * | 2023-11-09 | 2024-01-12 | 北京易华录信息技术股份有限公司 | A cloud computing-based task distribution method and platform |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20070192402A1 (en) * | 2005-03-29 | 2007-08-16 | Trx, Inc. | System and method for automating workflow |
CN106201715A (en) * | 2016-06-30 | 2016-12-07 | 北京奇艺世纪科技有限公司 | A kind of method for scheduling task and device |
CN106406983A (en) * | 2015-07-27 | 2017-02-15 | 阿里巴巴集团控股有限公司 | Task scheduling method and device in cluster |
CN107168779A (en) * | 2017-03-31 | 2017-09-15 | 咪咕互动娱乐有限公司 | A kind of task management method and system |
CN107861799A (en) * | 2016-12-28 | 2018-03-30 | 平安科技(深圳)有限公司 | task processing method and device based on multi-thread environment |
CN110377406A (en) * | 2019-06-17 | 2019-10-25 | 平安银行股份有限公司 | A kind of method for scheduling task, device, storage medium and server node |
CN111506398A (en) * | 2020-03-03 | 2020-08-07 | 平安科技(深圳)有限公司 | Task scheduling method and device, storage medium and electronic device |
-
2020
- 2020-08-19 CN CN202010839246.3A patent/CN111913808B/en active Active
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20070192402A1 (en) * | 2005-03-29 | 2007-08-16 | Trx, Inc. | System and method for automating workflow |
CN106406983A (en) * | 2015-07-27 | 2017-02-15 | 阿里巴巴集团控股有限公司 | Task scheduling method and device in cluster |
CN106201715A (en) * | 2016-06-30 | 2016-12-07 | 北京奇艺世纪科技有限公司 | A kind of method for scheduling task and device |
CN107861799A (en) * | 2016-12-28 | 2018-03-30 | 平安科技(深圳)有限公司 | task processing method and device based on multi-thread environment |
CN107168779A (en) * | 2017-03-31 | 2017-09-15 | 咪咕互动娱乐有限公司 | A kind of task management method and system |
CN110377406A (en) * | 2019-06-17 | 2019-10-25 | 平安银行股份有限公司 | A kind of method for scheduling task, device, storage medium and server node |
CN111506398A (en) * | 2020-03-03 | 2020-08-07 | 平安科技(深圳)有限公司 | Task scheduling method and device, storage medium and electronic device |
Cited By (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112598529A (en) * | 2020-12-15 | 2021-04-02 | 泰康保险集团股份有限公司 | Data processing method and device, computer readable storage medium and electronic equipment |
CN112598529B (en) * | 2020-12-15 | 2023-08-29 | 泰康保险集团股份有限公司 | Data processing method and device, computer readable storage medium and electronic equipment |
CN112596915A (en) * | 2020-12-26 | 2021-04-02 | 中国农业银行股份有限公司 | Distributed lock scheduling method, device, equipment and medium |
CN112633443A (en) * | 2021-01-05 | 2021-04-09 | 浪潮软件股份有限公司 | Warehousing operation process management method based on RFID reader-writer |
CN113240318A (en) * | 2021-05-31 | 2021-08-10 | 康键信息技术(深圳)有限公司 | Method, device and equipment for processing business tasks and storage medium |
CN113344375A (en) * | 2021-06-01 | 2021-09-03 | 北京十一贝科技有限公司 | Task management method, device, electronic equipment and medium in insurance service process |
CN114265697A (en) * | 2021-12-29 | 2022-04-01 | 北京百度网讯科技有限公司 | Distribution method, device and system of audit tasks, electronic equipment and storage medium |
CN114565366A (en) * | 2022-03-11 | 2022-05-31 | 西安热工研究院有限公司 | Method, system, device and storage medium for state management and control in to-do task approval |
CN117391388A (en) * | 2023-11-09 | 2024-01-12 | 北京易华录信息技术股份有限公司 | A cloud computing-based task distribution method and platform |
Also Published As
Publication number | Publication date |
---|---|
CN111913808B (en) | 2024-07-30 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN111913808B (en) | Method, device, equipment and storage medium for task allocation | |
CN112269789A (en) | Method and device for storing data and method and device for reading data | |
CN111460285A (en) | Information processing method, device, electronic equipment and storage medium | |
CN112115113B (en) | Data storage system, method, device, equipment and storage medium | |
US11860838B2 (en) | Data labeling method, apparatus and system, and computer-readable storage medium | |
CN112015468B (en) | Interface document processing method and device, electronic equipment and storage medium | |
CN111737501A (en) | Content recommendation method and device, electronic equipment and storage medium | |
CN110619002A (en) | Data processing method, device and storage medium | |
CN111831752B (en) | Spatial arrangement method, device and equipment of distributed database and storage medium | |
CN112506479A (en) | Page editing method, device, equipment and storage medium | |
CN115222176A (en) | Risk control method, apparatus, device and medium | |
CN112395333A (en) | Method and device for checking data exception, electronic equipment and storage medium | |
CN110909390B (en) | Task auditing method and device, electronic equipment and storage medium | |
CN112381167A (en) | Method for training task classification model, and task classification method and device | |
CN112486644A (en) | Method, apparatus, device and storage medium for generating information | |
CN112069155A (en) | Data multidimensional analysis model generation method and device | |
CN111738325A (en) | Image recognition method, device, equipment and storage medium | |
CN111338714A (en) | Applet material processing method, device, electronic equipment and medium | |
US20220198301A1 (en) | Method and apparatus for update processing of question answering system | |
US11036710B2 (en) | Scalable selection management | |
CN110837363A (en) | Code file generation method, device, equipment and medium | |
CN112052347A (en) | Image storage method and device and electronic equipment | |
CN111680508A (en) | Text processing method and device | |
CN111459887B (en) | Resource screening method and device, electronic equipment and storage medium | |
CN111723318A (en) | Page data processing method, device, equipment and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |