CN114968532A - Task execution method and device, electronic equipment and computer readable storage medium - Google Patents

Task execution method and device, electronic equipment and computer readable storage medium Download PDF

Info

Publication number
CN114968532A
CN114968532A CN202210625295.6A CN202210625295A CN114968532A CN 114968532 A CN114968532 A CN 114968532A CN 202210625295 A CN202210625295 A CN 202210625295A CN 114968532 A CN114968532 A CN 114968532A
Authority
CN
China
Prior art keywords
task
executed
time
queue
execute
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.)
Pending
Application number
CN202210625295.6A
Other languages
Chinese (zh)
Inventor
黄智勇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Dajia Internet Information Technology Co Ltd
Original Assignee
Beijing Dajia Internet Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Dajia Internet Information Technology Co Ltd filed Critical Beijing Dajia Internet Information Technology Co Ltd
Priority to CN202210625295.6A priority Critical patent/CN114968532A/en
Publication of CN114968532A publication Critical patent/CN114968532A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • G06F9/4881Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The disclosure relates to a task execution method and device, an electronic device and a computer readable storage medium. The task execution method comprises the following steps: acquiring a task to be executed from a task queue; acquiring the quantity of heartbeat time which is not more than preset time from the current time in a state queue, wherein the heartbeat time of a task which is started to be executed is stored in the state queue, and the heartbeat time is periodically updated according to the execution condition of the task; and under the condition that the quantity of the heartbeat time is less than the maximum quantity of the tasks which are executed in parallel globally, calling idle downstream resources to execute the tasks to be executed.

Description

Task execution method and device, electronic equipment and computer readable storage medium
Technical Field
The present disclosure relates to the field of computers, and in particular, to a task execution method and apparatus, an electronic device, and a computer-readable storage medium.
Background
In backend services, situations often occur in which the production capacity and the consumption capacity are not matched, for example, a platform needs to perform video transcoding after the video uploading is completed so as to provide a smoother playing experience, where the uploading is a producer and the video transcoding is a consumer. Generally, videos at a level of one minute can be uploaded and completed at a level of seconds, and video transcoding after video uploading usually needs to be completed in a time at a level of minutes or even hours, at this time, the capabilities of a producer and a consumer are at different levels, in order to avoid that the uploading of the videos by a user is limited due to the fact that the transcoding capability cannot keep up with the uploading capability, a back-end service generally uses a task queue to achieve decoupling of production and consumption, and in this scenario, as the producer, the requirement of video transcoding (i.e., a transcoding task for the uploaded videos) is placed in a task queue (such as a Kafka message queue) after the uploading of the videos is completed. In addition, a consumption service (namely a consumer) for realizing video transcoding is deployed to process the content of the task queue, so that the purpose of decoupling is achieved, and the problem of capability mismatch is solved.
At present, when a plurality of servers (corresponding to consumer roles) for processing tasks are deployed, the same concurrency control number is set for each server, and downstream resources are evenly allocated in advance. However, on one hand, idle servers are easy to exist, that is, servers which do not process tasks exist, and the downstream resources allocated to the servers are vacant, so that the downstream resources cannot be fully utilized; on the other hand, when a certain server exits abnormally, other servers are not aware of the abnormal exit, and the downstream resources of the abnormally exiting server are not released, which also causes the downstream resources to be insufficiently utilized, thereby increasing the task queuing time, deteriorating the user experience, and increasing the cost.
Disclosure of Invention
The disclosure provides a task execution method and device, an electronic device and a computer-readable storage medium, so as to at least solve the problem that downstream resources cannot be fully utilized due to related technologies.
According to a first aspect of the embodiments of the present disclosure, there is provided a task execution method, including: acquiring a task to be executed from a task queue; acquiring the quantity of heartbeat time which is not more than preset time from the current time in a state queue, wherein the heartbeat time of a task which is started to be executed is stored in the state queue, and the heartbeat time is periodically updated according to the execution condition of the task; and under the condition that the quantity of the heartbeat time is less than the maximum quantity of the tasks which are executed in parallel globally, calling idle downstream resources to execute the tasks to be executed.
Optionally, when the number of the heartbeat times is equal to the maximum task number, the number of the heartbeat times which are not longer than a predetermined time from the current time in the state queue is continuously obtained until the number of the heartbeat times is smaller than the maximum task number, and an idle downstream resource is called to execute the task to be executed.
Optionally, before acquiring the number of heartbeat times in the status queue, which is not more than the predetermined time from the current time, the method further includes: periodically inquiring the execution condition of the task which is started to be executed; if the task which has started to execute is in the executing condition, updating the heartbeat time of the task which has started to execute in the state queue; and if the task which is started to execute is not in the executing condition, stopping updating the heartbeat time of the task which is started to execute in the state queue.
Optionally, after the idle downstream resource is called to execute the task to be executed, the method further includes:
and adding the time when the downstream resource starts to execute the task to be executed into the state queue as the heartbeat time of the task to be executed.
Optionally, after the idle downstream resource is called to execute the task to be executed, the method further includes: and after the execution of the task to be executed is finished, deleting the heartbeat time of the task to be executed in the state queue.
Optionally, before acquiring the task to be executed from the task queue, the method further includes: determining a task to be executed corresponding to the data based on the uploaded data; and sending the task to be executed corresponding to the data to a task queue.
According to a second aspect of the embodiments of the present disclosure, there is provided a task execution device including: the task obtaining unit is configured to obtain a task to be executed from the task queue; the task quantity acquiring unit is configured to acquire the quantity of the heartbeat time which is not more than the preset time from the current time in the state queue, wherein the heartbeat time of the task which is started to be executed is stored in the state queue, and the heartbeat time is periodically updated according to the execution condition of the task; and the execution unit is configured to call idle downstream resources to execute the tasks to be executed under the condition that the number of the heartbeat time is less than the maximum number of the tasks which are executed in a global parallel mode.
Optionally, the execution unit is further configured to, when the number of the heartbeat times is equal to the maximum task number, continue to acquire the number of the heartbeat times that do not exceed a predetermined time from the current time in the state queue until the number of the heartbeat times is smaller than the maximum task number, and invoke an idle downstream resource to execute the task to be executed.
Optionally, the task number obtaining unit is further configured to periodically query the execution condition of the task that has started to be executed before obtaining the number of heartbeat times that do not exceed the predetermined time from the current time in the status queue; if the task which has started to execute is in the executing condition, updating the heartbeat time of the task which has started to execute in the state queue; and if the task which is started to execute is not in the executing condition, stopping updating the heartbeat time of the task which is started to execute in the state queue.
Optionally, the execution unit is further configured to, after the idle downstream resource is called to execute the task to be executed, add the time when the downstream resource starts to execute the task to be executed to the state queue as a heartbeat time of the task to be executed.
Optionally, the execution unit is further configured to delete the heartbeat time of the to-be-executed task in the state queue after the to-be-executed task is executed after the idle downstream resource is called to execute the to-be-executed task.
Optionally, the task obtaining unit is configured to determine, based on the uploaded data, a to-be-executed task corresponding to the data before obtaining the to-be-executed task from the task queue; and sending the task to be executed corresponding to the data to a task queue.
According to a third aspect of an embodiment of the present disclosure, there is provided an electronic apparatus including: a processor; a memory for storing processor-executable instructions; wherein the processor is configured to execute the instructions to implement the task execution method according to the present disclosure.
According to a fourth aspect of embodiments of the present disclosure, there is provided a computer-readable storage medium, wherein instructions, when executed by at least one processor, cause the at least one processor to perform a task execution method as described above according to the present disclosure.
According to a fifth aspect of embodiments of the present disclosure, there is provided a computer program product comprising computer instructions which, when executed by a processor, implement a method of task execution according to the present disclosure.
The technical scheme provided by the embodiment of the disclosure at least brings the following beneficial effects:
according to the task execution method and device, the electronic device and the computer-readable storage medium disclosed by the disclosure, the state queue is additionally arranged to store the heartbeat time of the task which is started to be executed, and the heartbeat time is periodically updated according to the execution condition of the task, so that the effective task number which is executed globally can be obtained from the state queue, and whether idle downstream resources can be used for executing the task to be executed is determined based on the effective task number and the maximum task number of global parallel processing, so that the downstream resources can be fully utilized, the utilization rate of the downstream resources is improved, the task queuing time is reduced, the user waiting time is reduced, and the user experience is improved. Therefore, the present disclosure solves the problem of the related art that the downstream resources cannot be fully utilized.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the disclosure and are not to be construed as limiting the disclosure.
Fig. 1 is an implementation scenario diagram illustrating a task execution method according to an exemplary embodiment of the present disclosure;
FIG. 2 is a flowchart illustrating a method of task execution according to an exemplary embodiment;
FIG. 3 is an overall flow diagram illustrating a method of task execution in accordance with an exemplary embodiment;
FIG. 4 is a block diagram illustrating a task performance device in accordance with an exemplary embodiment;
fig. 5 is a block diagram of an electronic device 500 according to an embodiment of the disclosure.
Detailed Description
In order to make the technical solutions of the present disclosure better understood by those of ordinary skill in the art, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below with reference to the accompanying drawings.
It should be noted that the terms "first," "second," and the like in the description and claims of the present disclosure and in the above-described drawings are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the disclosure described herein are capable of operation in sequences other than those illustrated or otherwise described herein. The embodiments described in the following examples do not represent all embodiments consistent with the present disclosure. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present disclosure, as detailed in the appended claims.
In this case, the expression "at least one of the items" in the present disclosure means a case where three types of parallel expressions "any one of the items", "a combination of any plural ones of the items", and "the entirety of the items" are included. For example, "include at least one of a and B" includes the following three cases in parallel: (1) comprises A; (2) comprises B; (3) including a and B. For another example, "at least one of the first step and the second step is performed", which means that the following three cases are juxtaposed: (1) executing the step one; (2) executing the step two; (3) and executing the step one and the step two.
In view of the above problems, the present disclosure provides a task execution method, which can fully utilize downstream resources, and a video upload transcoding scenario is taken as an example for description below.
Fig. 1 is a schematic diagram illustrating an implementation scenario of a task execution method according to an exemplary embodiment of the present disclosure, and as shown in fig. 1, the implementation scenario includes a server 100, a user terminal 110, and a user terminal 120, where the number of the user terminals is not limited to 2, and includes not limited to a mobile phone, a personal computer, and the like, the user terminal may be installed with a camera for acquiring a video, and the server may be one server, or several servers may form a server cluster, or may be a cloud computing platform or a virtualization center.
The user terminal 110 or 120 obtains a segment of video through a camera, and expects to upload the video to a certain platform for playing, at this time, the video needs to be uploaded to the server 100 and transcoded before being forwarded to the platform. After receiving the uploaded video, the server 100 puts the transcoding task of the video into a task queue (such as a Kafka message queue) so as to queue for execution, and after the transcoding task is queued, the server 100 acquires the transcoding task from the task queue and also acquires the number of heartbeat times which do not exceed a preset time from the current time in a status queue; when the number of the heartbeat time is less than the maximum task number which is executed in a global parallel mode, calling idle downstream resources to execute the transcoding task; and under the condition that the number of the heartbeat time is larger than or equal to the maximum task number, continuously acquiring the number of the heartbeat time which is not more than the preset time from the current time in the state queue, and calling idle downstream resources to execute the transcoding task until the number of the heartbeat time is smaller than the maximum task number.
Hereinafter, a task execution method and apparatus according to an exemplary embodiment of the present disclosure will be described in detail with reference to fig. 2 to 4.
FIG. 2 is a flowchart illustrating a task execution method according to an exemplary embodiment, as shown in FIG. 2, the task execution method including the steps of:
in step S201, a task to be executed is acquired from the task queue.
According to an exemplary embodiment of the present disclosure, before acquiring the task to be executed from the task queue, the method further includes: determining a task to be executed corresponding to the data based on the uploaded data; and sending the task to be executed corresponding to the data to a task queue. According to the embodiment, the new task to be executed is timely added into the task queue, so that the new task to be executed can be ensured to be queued in the task queue to wait for execution.
For example, taking a video uploading scenario as an example, the task queue may be a Kafka message queue, and after a video is uploaded to the server, a transcoding task corresponding to the video may be placed in the message queue, queued to be executed, and when the transcoding task is reached, the server may extract the transcoding task from the task queue.
Returning to fig. 2, in step S202, the number of heartbeat times that do not exceed a predetermined time from the current time in the status queue is obtained, where the heartbeat times of the tasks that have started to be executed are stored in the status queue, and the heartbeat times are periodically updated according to the execution conditions of the tasks.
For example, according to the heartbeat time, the number of global effective tasks currently being executed can be obtained from a state queue (such as a Redis queue), specifically, the heartbeat time between the center of the state queue and the current time can be filtered, and each task has its own heartbeat time, so that the task with the last heartbeat time and the current time being greater than five minutes is filtered, that is, the task without heartbeat for a long time is filtered. Because the heartbeat time of the task is updated every minute, when the distance between the heartbeat time and the current time is more than five minutes, the task corresponding to the heartbeat time has no heartbeat for a long time, namely is not an executing task, and the task is required to be checked from the effective task number. Therefore, even if the server exits abnormally, the tasks processed by the servers do not update the heartbeat time, and when other servers acquire the global effective concurrency number from the Redis queue, the tasks which are not reported by the heartbeat time for a long time due to the abnormal exit of the server can be filtered, so that the problem that the occupied resources cannot be released all the time due to the abnormal exit of the service is solved.
According to an exemplary embodiment of the present disclosure, before acquiring the number of heartbeats in the status queue, which is not more than a predetermined time from the current time, the method further includes: periodically inquiring the execution condition of the task which starts to be executed; if the task which has started to execute is in the executing condition, updating the heartbeat time of the task which has started to execute in the state queue; and if the task which is started to execute is not in the executing condition, stopping updating the heartbeat time of the task which is started to execute in the state queue. According to the embodiment, the execution condition of the task which has started to be executed is periodically detected, so that whether the task is in the executing state or not can be accurately indicated by the heartbeat time in the state queue, namely, the accuracy of the state queue is ensured.
For example, a timing task may be deployed before starting to process a task in the Kafka message queue, the server continuously polls (e.g., every other minute) a task that has already started to execute locally, determines whether the heartbeat time of each task in the status queue (Redis) needs to be updated according to the status of the task, and still takes the transcoding task as an example for illustration.
Returning to fig. 2, in step S203, in the case that the number of heartbeat times is less than the maximum number of tasks executed in parallel globally, the idle downstream resource is called to execute the task to be executed. The maximum number of the tasks executed globally and in parallel may be preset, for example, preset in a database, or may be temporarily set, and the disclosure is not limited thereto. For example, when the selected number of the heartbeat time is less than the maximum number of the tasks executed in parallel globally, that is, the number of the effective tasks is less than the maximum number of the tasks executed in parallel globally, it represents that there is still idle downstream resources available currently, and at this time, the idle downstream resources may be called to execute the task to be executed.
According to an exemplary embodiment of the present disclosure, after the idle downstream resource is called to execute the task to be executed, the method further includes: and taking the time when the downstream resource starts to execute the task to be executed as the heartbeat time of the task to be executed, and adding the time into the state queue. According to the embodiment, the heartbeat time of the task to be executed is stored in the state queue, so that the next task to be executed can be conveniently used for judging whether idle downstream resources can be used or not. For example, after the transcoding task starts to execute, the time for starting to execute may be stored as the first heartbeat time in the state queue, and then the execution state of the task to be executed may be periodically detected to update the heartbeat time.
According to the exemplary embodiment of the present disclosure, after the idle downstream resource is called to execute the task to be executed, the method further includes: and after the execution of the task to be executed is finished, deleting the heartbeat time of the task to be executed in the state queue. According to the embodiment, the heartbeat time of the executed task is deleted from the state queue, so that the accuracy of the state queue can be further ensured. For example, after the video finishes transcoding, that is, after the execution of the transcoding task is finished, the information of the transcoding task can be deleted from the Redis queue, so that the accuracy of the number of tasks in the running of the Redis queue is ensured.
According to the exemplary embodiment of the disclosure, under the condition that the number of the heartbeat time is equal to the maximum task number, the number of the heartbeat time which is not more than the preset time from the current time in the state queue is continuously obtained until the number of the heartbeat time is less than the maximum task number, and idle downstream resources are called to execute the task to be executed. According to the embodiment, the selected number of the heartbeat time is equal to the maximum number of the tasks, which is equivalent to the number of the tasks being executed is equal to the maximum number of the tasks, that is, the global resources are occupied, the selected number of the heartbeat time and the maximum number of the tasks can be continuously judged at the moment until the number of the heartbeat time is less than the maximum number of the tasks, the downstream resources are called to execute the corresponding tasks, and the problem that the resources are occupied is solved.
For example, when the selected heartbeat time (i.e., the effective task number) is less than the maximum task number that is executed in parallel globally, it represents that the number of tasks being executed has reached the maximum value of the number of tasks that can be executed in parallel globally, and there is no idle downstream resource to process the task to be executed, at this time, it is necessary to return to step S202 to re-acquire the number of heartbeat times that do not exceed the predetermined time from the current time in the state queue, continue to compare the selected number of heartbeat times with the maximum task number, until the selected number of heartbeat times is less than the maximum task number, then call the idle downstream resource to execute the task to be executed.
For the convenience of understanding the above embodiments, the following is disclosed with reference to the description of the system in fig. 3 by taking the task queue as Kafka message queue and the status queue as Redis queue as an example, fig. 3 is a schematic overall flow chart of a task execution method according to an exemplary embodiment, and as shown in fig. 3, the flow chart mainly includes the following parts:
s1, before starting to process the tasks in the Kafka message queue, deploying a timing heartbeat task, continuously polling (for example every other minute) the tasks which are executed locally by the Kafka consumption service (located in a server), determining whether the heartbeat time of each task in a state queue (Redis) needs to be updated according to the state of the tasks, if the polling task still processes the executing state, updating the heartbeat time of each task in the state queue (Redis) to be the current time point, and if the task is not in the executing state during polling, stopping updating the heartbeat time of each task in the state queue (Redis).
And S2, continuously acquiring the task from the Kafka message queue, such as acquiring a Kafka task.
And S3, acquiring the quantity of the heartbeat time of the effective task currently executed globally from the Redis queue, and recording the quantity as now, wherein at this time, tasks without heartbeat for a long time can be filtered, for example, the task with the last heartbeat time more than five minutes from the current time.
And S4, reading the maximum task quantity of global parallel execution, and recording the number as sum.
And S5, comparing the number now of the heartbeat time of the effective task obtained in the step S3 with the maximum global parallel execution task number sum obtained in the step S4, so as to know whether idle downstream resources concurrently execute the Kafka task. If sum is greater than now, the number of heartbeat times representing valid tasks is less than the maximum number of tasks executed in parallel globally, i.e. there are idle downstream resources available and Kafka tasks can be executed, then step S6 is executed continuously. If sum is less than or equal to now, the number of heartbeat time representing the valid task has reached the maximum number of tasks executed in parallel globally, and there is no free downstream resource to execute the Kafka task, at this time, it needs to return to step S3, and continuously poll and compare sum and now, until sum is greater than now, then step S6 is executed.
And S6, calling the idle downstream resource to execute the Kafka task.
And S7, after the Kafka task is executed, deleting the heartbeat time of the Kafka task from the Redis queue, and ensuring the accuracy of the effective task number in the Redis queue.
In summary, when a plurality of servers for executing the Kafka task are deployed, the embodiment can accurately control task concurrency on the premise of ensuring robustness, fully utilize downstream resources, improve the utilization rate of the downstream resources, reduce task queuing time, reduce user waiting time, and improve user experience.
Fig. 4 is a block diagram illustrating a task performing device according to an example embodiment. Referring to fig. 4, the apparatus includes:
a task obtaining unit 40 configured to obtain a task to be executed from a task queue; a task number obtaining unit 42 configured to obtain the number of heartbeat times which do not exceed a predetermined time from the current time in a state queue, wherein the heartbeat times of the tasks which have started to be executed are stored in the state queue, and the heartbeat times are periodically updated according to the execution conditions of the tasks; and the execution unit 44 is configured to, in a case that the number of the heartbeat times is less than the maximum number of the tasks executed in parallel globally, invoke an idle downstream resource to execute the task to be executed.
According to the exemplary embodiment of the present disclosure, the executing unit 44 is further configured to, in a case that the number of the heartbeat times is equal to the maximum number of tasks, continue to acquire the number of the heartbeat times that do not exceed the predetermined time from the current time in the state queue until the number of the heartbeat times is less than the maximum number of tasks, and invoke the idle downstream resource to execute the task to be executed.
According to an exemplary embodiment of the present disclosure, the task number obtaining unit 42 is further configured to periodically query the execution condition of the task that has started to be executed before obtaining the number of heartbeat times that do not exceed the predetermined time from the current time in the status queue; if the task which has started to execute is in the executing condition, updating the heartbeat time of the task which has started to execute in the state queue; and if the task which is started to execute is not in the executing condition, stopping updating the heartbeat time of the task which is started to execute in the state queue.
According to an exemplary embodiment of the present disclosure, the execution unit 44 is further configured to, after the idle downstream resource is called to execute the task to be executed, add the time when the downstream resource starts to execute the task to be executed as the heartbeat time of the task to be executed into the status queue.
According to an exemplary embodiment of the present disclosure, the execution unit 44 is further configured to delete the heartbeat time of the task to be executed in the status queue after the task to be executed is finished after the idle downstream resource is called to execute the task to be executed.
According to an exemplary embodiment of the present disclosure, the task obtaining unit 40 is configured to determine, based on the uploaded data, a to-be-executed task corresponding to the data before obtaining the to-be-executed task from the task queue; and sending the task to be executed corresponding to the data to a task queue.
According to an embodiment of the present disclosure, an electronic device may be provided. Fig. 5 is a block diagram of an electronic device 500 including at least one memory 501 having a set of computer-executable instructions stored therein that, when executed by the at least one processor, perform a method of task execution according to an embodiment of the disclosure, and at least one processor 502, according to an embodiment of the disclosure.
By way of example, the electronic device 500 may be a PC computer, tablet device, personal digital assistant, smartphone, or other device capable of executing the set of instructions described above. The electronic device 1000 need not be a single electronic device, but can be any collection of devices or circuits that can execute the above instructions (or sets of instructions) individually or in combination. The electronic device 500 may also be part of an integrated control system or system manager, or may be configured as a portable electronic device that interfaces with local or remote (e.g., via wireless transmission).
In the electronic device 500, the processor 502 may include a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), a programmable logic device, a special-purpose processor system, a microcontroller, or a microprocessor. By way of example, and not limitation, processor 502 may also include analog processors, digital processors, microprocessors, multi-core processors, processor arrays, network processors, and the like.
The processor 502 may execute instructions or code stored in memory, wherein the memory 501 may also store data. The instructions and data may also be transmitted or received over a network via a network interface device, which may employ any known transmission protocol.
The memory 501 may be integrated with the processor 502, for example, by having RAM or flash memory disposed within an integrated circuit microprocessor or the like. Further, memory 501 may comprise a stand-alone device, such as an external disk drive, storage array, or any other storage device usable by a database system. The memory 501 and the processor 502 may be operatively coupled or may communicate with each other, such as through I/O ports, network connections, etc., so that the processor 502 can read files stored in the memory 501.
In addition, the electronic device 500 may also include a video display (such as a liquid crystal display) and a user interaction interface (such as a keyboard, mouse, touch input device, etc.). All components of the electronic device may be connected to each other via a bus and/or a network.
According to an embodiment of the present disclosure, there may also be provided a computer-readable storage medium, wherein instructions in the computer-readable storage medium, when executed by at least one processor, cause the at least one processor to perform a task execution method of an embodiment of the present disclosure. Examples of the computer-readable storage medium herein include: read-only memory (ROM), random-access programmable read-only memory (PROM), electrically erasable programmable read-only memory (EEPROM), random-access memory (RAM), dynamic random-access memory (DRAM), static random-access memory (SRAM), flash memory, non-volatile memory, CD-ROM, CD-R, CD + R, CD-RW, CD + RW, DVD-ROM, DVD-R, DVD + R, DVD-RW, DVD + RW, DVD-RAM, BD-ROM, BD-R, BD-R LTH, BD-RE, Blu-ray or compact disc memory, Hard Disk Drive (HDD), solid-state drive (SSD), card-type memory (such as a multimedia card, a Secure Digital (SD) card or a extreme digital (XD) card), magnetic tape, a floppy disk, a magneto-optical data storage device, an optical data storage device, a hard disk, a magnetic tape, a magneto-optical data storage device, a hard disk, a magnetic tape, a magnetic data storage device, a magnetic tape, a magnetic data storage device, a magnetic tape, a magnetic data storage device, a magnetic tape, a magnetic data storage device, a magnetic tape, a magnetic data storage device, A solid state disk, and any other device configured to store and provide a computer program and any associated data, data files, and data structures to a processor or computer in a non-transitory manner such that the processor or computer can execute the computer program. The computer program in the computer-readable storage medium described above can be run in an environment deployed in a computer device, such as a client, a host, a proxy appliance, a server, or the like, and further, in one example, the computer program and any associated data, data files, and data structures are distributed across networked computer systems such that the computer program and any associated data, data files, and data structures are stored, accessed, and executed in a distributed fashion by one or more processors or computers.
According to an embodiment of the present disclosure, there is provided a computer program product including computer instructions that, when executed by a processor, implement a task execution method of an embodiment of the present disclosure.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This disclosure is intended to cover any variations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice in the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.
It will be understood that the present disclosure is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims (10)

1. A method of task execution, comprising:
acquiring a task to be executed from a task queue;
acquiring the quantity of heartbeat time which is not more than preset time from the current time in a state queue, wherein the heartbeat time of a task which is started to be executed is stored in the state queue, and the heartbeat time is periodically updated according to the execution condition of the task;
and under the condition that the number of the heartbeat time is less than the maximum number of the tasks which are executed in a global parallel mode, calling idle downstream resources to execute the tasks to be executed.
2. The task execution method of claim 1, further comprising:
and under the condition that the quantity of the heartbeat time is equal to the maximum task quantity, continuously acquiring the quantity of the heartbeat time which is not more than the preset time from the current time in the state queue until the quantity of the heartbeat time is less than the maximum task quantity, and calling idle downstream resources to execute the task to be executed.
3. The task execution method according to claim 1 or 2, wherein before acquiring the number of heartbeat times in the status queue that do not exceed a predetermined time from the current time, further comprising:
periodically inquiring the execution condition of the task which starts to be executed;
if the task which has started to execute is in the executing condition, updating the heartbeat time of the task which has started to execute in a state queue;
and if the task which is started to execute is not in the executing condition, stopping updating the heartbeat time of the task which is started to execute in the state queue.
4. The task execution method according to claim 1 or 2, wherein after calling an idle downstream resource to execute the task to be executed, further comprising:
and taking the time when the downstream resource starts to execute the task to be executed as the heartbeat time of the task to be executed, and adding the time into the state queue.
5. The task execution method of claim 4, after invoking an idle downstream resource to execute the task to be executed, further comprising:
and after the execution of the task to be executed is finished, deleting the heartbeat time of the task to be executed in the state queue.
6. The task execution method of claim 1, further comprising, prior to retrieving the task to be executed from the task queue:
determining a task to be executed of the data based on the uploaded data;
and sending the task to be executed corresponding to the data to the task queue.
7. A task execution apparatus, comprising:
the task obtaining unit is configured to obtain a task to be executed from the task queue;
the task quantity acquiring unit is configured to acquire the quantity of heartbeat time which is not more than preset time from the current time in a state queue, wherein the heartbeat time of the task which is started to be executed is stored in the state queue, and the heartbeat time is periodically updated according to the execution condition of the task;
and the execution unit is configured to call idle downstream resources to execute the task to be executed under the condition that the number of the heartbeat time is less than the maximum number of the tasks which are executed in a global parallel mode.
8. An electronic device, comprising:
a processor;
a memory for storing the processor-executable instructions;
wherein the processor is configured to execute the instructions to implement the task execution method of any one of claims 1 to 6.
9. A computer-readable storage medium, wherein instructions in the computer-readable storage medium, when executed by at least one processor, cause the at least one processor to perform a task execution method according to any one of claims 1 to 6.
10. A computer program product comprising computer instructions, characterized in that the computer instructions, when executed by a processor, implement a task execution method according to any one of claims 1 to 6.
CN202210625295.6A 2022-06-02 2022-06-02 Task execution method and device, electronic equipment and computer readable storage medium Pending CN114968532A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210625295.6A CN114968532A (en) 2022-06-02 2022-06-02 Task execution method and device, electronic equipment and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210625295.6A CN114968532A (en) 2022-06-02 2022-06-02 Task execution method and device, electronic equipment and computer readable storage medium

Publications (1)

Publication Number Publication Date
CN114968532A true CN114968532A (en) 2022-08-30

Family

ID=82960106

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210625295.6A Pending CN114968532A (en) 2022-06-02 2022-06-02 Task execution method and device, electronic equipment and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN114968532A (en)

Similar Documents

Publication Publication Date Title
EP3030966B1 (en) Virtual computing instance migration
US9880880B2 (en) Automatic scaling of computing resources using aggregated metrics
CN108712457B (en) Method and device for adjusting dynamic load of back-end server based on Nginx reverse proxy
US9882830B2 (en) Architecture for metrics aggregation without service partitioning
US20180131761A1 (en) Datastore for aggregated measurements for metrics
CN110647460B (en) Test resource management method and device and test client
EP3937022B1 (en) Method and apparatus of monitoring interface performance of distributed application, device and storage medium
CN111198859A (en) Data processing method and device, electronic equipment and computer readable storage medium
CN114816748A (en) Thread scheduling method and device, electronic equipment and storage medium
EP3314865A1 (en) Datastore for aggregated measurements for metrics
US10795747B2 (en) File synchronizing service status monitoring and error handling
CN111125257B (en) Dictionary updating method, device, equipment and storage medium
CN110347546B (en) Dynamic adjustment method, device, medium and electronic equipment for monitoring task
CN112363980A (en) Data processing method and device for distributed system
CN113297267A (en) Data caching and task processing method, device, equipment and storage medium
US10637915B1 (en) Storage services configured for storage-oriented applications
CN113869989B (en) Information processing method and device
CN114968532A (en) Task execution method and device, electronic equipment and computer readable storage medium
US20230066698A1 (en) Compute instance warmup operations
CN113296977B (en) Message processing method and device
US9880919B2 (en) Aggregation of metrics data with fine granularity
CN114064403A (en) Task delay analysis processing method and device
CN112711384A (en) Data storage method and device based on multiple storage devices
CN116431347B (en) Method, device, electronic equipment and storage medium for resource processing
CN115665466A (en) Multimedia data processing method and device, electronic equipment and storage medium

Legal Events

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