Task starting method and device, equipment and storage medium
By pre-starting the required operating environment for the task and determining the priority based on the task's historical trigger time and heat value, the problem of task startup delay is solved, and faster task execution and higher system response speed are achieved.
Patent Information
- Application Number
- CN202510796342.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-13
- Publication Date
- 2025-09-23
AI Technical Summary
In complex computing tasks and business processes, task startup delays prevent users from obtaining task results in a timely manner, affecting the overall user experience. This is especially noticeable when resources are tight or the network is unstable.
By pre-starting the operating environment required for the task to be executed, the startup priority is determined according to the historical trigger time and heat value of the task, and resources and environment are prepared in advance so that the task can run immediately after submission.
The time interval from task submission to actual execution is significantly shortened, improving the system's response speed and overall user experience.
Smart Images

Figure CN120687213A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a task initiation method, apparatus, device, and storage medium. Background Art
[0002] In complex computing tasks and business processes, task initiation is a critical starting point for execution. Whether it's data processing, application deployment, or system scheduling, a smooth task launch directly impacts the efficiency and ultimate results of subsequent work. From resource allocation to environment configuration, every step requires precise control to ensure that tasks run stably and as expected.
[0003] When a task is submitted, the system immediately responds by launching the required runtime environment. This process includes applying for and allocating resource quotas, pulling and deploying container images, and loading various configuration parameters. Once the environment is ready, the task begins running in this customized "space," fully utilizing the allocated resources and executing the task instructions.
[0004] However, this "submit and start" approach inevitably introduces a certain amount of latency. From task submission to fully launching the environment, multiple steps are involved, including resource scheduling, image downloading, and dependency installation, each of which can be time-consuming. This latency can be particularly significant when resources are limited or the network is unstable, preventing users from receiving task results in a timely manner, impacting the overall user experience. Summary of the Invention
[0005] This application provides a task initiation method, apparatus, device, and storage medium. By pre-initializing the required operating environment for the task to be executed, the application allows the task to be immediately executed based on the pre-initialized environment after the task is submitted. This mechanism significantly shortens the time interval between task submission and actual execution, enabling users to obtain task processing results more quickly, effectively improving the system's responsiveness and overall user experience.
[0006] In a first aspect, the present application provides a task initiation method, the method comprising:
[0007] Get the historical triggering time corresponding to each target task;
[0008] For each target task, determine the heat value corresponding to the target task based on the current time and the historical trigger time corresponding to the target task;
[0009] Determine the startup priority of each target task based on the heat value corresponding to each target task;
[0010] Pre-starting the operating environment required by the target task according to the startup priority.
[0011] Optionally, determining the heat value corresponding to the target task according to the current time and the historical trigger time corresponding to the target task includes:
[0012] Taking the current moment as the end point of the historical time window, and according to the historical triggering moment corresponding to the target task, determining the total number of triggering times of the target task within the historical time window;
[0013] Determining a first score according to the total number of triggers;
[0014] Determining a second score based on the number of times the target task is triggered within each preset time period;
[0015] determining a third score based on the current moment and a target moment corresponding to the last triggering of the target task;
[0016] A popularity value corresponding to the target task is determined according to the first score, the second score, and the third score.
[0017] Optionally, determining a first score according to the total number of triggers includes:
[0018] Determine the maximum total trigger count from the total trigger counts of all target tasks;
[0019] A first score is determined according to the total number of triggering times and the maximum total number of triggering times.
[0020] Optionally, determining the second score according to the number of times the target task is triggered in each preset time period includes:
[0021] Get the preset weight corresponding to each preset time period;
[0022] A second score is determined according to the number of times the target task is triggered in each preset time period and a preset weight corresponding to each preset time period.
[0023] Optionally, determining a third score based on the current moment and a target moment corresponding to the last triggering of the target task includes:
[0024] Determining a target interval duration between the target moment and the current moment;
[0025] A third score is determined according to the target interval duration and a preset attenuation coefficient.
[0026] Optionally, pre-starting the operating environment required for the target task according to the startup priority includes:
[0027] According to the startup priority corresponding to each target task, select N target tasks with the highest startup priority and meeting the pre-start conditions as the first task;
[0028] Determine the total amount of resources required by N first tasks based on the amount of resources required by each first task, and compare the total amount of resources with the amount of free resources;
[0029] When the amount of free resources is greater than the total amount of resources, N is updated, and the updated N target tasks with the highest start priority and meeting the pre-start condition are selected as the first tasks, and the step of determining the total amount of resources required by the N first tasks is re-executed, where the updated N is N+1;
[0030] When the amount of idle resources is not greater than the total amount of resources, N is updated, and the updated N target tasks with the highest startup priority and meeting the pre-start conditions are selected as the first task, and the operating environment required for the first task is pre-started, where the updated N is N-1.
[0031] Optionally, the specific steps of detecting whether the target task meets the pre-start condition include:
[0032] Determining the expected triggering time corresponding to the target task based on the historical triggering time corresponding to the target task;
[0033] Determining an estimated trigger duration based on the estimated trigger time and the current time;
[0034] When the estimated triggering duration is less than the preset duration, determining that the target task meets the pre-starting condition;
[0035] When the estimated triggering duration is not less than the preset duration, it is determined that the target task does not meet the pre-starting condition.
[0036] Optionally, after pre-starting the operating environment required for the target task, the method further includes:
[0037] Determining the valid time window corresponding to the operating environment according to the startup time of the operating environment and the length of the valid time window;
[0038] Within the valid time window, detecting whether there is a hit target task in the operating environment;
[0039] When there is no hit target task in the operating environment, the resources used by the operating environment are released and the operating environment is closed.
[0040] In a second aspect, the present application provides a task initiation device, the device comprising:
[0041] An acquisition unit, used to obtain the historical triggering time corresponding to each target task;
[0042] A first determining unit is configured to determine, for each target task, a heat value corresponding to the target task according to a current time and a historical trigger time corresponding to the target task;
[0043] A second determining unit is used to determine the startup priority corresponding to each target task according to the heat value corresponding to each target task;
[0044] A pre-start unit is used to pre-start the operating environment required by the target task according to the startup priority.
[0045] Optionally, the first determining unit is configured to:
[0046] Taking the current moment as the end point of the historical time window, determining the total number of triggering times of the target task within the historical time window;
[0047] Determining a first score according to the total number of triggers;
[0048] Determining a second score based on the number of times the target task is triggered within each preset time period;
[0049] determining a third score based on the current moment and a target moment corresponding to the last triggering of the target task;
[0050] A popularity value corresponding to the target task is determined according to the first score, the second score, and the third score.
[0051] Optionally, the first determining unit is configured to:
[0052] Determine the maximum total trigger count from the total trigger counts of all target tasks;
[0053] A first score is determined according to the total number of triggering times and the maximum total number of triggering times.
[0054] Optionally, the first determining unit is configured to:
[0055] Get the preset weight corresponding to each preset time period;
[0056] A second score is determined according to the number of times the target task is triggered in each preset time period and a preset weight corresponding to each preset time period.
[0057] Optionally, the first determining unit is configured to:
[0058] Determining a target interval duration between the target moment and the current moment;
[0059] A third score is determined according to the target interval duration and a preset attenuation coefficient.
[0060] Optionally, the pre-start unit is used to:
[0061] According to the startup priority corresponding to each target task, select N target tasks with the highest startup priority and meeting the pre-start conditions as the first task;
[0062] Determine the total amount of resources required by N first tasks based on the amount of resources required by each first task, and compare the total amount of resources with the amount of free resources;
[0063] When the amount of free resources is greater than the total amount of resources, N is updated, and the updated N target tasks with the highest start priority and meeting the pre-start condition are selected as the first tasks, and the step of determining the total amount of resources required by the N first tasks is re-executed, where the updated N is N+1;
[0064] When the amount of idle resources is not greater than the total amount of resources, N is updated, and the updated N target tasks with the highest startup priority and meeting the pre-start conditions are selected as the first task, and the operating environment required for the first task is pre-started, where the updated N is N-1.
[0065] Optionally, the apparatus further includes a third determining unit, wherein the third determining unit is configured to:
[0066] Determining the expected triggering time corresponding to the target task based on the historical triggering time corresponding to the target task;
[0067] Determining an estimated trigger duration based on the estimated trigger time and the current time;
[0068] When the estimated triggering duration is less than the preset duration, determining that the target task meets the pre-starting condition;
[0069] When the estimated triggering duration is not less than the preset duration, it is determined that the target task does not meet the pre-starting condition.
[0070] Optionally, the device further includes a detection unit, wherein the detection unit is configured to:
[0071] Determining the valid time window corresponding to the operating environment according to the startup time of the operating environment and the length of the valid time window;
[0072] Within the valid time window, detecting whether there is a hit target task in the operating environment;
[0073] When there is no hit target task in the operating environment, the resources used by the operating environment are released and the operating environment is closed.
[0074] In a third aspect, the present application provides a task initiation device, comprising: at least one communication interface; at least one bus connected to the at least one communication interface; at least one processor connected to the at least one bus; and at least one memory connected to the at least one bus, wherein the processor is configured to:
[0075] Get the historical triggering time corresponding to each target task;
[0076] For each target task, determine the heat value corresponding to the target task based on the current time and the historical trigger time corresponding to the target task;
[0077] Determine the startup priority of each target task based on the heat value corresponding to each target task;
[0078] Pre-starting the operating environment required by the target task according to the startup priority.
[0079] In a fourth aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, which implements the above-mentioned task initiation method when executed by a processor.
[0080] The above technical solution provided by the embodiment of the present application has the following advantages compared with the prior art: in the embodiment of the present application, the historical triggering moment corresponding to each target task is obtained; for each target task, the heat value corresponding to the target task is determined according to the current moment and the historical triggering moment corresponding to the target task; the startup priority corresponding to each target task is determined according to the heat value corresponding to each target task; and the pre-start operation is performed according to the startup priority. It can be seen that the present application pre-starts the operating environment required for the task to be executed in advance, and after the task is submitted, the task can be run immediately based on the preheated environment. This mechanism significantly shortens the time interval from task submission to actual execution, allowing users to obtain task processing results faster, effectively improving the system's response speed and overall user experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0081] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.
[0082] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0083] One or more embodiments are exemplarily illustrated by pictures in the corresponding drawings. These exemplifications do not constitute limitations on the embodiments. Elements with the same reference numerals in the drawings are represented as similar elements. Unless otherwise stated, the figures in the drawings do not constitute proportional limitations.
[0084] Figure 1 A flowchart of a task initiation method provided in an embodiment of the present application;
[0085] Figure 2 A flow chart of a method for determining a heat value provided in an embodiment of the present application;
[0086] Figure 3 A schematic diagram of a flow chart of a method for determining a first score provided in an embodiment of the present application;
[0087] Figure 4 A schematic flow chart of a second scoring determination method provided in an embodiment of the present application;
[0088] Figure 5 A schematic diagram of a process for determining a third score provided in an embodiment of the present application;
[0089] Figure 6 A flowchart of a task screening method provided in an embodiment of the present application;
[0090] Figure 7 A flowchart of a task detection method provided in an embodiment of the present application;
[0091] Figure 8 A flowchart of a failure detection method provided in an embodiment of the present application;
[0092] Figure 9 A schematic diagram of a process flow of a task starting device provided in an embodiment of the present application;
[0093] Figure 10 A schematic diagram of a task initiation device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0094] To make the purpose, technical solutions, and advantages of the embodiments of this application more clear, the technical solutions in the embodiments of this application will be clearly and completely described below in conjunction with the drawings in the embodiments of this application. Obviously, the described embodiments are part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0095] The disclosure below provides many different embodiments or examples for implementing different configurations of the present invention. To simplify the disclosure of the present invention, the components and configurations of specific examples are described below. Of course, these are merely examples and are not intended to limit the present invention. In addition, the present invention may repeat reference numerals and / or letters in different examples. Such repetition is for the purpose of simplicity and clarity and does not in itself indicate the relationship between the various embodiments and / or configurations discussed.
[0096] In complex computing tasks and business processes, task initiation is a critical starting point for execution. Whether it's data processing, application deployment, or system scheduling, a smooth task launch directly impacts the efficiency and ultimate results of subsequent work. From resource allocation to environment configuration, every step requires precise control to ensure stable and consistent task execution. When a task is submitted, the system immediately responds and launches the necessary environment. This process includes applying for and allocating resource quotas, pulling and deploying container images, and loading various configuration parameters. Once the environment is ready, the task begins running in this customized "space," fully utilizing the allocated resources and executing the task instructions. However, this "submit and start" approach inevitably introduces latency. Since fully launching the environment involves multiple steps, such as resource scheduling, image downloading, and dependency installation, each of which can take time, the time from task submission to execution can be significant, resulting in users not receiving timely task results and impacting the overall user experience.
[0097] In order to solve the above problems, the embodiment of the present application provides a task startup method, which pre-starts the operating environment required for the task to be executed in advance, and can immediately run the task based on the pre-heated environment after the task is submitted. This mechanism significantly shortens the time interval from task submission to actual execution, allowing users to obtain task processing results more quickly, effectively improving the system's response speed and overall user experience. Figure 1 As shown, the specific steps include:
[0098] Step 101: Obtain the historical triggering time corresponding to each target task.
[0099] Among them, the target task can be all tasks that the system has run but needs to run again, or it can be a task among these tasks that meets the pre-start condition, which is not limited here. For example, the tasks that have been run in the system but need to be run again are Task 1, Task 2, Task 3 and Task 4. This application can determine Task 1, Task 2, Task 3 and Task 4 as target tasks, or it can find tasks that meet the pre-start condition among these tasks, and determine the tasks that meet the pre-start condition as target tasks. For example, Task 1 and Task 4 meet the pre-start condition, and Task 1 and Task 4 can be determined as target tasks. The above-mentioned pre-start condition is a pre-trigger rule for task startup, which can include time trigger rules (for example, the expected trigger time of the pre-start task is about to arrive), and can also include resource trigger rules (for example, the container image of the operating environment is consistent with the container image of the pre-start task), and can also include other custom trigger rules, which are not limited here.
[0100] In this step, tasks are scheduled in the cluster through a scheduler. A historical behavior collector is deployed next to the scheduler to continuously collect metadata for tasks and write them in a structured form to a log center or metadata warehouse for subsequent analysis. Metadata includes submission time, run cycle, task DAG (Directed Acyclic Graph) graph structure, resource quota used by the job, data path, user ID, tenant ID, success / failure status, and other execution records. Since only metadata for tasks that have been run by the system but need to be run again can be collected, these tasks can be used as target tasks, and the metadata of these tasks can be used as metadata for the target tasks. Of course, these tasks can also be screened to screen out tasks that meet the pre-start conditions, identify them as target tasks, and identify their metadata as metadata for the target tasks.
[0101] It should be noted that before executing the method described in this application, it is necessary to first detect whether the system has sufficient idle resources, and when it is detected that the system has sufficient idle resources, execute the method described in this application. Normally, when the system is in an idle window or a non-peak task phase, it is determined that the system has sufficient idle resources. Therefore, it is possible to analyze from multiple dimensions such as time rules, task load, and resource scheduling to determine whether the system is in an idle window or a non-peak task period. For example, by detecting whether the amount of idle resources in the system is greater than a preset threshold, it is determined whether the system is in an idle window, or by detecting whether the current moment is in a non-peak task period, it is determined whether the system is in a non-peak task period.
[0102] In addition, the execution subject of this step can be a scheduler, a master node in the cluster, or other devices in the cluster, which is not limited here.
[0103] Step 102: For each target task, determine the heat value corresponding to the target task based on the current time and the historical trigger time corresponding to the target task.
[0104] In this step, for each target task, the current moment is used as the end point of the historical time window. Based on the historical trigger moment corresponding to the task and the historical time window, the historical trigger moments within the historical time window are filtered out and the number of these historical trigger moments is counted as the total number of triggers for the target task within the historical time window. The first score is determined based on the total number of triggers; the second score is determined based on the number of triggers of the target task within each preset time period; the third score is determined based on the current moment and the target moment corresponding to the last trigger of the target task; and the corresponding heat value of the target task is determined based on the first score, the second score, and the third score.
[0105] Alternatively, this step can also input the current moment and the historical trigger moment corresponding to the target task into a pre-trained machine learning model to output the heat value corresponding to the target task.
[0106] Step 103: Determine the startup priority corresponding to each target task according to the heat value corresponding to each target task.
[0107] Among them, the higher the heat value of a task, the higher its corresponding priority, that is, the heat value and priority are positively correlated.
[0108] In this step, the tasks can be sorted from largest to smallest according to the corresponding heat value of each target task to obtain a task list. The priority of the first task in the task list is set to the highest priority, and the priority of the second task is set to the second highest priority. Based on this method, the corresponding startup priority is set for all tasks.
[0109] Step 104: pre-start the operating environment required by the target task according to the startup priority.
[0110] In this step, the target task with the highest startup priority can be used as the final pre-startup task to start the corresponding operating environment; or a preset number of target tasks with the highest startup priority can be used as the final pre-startup task to start the corresponding operating environment.
[0111] Furthermore, before starting the operating environment, it is possible to further detect whether the pre-start task can be started based on the idle resources. When starting the corresponding operating environment for a single task with the highest startup priority, it is necessary to first obtain the metadata of the task to determine the amount of resources it requires. If the amount of idle resources is greater than the amount of required resources, it is determined that its operating environment can be started. When starting the corresponding environment for multiple tasks with the highest startup priority, it is necessary to obtain the amount of resources required for each task and sum them up to obtain the total amount of resources. If the amount of idle resources is greater than the sum of the amount of resources, it is determined that the operating environments of these tasks can be started.
[0112] Furthermore, the specific method for launching the runtime environment is to identify nodes with idle resources and launch the runtime environment of the pre-start task on these nodes. When the target task is submitted, it can be assigned to these nodes, allowing them to directly run the target task. Launching the runtime environment for the pre-start task involves creating an executable container instance based on the container image and loading the configuration parameters required for the task into the instance.
[0113] In an embodiment of the present application, the historical triggering moment corresponding to each target task is obtained; for each target task, the heat value corresponding to the target task is determined based on the current moment and the historical triggering moment corresponding to the target task; the startup priority corresponding to each target task is determined based on the heat value corresponding to each target task; and the pre-start operation is performed based on the startup priority. It can be seen that the present application pre-starts the operating environment required for the task to be executed in advance, and after the task is submitted, the task can be run immediately based on the preheated environment. This mechanism significantly shortens the time interval from task submission to actual execution, allowing users to obtain task processing results faster, effectively improving the system's response speed and overall user experience.
[0114] In the embodiment of the present application, a scoring model can be established based on factors such as its historical running frequency, time distribution, time decay, etc., to score the target task in multiple aspects, and then determine the heat value corresponding to the target task based on these scores. Therefore, the embodiment of the present application provides a heat value determination method, which is as follows: Figure 2 As shown, the specific steps include:
[0115] Step 201 : Taking the current time as the end point of the historical time window, and according to the historical triggering time corresponding to the target task, determine the total number of triggering times of the target task within the historical time window.
[0116] In this step, the current moment is taken as the end point of the historical time window. According to the historical trigger moment corresponding to the target task, the historical trigger moment within the historical time window is determined, the number of these historical trigger moments is counted, and the number is determined as the total number of triggers of the target task within the historical time window.
[0117] Step 202: Determine a first score based on the total number of triggers.
[0118] In this step, the ratio of the total number of triggers to a preset value can be calculated, and the ratio can be normalized to obtain a processing result, which is used to determine the first score. The preset value can be the maximum value of all total trigger times, the sum of all total trigger times, or a value set by a technician based on experience, which is not limited here.
[0119] Step 203: Determine a second score based on the number of times the target task is triggered within each preset time period.
[0120] In this step, the weight corresponding to each preset time period can be directly obtained and multiplied by the number of triggers in the corresponding preset time period to obtain the result corresponding to each preset time period. These results are added together to obtain the sum of these results, and the sum is normalized to obtain the second score. Alternatively, after obtaining the sum of these results, the ratio of the sum to the total number of triggers can be calculated and the ratio is normalized to obtain the second score.
[0121] Step 204 : Determine a third score based on the current time and the target time corresponding to the last triggering of the target task.
[0122] The target time is the time when the target task is last triggered, that is, the time closest to the current time in its historical triggering time.
[0123] In this step, the interval duration between the current moment and the target moment may be determined, and the third score may be determined based on the interval duration. For example, the third score may be determined using a decay function and the interval duration.
[0124] Step 205 : Determine the heat value corresponding to the target task based on the first score, the second score, and the third score.
[0125] In this step, the first, second, and third scores can be added together to determine the popularity value corresponding to the target task. Since each score has different importance, a corresponding weight is set for each score. The first score and the corresponding weight are multiplied together to obtain a first result, the second score and the corresponding weight are multiplied together to obtain a second result, and the third score and the corresponding weight are multiplied together to obtain a third result. The first, second, and third results are added together to determine the popularity value corresponding to the target task.
[0126] For example, according to the formula H = α*F + β*W + γ*D, α, β, and γ are weight coefficients used to balance the influence of different dimensions. For example, α is set to 0.4, β is set to 0.3, and γ is set to 0.3. F is the first score, W is the second score, D is the third score, and H is the popularity value. When F = 0.7, W = 0.57, and D = 0.74, the popularity value H = 0.4*0.7 + 0.3*0.57 + 0.3*0.74 = 0.673.
[0127] In the embodiment of the present application, when the total number of triggering times of a task is higher, its triggering frequency is higher, indicating that the task is a high-frequency task, and its corresponding first score is higher. When the total number of triggering times of a task is lower, its triggering frequency is lower, indicating that the task is a low-frequency task, and its corresponding first score is lower. Therefore, the embodiment of the present application provides a method for determining the first score, which is as follows: Figure 3 As shown, the specific steps include:
[0128] Step 301: determine the maximum total triggering count from the total triggering counts of all target tasks.
[0129] In this step, by comparing the total triggering times of all target tasks, the maximum value of the total triggering times is determined and determined as the maximum total triggering time.
[0130] Step 302: Determine a first score based on the total number of triggers and the maximum total number of triggers.
[0131] In this step, a ratio of the total number of triggers to the maximum total number of triggers is determined, and the ratio is determined as the first score.
[0132] For example, the first score is calculated according to F = N / N_max, where F is the first score, N is the total number of triggers, and N_max is the maximum total number of triggers. For example, if the total number of triggers for a task is 14 and the maximum total number of triggers N_max is 20, then the first score F = 14 / 20 = 0.7.
[0133] In the implementation of this application, the preset weight corresponding to each preset time period can also be obtained, and the second score is determined according to the number of triggering times of the target task in each preset time period and the preset weight corresponding to each preset time period. Therefore, this embodiment of the application provides a second score determination method, which is as follows: Figure 4 As shown, the specific steps include:
[0134] Step 401: Obtain the preset weight corresponding to each preset time period.
[0135] A day is divided into multiple time periods, such as morning peak, noon, evening peak, and night. Because the system's idleness varies in different time periods, a weight can be assigned to each preset time period to more accurately assess resource availability.
[0136] In this step, the preset weight corresponding to each preset time period is pre-stored. When this step needs to be performed, the preset weight corresponding to each preset time period can be obtained.
[0137] Step 402 : Determine a second score based on the number of times the target task is triggered in each preset time period and the preset weight corresponding to each preset time period.
[0138] In this step, the number of triggers corresponding to the same preset period is multiplied by the preset weight to obtain the result corresponding to the preset period. The results corresponding to each preset period are added together, and the ratio of the added result to the total number of triggers is calculated and normalized to obtain the second score.
[0139] For example, the ratio W is (Σni*wi) / (Σni), where ni is the number of times the task is triggered during the i-th preset period, wi is the weight of the i-th preset period, and W is the normalized value. If the task is triggered 10 times during the morning rush hour (weight 1.2) and 5 times during the night (weight 0.8), then W = (10*1.2+5*0.8) / 15 = (12+4) / 15 = 1.07.
[0140] In practice, the W value is required to be between [0.5 and 1.5]. To facilitate uniform model comparison and normalization, it can be normalized to the interval [0, 1] using the following formula: Second score W_normalized = (W - W_min) / (W_max - W_min), where W_min is the minimum value of all second scores, W_max is the maximum value of all second scores, and W_normalized is the second score. For example, W_min = 0.5 and W_max = 1.5. For W = 1.07, W_normalized = (1.07 - 0.5) / (1.5 - 0.5) = 0.57 / 1 = 0.57.
[0141] In the embodiment of the present application, as time goes by, the reference value of the historical trigger data of the task to the current scheduling will gradually decrease, and the interval between the current moment and the last trigger moment cannot accurately reflect the actual activity level of the task in the recent period. Therefore, the present application can determine the target interval between the target moment and the current moment, and determine the third score based on the target interval and the preset attenuation coefficient. Therefore, the embodiment of the present application provides a method for determining the third score, which is as follows: Figure 5 As shown, the specific steps include:
[0142] Step 501: Determine the target interval duration between the target time and the current time.
[0143] In this step, the time interval from the target time to the current time is calculated and recorded as the target interval duration.
[0144] Step 502: Determine a third score based on the target interval duration and a preset attenuation coefficient.
[0145] Among them, the attenuation coefficient is set by technicians based on experience, generally 0.1
[0146] In this step, the target interval duration and the preset attenuation coefficient are substituted into the preset formula to obtain the third score. The preset formula is D = e (-λ*Δt) , where D is the third score, λ is the decay coefficient, and Δt is the target interval duration.
[0147] In an embodiment of the present application, if the target task is a task that meets the pre-start conditions, the target task with the highest start priority is selected among the target tasks, and it is determined whether the idle resources can accommodate the target task; if it can be accommodated, the target task with the second highest priority is continued to be selected, and it is re-determined whether the idle resources can accommodate the selected target task; the above steps are repeated until the newly added task causes insufficient resources; finally, based on the selected target task before the last selection, the corresponding operating environment is pre-started.
[0148] In addition, if the target task is an unscreened task, that is, the target task is all tasks that the system has already run but need to run again, the present application can also first select the target task with the highest startup priority and that meets the pre-start conditions among the target tasks, and judge whether the idle resources can accommodate the target task; if it can be accommodated, continue to select the target task with the second highest priority and that meets the pre-start conditions, and re-judge whether the idle resources can accommodate the selected target task; repeat the above steps until the newly added task causes insufficient resources; finally, based on the selected target task before the last selection, pre-start the corresponding operating environment. Therefore, an embodiment of the present application provides a task screening method, such as Figure 6 As shown, the specific steps include:
[0149] Step 601 : According to the startup priority corresponding to each target task, N target tasks with the highest startup priority and meeting the pre-start condition are selected as the first task.
[0150] The pre-start conditions are as described in step 101 and will not be described in detail here.
[0151] In this step, since the execution of this application presupposes sufficient idle resources in the system, whether the initial number of tasks N = 1 or N = 2 does not affect the subsequent process. Specifically, when N starts at 1, a target task with the highest startup priority and that meets the pre-start conditions is initially selected and determined as the first task. Because the system has sufficient resources, the idle resources must meet the resource requirements of the first task, so N is updated to N + 1 and step 601 is re-executed. Afterwards, two target tasks with the highest startup priority and that meet the pre-start conditions are selected as the first tasks, and the subsequent steps are executed.
[0152] To deal with exceptions, you can also set up protection logic: if it is detected that the amount of idle resources is not greater than the amount of resources required for the task when N=1, an alarm is generated to notify relevant personnel to handle it.
[0153] Step 602 : Determine the total amount of resources required by the N first tasks based on the amount of resources required by each first task, and compare the total amount of resources with the amount of free resources.
[0154] In this step, metadata corresponding to each first task is obtained and analyzed to determine its required resource amount, thereby obtaining the resource amount required by all first tasks. The resource amount required by each first task is then added together to obtain the total resource amount required by all first tasks. Finally, the current amount of free resources is obtained and the total resource amount is compared with the free resource amount.
[0155] Step 603: When the amount of free resources is greater than the total amount of resources, N is updated, and the N updated target tasks with the highest startup priority and meeting the pre-start conditions are selected as the first tasks, and the step of determining the total amount of resources required for the N first tasks is re-executed.
[0156] Among them, the updated N is N+1.
[0157] In this step, when the amount of idle resources is greater than the total amount of resources, it means that there are still idle resources available. Therefore, N is updated to N+1, and N target tasks with the highest startup priority and meeting the pre-start conditions are reselected and determined as the first task, and step 603 is executed until the idle resources are no greater than the total amount of resources.
[0158] Step 604: When the amount of free resources is not greater than the total amount of resources, N is updated, and the updated N target tasks with the highest start priority and meeting the pre-start conditions are selected as the first task to pre-start the operating environment required by the first task.
[0159] Among them, the updated N is N-1.
[0160] In this step, when the amount of idle resources is not greater than the total amount of resources, it means that the Nth task cannot be started. Therefore, it can only be determined as the first task based on the N-1 target tasks with the highest startup priority and meeting the pre-start conditions, and the operating environment required for the first task is pre-started.
[0161] If the target task is an unscreened task, this application can first select the target task that meets the pre-start condition from the target tasks and determine it as the second task, and then select the first task from these second tasks based on the idle resources and startup priority, and then pre-start the operating environment of the first task.
[0162] In an embodiment of the present application, when the pre-start condition is that the container image of the operating environment is consistent with the container image of the task, whether the container image of the target task is consistent with the container image of the operating environment can be determined by analyzing whether the dependency feature value required by the target task matches the dependency feature value in the operating environment, or whether the container image identifier corresponding to the target task matches the container image identifier corresponding to the operating environment, or other methods. If the two are consistent, it is determined that the target task meets the pre-start condition; otherwise, it is determined that the target task does not meet the pre-start condition.
[0163] When the pre-start condition is the expected trigger time of the task that is about to arrive, the expected trigger time corresponding to the target task can be determined based on the historical trigger time corresponding to the target task, and then the expected trigger time from the current time to the expected trigger time is determined. If the expected trigger time is relatively short, it is determined that the target task meets the pre-start condition. If the expected trigger time is relatively long, it is determined that the target task does not meet the pre-start condition. Therefore, the embodiment of the present application provides a task detection method, which is as follows: Figure 7 As shown, the specific steps include:
[0164] Step 701: Determine the expected triggering time corresponding to the target task based on the historical triggering time corresponding to the target task.
[0165] In this step, for a target task, the triggering rule is determined based on its corresponding historical triggering time, and then the expected triggering time is determined based on the triggering rule. For example, if the triggering time of a task is always 9:00 am, 9:00 am every day can be determined as the expected triggering time.
[0166] Step 702: Determine the expected trigger duration based on the expected trigger time and the current time.
[0167] In this step, the duration from the current moment to the expected trigger moment is determined, and the duration is determined as the expected trigger duration.
[0168] Step 703: When the estimated trigger duration is less than the preset duration, it is determined that the target task meets the pre-start condition.
[0169] The preset time length is set by the technician based on experience. Specifically, the preset time length can be set to 5 minutes.
[0170] Step 704: When the estimated trigger duration is not less than the preset duration, it is determined that the target task does not meet the pre-start condition.
[0171] Furthermore, when the pre-start condition is that the container image of the running environment is consistent with the container image of the task and the expected trigger time of the task is about to arrive, when the container image of the running environment is consistent with the container image of the task and the expected trigger time of the task is about to arrive, it is determined that the target task meets the pre-start condition; otherwise, it is determined that the target task does not meet the pre-start condition.
[0172] In addition, the system can also set up a failure judgment mechanism (TTL Cleaner), that is, according to the startup time of the operating environment and the length of the effective time window, calculate its expiration time. If no task hits the operating environment when the expiration time is reached, the relevant resources will be automatically released. Therefore, the embodiment of the present application provides a failure detection method, such as Figure 8 As shown, the specific steps include:
[0173] Step 801: Determine the valid time window corresponding to the operating environment according to the startup time of the operating environment and the length of the valid time window.
[0174] At the end of this step, the startup time of the operating environment is obtained, the startup time is determined as the starting point of the valid time window, and the length of the valid time window is extended backward to obtain the valid time window corresponding to the operating environment.
[0175] Step 802: within the valid time window, check whether there is a hit target task in the running environment.
[0176] The target task is a task running in the pre-startup running environment.
[0177] In this step, for a certain pre-started operating environment, it is detected whether there is a hit target task in the operating environment within a preset time window.
[0178] Step 803: When there is no hit target task in the execution environment, the resources used by the execution environment are released and the execution environment is closed.
[0179] At the same time, the popularity of each task can also be adjusted based on the number of misses. For example, the number of misses for the task within a preset time period is determined, and a target value is determined based on the number of misses. The popularity of the task is then reduced by the target value. For example, if there is one miss, the popularity value is reduced by 0.1.
[0180] like Figure 9 As shown, an embodiment of the present application provides a task initiation device, which corresponds to the method embodiment and specifically includes:
[0181] An acquisition unit 901 is used to acquire the historical triggering time corresponding to each target task;
[0182] A first determining unit 902 is configured to determine, for each target task, a heat value corresponding to the target task based on a current time and a historical trigger time corresponding to the target task;
[0183] The second determining unit 903 is configured to determine the startup priority corresponding to each target task according to the heat value corresponding to each target task;
[0184] The pre-start unit 904 is configured to pre-start the operating environment required by the target task according to the start priority.
[0185] Optionally, the first determining unit 902 is configured to:
[0186] Taking the current moment as the end point of the historical time window, determining the total number of triggering times of the target task within the historical time window;
[0187] Determining a first score according to the total number of triggers;
[0188] Determining a second score based on the number of times the target task is triggered within each preset time period;
[0189] determining a third score based on the current moment and a target moment corresponding to the last triggering of the target task;
[0190] A popularity value corresponding to the target task is determined according to the first score, the second score, and the third score.
[0191] Optionally, the first determining unit 902 is configured to:
[0192] Determine the maximum total trigger count from the total trigger counts of all target tasks;
[0193] A first score is determined according to the total number of triggering times and the maximum total number of triggering times.
[0194] Optionally, the first determining unit 902 is configured to:
[0195] Get the preset weight corresponding to each preset time period;
[0196] A second score is determined according to the number of times the target task is triggered in each preset time period and a preset weight corresponding to each preset time period.
[0197] Optionally, the first determining unit 902 is configured to:
[0198] Determining a target interval duration between the target moment and the current moment;
[0199] A third score is determined according to the target interval duration and a preset attenuation coefficient.
[0200] Optionally, the pre-start unit 904 is configured to:
[0201] According to the startup priority corresponding to each target task, select N target tasks with the highest startup priority and meeting the pre-start conditions as the first task;
[0202] Determine the total amount of resources required by N first tasks based on the amount of resources required by each first task, and compare the total amount of resources with the amount of free resources;
[0203] When the amount of free resources is greater than the total amount of resources, N is updated, and the updated N target tasks with the highest start priority and meeting the pre-start condition are selected as the first tasks, and the step of determining the total amount of resources required by the N first tasks is re-executed, where the updated N is N+1;
[0204] When the amount of idle resources is not greater than the total amount of resources, N is updated, and the updated N target tasks with the highest startup priority and meeting the pre-start conditions are selected as the first task, and the operating environment required for the first task is pre-started, where the updated N is N-1.
[0205] Optionally, the apparatus further includes a third determining unit 905, wherein the third determining unit 905 is configured to:
[0206] Determining the expected triggering time corresponding to the target task based on the historical triggering time corresponding to the target task;
[0207] Determining an estimated trigger duration based on the estimated trigger time and the current time;
[0208] When the estimated triggering duration is less than the preset duration, determining that the target task meets the pre-starting condition;
[0209] When the estimated triggering duration is not less than the preset duration, it is determined that the target task does not meet the pre-starting condition.
[0210] Optionally, the apparatus further includes a detection unit 906, wherein the detection unit 906 is configured to:
[0211] Determining the valid time window corresponding to the operating environment according to the startup time of the operating environment and the length of the valid time window;
[0212] Within the valid time window, detecting whether there is a hit target task in the operating environment;
[0213] When there is no hit target task in the operating environment, the resources used by the operating environment are released and the operating environment is closed.
[0214] like Figure 10 As shown, the embodiment of the present application provides a task initiation device, including a processor 1001, a communication interface 1002, a memory 1003 and a communication bus 1004, wherein the processor 1001, the communication interface 1002, and the memory 1003 communicate with each other through the communication bus 1004.
[0215] Memory 1003, used for storing computer programs;
[0216] In one embodiment of the present application, the processor 1001 is configured to implement the task initiation method provided by any of the aforementioned method embodiments when executing a program stored in the memory 1003, including:
[0217] Get the historical triggering time corresponding to each target task;
[0218] For each target task, determine the heat value corresponding to the target task based on the current time and the historical trigger time corresponding to the target task;
[0219] Determine the startup priority of each target task based on the heat value corresponding to each target task;
[0220] Pre-starting the operating environment required by the target task according to the startup priority.
[0221] An embodiment of the present application further provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the steps performed by the task initiation method provided in any of the aforementioned method embodiments are implemented.
[0222] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of the modules may be selected based on actual needs to achieve the objectives of this embodiment.
[0223] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus a general hardware platform, or of course, by hardware. Based on this understanding, the above technical solution, in essence, or the part that contributes to the relevant technology, can be embodied in the form of a software product. The computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a magnetic disk, an optical disk, etc., and includes a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or certain parts of the embodiment.
[0224] It should be understood that the terms used herein are for the purpose of describing specific example embodiments only and are not intended to be limiting. Unless the context clearly indicates otherwise, the singular forms "one", "an" and "said" as used herein may also be meant to include plural forms. The terms "comprise", "include", "contain" and "have" are inclusive and therefore specify the presence of stated features, steps, operations, elements and / or parts, but do not exclude the presence or addition of one or more other features, steps, operations, elements, parts, and / or combinations thereof. The method steps, processes, and operations described herein are not to be construed as necessarily requiring them to be performed in the specific order described or illustrated, unless the order of execution is clearly indicated. It should also be understood that additional or alternative steps may be used.
[0225] The foregoing description is intended only to provide specific embodiments of the present invention, which will enable those skilled in the art to understand and implement the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention is not intended to be limited to the embodiments shown herein, but is intended to be accorded the widest scope consistent with the principles and novel features claimed herein.
Claims
1. A task starting method, characterized in that: The method comprises: Get the historical triggering time corresponding to each target task; For each target task, determine the heat value corresponding to the target task based on the current time and the historical trigger time corresponding to the target task; Determine the startup priority of each target task based on the heat value corresponding to each target task; Pre-starting the operating environment required by the target task according to the startup priority.
2. The method according to claim 1, characterized in that The determining of the heat value corresponding to the target task according to the current time and the historical trigger time corresponding to the target task includes: Taking the current moment as the end point of the historical time window, and according to the historical triggering moment corresponding to the target task, determining the total number of triggering times of the target task within the historical time window; Determining a first score according to the total number of triggers; Determining a second score based on the number of times the target task is triggered within each preset time period; determining a third score based on the current moment and a target moment corresponding to the last triggering of the target task; A popularity value corresponding to the target task is determined according to the first score, the second score, and the third score.
3. The method according to claim 2, characterized in that Determining a first score according to the total number of triggers includes: Determine the maximum total trigger count from the total trigger counts of all target tasks; A first score is determined according to the total number of triggering times and the maximum total number of triggering times.
4. The method according to claim 2, characterized in that The determining of the second score according to the number of times the target task is triggered within each preset time period includes: Get the preset weight corresponding to each preset time period; A second score is determined according to the number of times the target task is triggered in each preset time period and a preset weight corresponding to each preset time period.
5. The method according to claim 2, characterized in that: The determining of a third score according to the current moment and the target moment corresponding to the last triggering of the target task includes: Determining a target interval duration between the target moment and the current moment; A third score is determined according to the target interval duration and a preset attenuation coefficient.
6. The method according to claim 1, characterized in that Pre-starting the operating environment required for the target task according to the startup priority includes: According to the startup priority corresponding to each target task, select N target tasks with the highest startup priority and meeting the pre-start conditions as the first task; Determine the total amount of resources required by N first tasks based on the amount of resources required by each first task, and compare the total amount of resources with the amount of free resources; When the amount of free resources is greater than the total amount of resources, N is updated, and the updated N target tasks with the highest start priority and meeting the pre-start condition are selected as the first tasks, and the step of determining the total amount of resources required by the N first tasks is re-executed, where the updated N is N+1; When the amount of idle resources is not greater than the total amount of resources, N is updated, and the updated N target tasks with the highest startup priority and meeting the pre-start conditions are selected as the first task, and the operating environment required for the first task is pre-started, where the updated N is N-1.
7. The method according to claim 6, characterized in that The specific steps of detecting whether the target task meets the pre-start condition include: Determining the expected triggering time corresponding to the target task based on the historical triggering time corresponding to the target task; Determining an estimated trigger duration based on the estimated trigger time and the current time; When the estimated triggering duration is less than the preset duration, determining that the target task meets the pre-starting condition; When the estimated triggering duration is not less than the preset duration, it is determined that the target task does not meet the pre-starting condition.
8. The method according to claim 1, characterized in that: After pre-starting the operating environment required by the target task, the method further includes: Determining the valid time window corresponding to the operating environment according to the startup time of the operating environment and the length of the valid time window; Within the valid time window, detecting whether there is a hit target task in the operating environment; When there is no hit target task in the operating environment, the resources used by the operating environment are released and the operating environment is closed.
9. A task starting device, characterized in that: The device comprises: An acquisition unit, used to obtain the historical triggering time corresponding to each target task; A first determining unit is configured to determine, for each target task, a heat value corresponding to the target task according to a current time and a historical trigger time corresponding to the target task; A second determining unit is used to determine the startup priority corresponding to each target task according to the heat value corresponding to each target task; A pre-start unit is used to pre-start the operating environment required by the target task according to the startup priority.
10. A task starting device, characterized in that: include: at least one communication interface; at least one bus connected to the at least one communication interface; at least one processor connected to the at least one bus; at least one memory connected to the at least one bus, wherein the processor is configured to: Get the historical triggering time corresponding to each target task; For each target task, determine the heat value corresponding to the target task based on the current time and the historical trigger time corresponding to the target task; Determine the startup priority of each target task based on the heat value corresponding to each target task; Pre-starting the operating environment required by the target task according to the startup priority.
11. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the task starting method according to any one of claims 1 to 8 is implemented.