Automatic script execution method and system, server, medium and program product

By dynamically adjusting the timeout time and automatic retry mechanism, the problem of poor script execution flexibility and inefficiency caused by fixed timeout time and manual intervention is solved, and a higher script execution reliability and success rate is achieved.

CN120353543AActive Publication Date: 2025-07-22INSPUR SUZHOU INTELLIGENT TECH CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202510864410.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-25
Publication Date
2025-07-22
Estimated Expiration
2045-06-25

AI Technical Summary

Technical Problem

In the prior art, script execution methods with fixed timeout and manual intervention are poor in flexibility, inefficient and costly when facing network fluctuations or response delays, resulting in insufficient reliability and success rate of script execution.

Method used

By obtaining network delay and packet loss rate indicators, the timeout time is dynamically adjusted, and automatically retry when script execution fails, combining the network status and target terminal response, the timeout time dynamic adjustment management and retry mechanism is adopted to improve the flexibility and success rate of script execution.

Benefits of technology

It effectively avoids script execution failure caused by network fluctuations or response delays, improves the reliability and success rate of script execution, and reduces the cost and complexity of manual intervention.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120353543A_ABST
    Figure CN120353543A_ABST
Patent Text Reader

Abstract

The invention discloses an automatic script execution method and system, a server, a medium and a program product, and relates to the technical field of computers, and the method comprises the steps: dynamically adjusting the timeout time of script execution according to the current network state and the response condition of a target terminal through a timeout time dynamic adjustment management and retry mechanism; and automatic retry is carried out when execution fails, so that script execution failure caused by network fluctuation or response delay is avoided, and the reliability and success rate of script execution are improved. Therefore, the problems that the flexibility is poor, the efficiency is low and the cost is high due to the fact that the fixed timeout time and the technical means of manual intervention are used for executing scripts in related technologies are solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular, to an automated script execution method, system, server, medium, and program product. Background Art

[0002] During the execution of an automated management script, network latency or slow response from the BMC (Baseboard Management Controller) may cause the script execution to time out, resulting in test case failures. This not only affects the reliability of script execution but also increases the management complexity.

[0003] In related technologies, static timeout settings and manual intervention are usually used to address script execution exception problems. Specifically, static timeout setting means that before the script execution, a fixed time threshold is artificially set as the timeout time. If the execution time of the script exceeds this preset timeout time, the system determines that the script execution has timed out and takes corresponding measures (such as interrupting the execution, recording error logs, etc.). However, this method may lead to unnecessary timeout judgments or missing real timeout problems. When the script execution times out or fails, the system needs to rely on testers or managers to manually intervene to find the cause of the problem and handle it. This method requires high labor costs and time costs and is prone to introducing human errors. In the face of large-scale or high-concurrency test scenarios, the efficiency of manual intervention will be severely limited. Summary of the Invention

[0004] This application provides an automated script execution method, system, server, medium, and program product to at least solve the problems of poor flexibility, low efficiency, and high cost in the technical means of setting a fixed timeout time and manual intervention in related technologies.

[0005] This application provides an automated script execution method, including: before the automated script execution, obtaining the network latency index and packet loss rate index of the current network data. Determining the current network status according to the network latency index and packet loss rate index, and determining the initial timeout time of the automated script based on the current network status; executing the automated script with the initial timeout time as a limiting condition, and obtaining the response duration of the target terminal during the execution of the automated script, and adjusting the initial timeout time according to the response duration.

[0006] The present application also provides an automated script execution system, including: a network monitoring module for monitoring the network latency metric and packet loss rate metric of current network data; a monitoring module for monitoring the response duration of a target terminal during the execution of an automated script; a timeout management module for predicting a target timeout time according to historical execution time data, network latency metric, packet loss rate metric, and response duration; a retry mechanism module for performing a target processing action according to the error type during the execution of an automated script when the execution status of the automated script is a failure status; a log collection module for collecting execution results into a script log or a machine log after the execution of the automated script ends.

[0007] The present application also provides a server, including: a memory for storing a computer program; a processor for implementing the steps of any of the above-mentioned automated script execution methods when executing the computer program.

[0008] The present application also provides a computer-readable storage medium storing a computer program, wherein the computer program implements the steps of any of the above-mentioned automated script execution methods when executed by a processor.

[0009] The present application also provides a computer program product including a computer program, and the computer program implements the steps of any of the above-mentioned automated script execution methods when executed by a processor.

[0010] By dynamically adjusting the management of the timeout time and the retry mechanism in the embodiments of the present application, the timeout time for script execution can be dynamically adjusted according to the current network status and the response of the target terminal, and automatic retry can be performed when the execution fails, thereby avoiding the failure of script execution caused by network fluctuations or response delays, and improving the reliability and success rate of script execution. Thus, the problems of poor flexibility, low efficiency, and high cost in the related art of setting a fixed timeout time and performing scripts by means of manual intervention are solved. BRIEF DESCRIPTION OF THE DRAWINGS

[0011] To more clearly illustrate the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.

[0012] Figure 1 It is a flowchart of an automated script execution method provided by an embodiment of the present application; Figure 2 It is a schematic diagram of an automated script execution system provided by an embodiment of the present application; Figure 3Block diagram of an automated script execution device provided by an embodiment of the present application. Detailed implementation manners

[0013] Next, the technical solutions in the embodiments of the present application will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present application.

[0014] It should be noted that in the description of the present application, the terms "include", "comprise" or any other variant thereof are intended to cover a non-exclusive inclusion, so that a process, method, article or device including a series of elements not only includes those elements but also includes other elements not expressly listed, or further includes elements inherent to such process, method, article or device. The terms "first", "second", etc. in the present application are used to distinguish similar objects and are not used to describe a specific order or sequence.

[0015] To enable those skilled in the art of the present technology to better understand the solution of the present application, the present application will be further described in detail below in conjunction with the accompanying drawings and specific implementation manners.

[0016] An embodiment of the present application provides an automated script execution method. In conjunction with the execution process of the automated script execution method, the method will be described in detail, as Figure 1 shown, including the following steps: In step S101, before the automated script is executed, obtain the network delay index and packet loss rate index of the current network data.

[0017] In an embodiment of the present application, obtaining the packet loss rate index and network delay index of the current network data includes: sending a preset number of data packets to a target terminal, where the target terminal generates a response signal for the data packets; determining the number of lost data packets according to the response signal of the data packets, and determining the packet loss rate index of the current network data according to the number of lost data packets; sending an echo request to the target terminal, where the target terminal receives the echo request and generates a response signal; calculating the round-trip time from sending the echo request to receiving the response signal, and determining the network delay index of the current network data according to the round-trip time.

[0018] It can be understood that before the automated script is officially executed, the embodiment of the present application can detect the network connection status between the current and the target terminal (such as BMC) to obtain key performance indicators reflecting the current network quality, including the network delay index and the packet loss rate index, and can comprehensively master the current network environment status before the script is executed, providing key input information for subsequent timeout control.

[0019] Specifically, for the network latency metric, embodiments of the present application can send one or more echo requests to a target terminal (such as a BMC management interface), for example, using the Ping command in the ICMP protocol; after receiving the echo request, the target terminal returns a corresponding response signal (i.e., an Echo Reply); during the actual execution process, embodiments of the present application can record the time difference between sending the echo request and receiving the echo reply, which is the round-trip time; to further ensure the accuracy of the data, embodiments of the present application can calculate the average round-trip time based on multiple measurement results as a comprehensive metric for measuring the current network latency level.

[0020] For the packet loss rate metric, embodiments of the present application can send a preset number of data packets to the target terminal (for example, continuously send 5 ICMP data packets); at the same time, listen for the response signals returned by the target terminal, count the number of actually received response data packets, and can calculate the packet loss rate metric through the following formula: Packet loss rate = (Number of data packets not received / Total number of data packets sent) × 100%.

[0021] In step S102, determine the current network state based on the network latency metric and the packet loss rate metric, and determine the initial timeout time of the automation script based on the current network state.

[0022] After obtaining the network latency metric and the packet loss rate metric based on the above embodiments, embodiments of the present application can further comprehensively evaluate the current network state and dynamically set the initial timeout time during the execution of the automation script. For example, when the network state is poor, appropriately extend the timeout time; when the network state is good, shorten the timeout time to improve the adaptability and stability of the script execution.

[0023] Specifically, embodiments of the present application can divide the current network state into multiple levels (such as excellent, good, poor) according to the network latency metric and the packet loss rate metric. For example, when the network latency range is less than 50 ms or the packet loss rate range is less than 1%, embodiments of the present application can determine that the current network state is excellent.

[0024] Furthermore, embodiments of the present application can dynamically calculate the initial timeout time based on the current network state level. Specifically, embodiments of the present application can initialize the default timeout time before the script execution, for example, set it to 30 seconds. According to the current network state level, set different timeout coefficient factors (such as excellent: 0.6; good: 0.8; poor: 1.2); the actual initial timeout time = default timeout time × timeout coefficient factor; for example, if the default timeout time is 30 seconds and the current network state is "medium", the initial timeout time is 24 seconds.

[0025] In step S103, an automated script is executed with the initial timeout as a limiting condition, and the response duration of the target terminal during the execution of the automated script is obtained, and the initial timeout is adjusted according to the response duration.

[0026] It can be understood that during the execution of the script, the embodiments of the present application can perform execution control based on the initial timeout, and also collect the actual response durations of the target terminal (such as BMC) at each key operation node in real time. Based on these dynamic feedback data, the timeout setting in the subsequent stage is adaptively adjusted, so as to achieve more refined and intelligent script execution control. Thus, the embodiments of the present application not only consider the influence of historical execution data, but also comprehensively consider the current network state and real-time response behavior, can adapt to different network environments and response situations, and effectively improve the execution success rate and stability of the automated script in the case of unstable network.

[0027] In the actual execution process, the embodiments of the present application can record the sending time and response time of the command during the execution of the script, and calculate the response duration. The embodiments of the present application flexibly adjust the timeout setting according to the response duration.

[0028] In an embodiment of the present application, adjusting the initial timeout according to the response duration includes: obtaining the historical execution time data of the automated script and the current monitoring data, where the current monitoring data is the network delay index and packet loss rate index when executing the automated script; predicting the target timeout according to the historical execution time data, response duration, network delay index and packet loss rate index when executing the automated script; adjusting the initial timeout according to the target timeout.

[0029] Among them, the historical execution time data refers to the operation time-consuming during multiple previous executions of the automated script, and the current monitoring data is the network delay index and packet loss rate index when executing the automated script.

[0030] Specifically, predicting the target timeout according to the historical execution time data, response duration, network delay index and packet loss rate index when executing the automated script includes: calculating the weighted average value of the historical execution time data based on the weighted moving average algorithm; converting the packet loss rate index into additional delay time, and setting the first to third weight coefficients for the network delay index, additional delay time and response duration respectively; calculating the target timeout based on the weighted average value, additional delay time, network delay index, response duration, and the first to third weight coefficients.

[0031] Among them, the calculation formula of the weighted moving average algorithm is:

[0032] Among them, is the quantity of historical execution time data, is the weight of the th historical execution time data. is the execution time of the

[0033] Since packet loss will cause behaviors such as retransmission and waiting, affecting the overall response efficiency, the system converts the packet loss rate into an additional delay time for correcting the prediction result. Among them, converting the packet loss rate index into an additional delay time includes: obtaining the correspondence table between the packet loss rate index and the additional delay time; determining the additional delay time when executing the automation script according to the correspondence table and the packet loss rate index.

[0034] Among them, the correspondence table can be pre-calibrated through multiple experiments. In the embodiment of the present application, after obtaining the packet loss rate index, the additional delay time corresponding to the packet loss rate index can be accurately determined based on the correspondence table between the packet loss rate index and the additional delay time. For example, a packet loss rate of 5% can correspond to an additional delay time of 2 seconds, and a packet loss rate of 10% can correspond to an additional delay time of 5 seconds.

[0035] Furthermore, the embodiment of the present application can respectively set the first to third weight coefficients for the network delay index, the additional delay time, and the response duration; calculate the target timeout time based on the weighted average, the additional delay time, the network delay index, the response duration, and the first to third weight coefficients. The calculation formula of the target timeout time is:

[0036] Among them, is the adjustment coefficient, is the additional delay time corresponding to the first weight coefficient, is the network delay index corresponding to the second weight coefficient, is the response duration corresponding to the third weight coefficient.

[0037] For example, if there are 3 pieces of historical execution time data, which are the first one: execution time 10 seconds, weight 0.5; the second one: execution time 12 seconds, weight 0.3; the third one: execution time 10 seconds, weight 0.2; based on these data, the embodiment of the present application can calculate the weighted average to be 10.6 seconds.

[0038] Further, if the network latency metric (RTT) is 15 ms, the packet loss rate metric is 5%, and the response duration is 5 seconds, the embodiment of the present application can determine the corresponding additional delay time of 2 seconds through the correspondence table between the packet loss rate and the additional delay time. Set the additional delay time weight a = 0.4, the network latency weight b = 0.1, the response duration weight c = 0.3, and the adjustment coefficient k = 0.5, where k is used to control the adjustment range (such as 0.5 - 2, which can be optimized through experiments). Substituting into the formula for calculating the target timeout in the above embodiment, we get Approximately 22.8 seconds.

[0039] In some embodiments, the embodiment of the present application can also set a maximum timeout threshold and a minimum timeout threshold, and compare the calculated target timeout with the maximum timeout threshold and the minimum timeout threshold. If the calculated target timeout is greater than the maximum timeout threshold, then take the maximum timeout threshold as the final target timeout. If the calculated target timeout is less than or equal to the maximum timeout threshold, then take the calculated target timeout. If the calculated target timeout is less than the minimum timeout threshold, then take the minimum timeout threshold. Thus, the final target timeout = max(minimum value, min(maximum timeout threshold, calculated target timeout)). Therefore, the embodiment of the present application avoids excessive adjustment by setting thresholds.

[0040] In an embodiment of the present application, after adjusting the initial timeout according to the response duration, it further includes: detecting the execution status of the automation script; if the execution status is a failure status, then identifying the error type during the execution of the automation script; and performing a target processing action according to the error type.

[0041] Among them, the failure status refers to the state where the script or a certain execution step thereof fails to complete as expected and cannot reach the predetermined goal. This state usually indicates that some error, exception, or unexpected behavior has occurred during the execution, resulting in the script being unable to continue running normally or returning an unexpected result.

[0042] It can be understood that after the automation script starts to execute, the embodiment of the present application can also continuously monitor its running status. When the execution status is a failure status, the embodiment of the present application can identify the error type during the execution of the automation script and perform a target processing action according to the error type. Therefore, by detecting the execution status and identifying and handling the error type when a failure occurs, the embodiment of the present application can intelligently handle various abnormal situations instead of simply aborting the entire process, effectively improving the stability and fault tolerance of the script in a complex environment.

[0043] In an embodiment of the present application, performing a target processing action according to an error type includes: if the error type is an external type, triggering a retry mechanism and re-executing an automation script according to the retry mechanism, where the external type is a temporary error caused by external factors; if the error type is an internal type, recording the execution result and not triggering the retry mechanism, where the internal type is a misalignment of the internal logic of the automation script.

[0044] Among them, the external type includes at least one of network interruption, hardware failure, and response timeout, and the internal type includes at least one of code logic error, configuration error, and script design defect.

[0045] It can be understood that if the identified error type is an external type, it can be explained that such errors are often not problems with the script itself, but are caused by environmental fluctuations, with certain recoverability and uncertainty. The embodiment of the present application can trigger the retry mechanism to re-execute the script, effectively avoiding temporary failures and improving the success rate of script execution.

[0046] If the identified error type is an internal type, it can be explained that such errors will not automatically recover over time and must be corrected by modifying the script source code, adjusting the configuration, etc. The embodiment of the present application can record the execution result (such as the timestamp when the error occurred, the specific steps or modules where the error occurred), and does not trigger the retry mechanism. Thus, unnecessary repeated execution is avoided, the debugging efficiency is improved, and it helps to quickly locate and fix script problems.

[0047] In an embodiment of the present application, re-executing the automation script according to the retry mechanism includes: obtaining the retry policy of the retry mechanism and the current number of retries, where the retry policy includes: a fixed interval retry policy and an exponential backoff retry policy; if the current number of retries is less than the preset number threshold, re-execute the automation script based on any one of the retry policies.

[0048] Among them, the preset number threshold refers to the maximum number of retries set in advance, for example, 3 times. If the maximum number of retries is exceeded, record the failure and notify the administrator.

[0049] It can be understood that when the script execution fails, the embodiments of the present application can automatically re-execute the script according to the retry mechanism. The retry policy can include fixed-interval retry and exponential backoff retry. Among them, the fixed-interval retry can be set to retry three times, with an interval of 5 seconds each time; the exponential backoff retry has an interval of 5 seconds for the first retry, 10 seconds for the second retry, and 20 seconds for the third retry. In the actual execution process, if the current retry count is greater than or equal to 3 times, the retry mechanism is not triggered, and an execution retry failure prompt is generated to notify the user that the script execution task has finally failed. Thus, the embodiments of the present application prevent waste of system resources caused by infinite loop retries by setting the maximum retry count, can actively end the task after reaching the maximum retry count, avoid long-term ineffective waiting, and at the same time generate a clear retry failure prompt message to facilitate subsequent problem location and repair.

[0050] According to the automated script execution method of the embodiments of the present application, by dynamically adjusting the management and retry mechanism through the timeout time, it is possible to dynamically adjust the timeout time of script execution according to the current network status and the response of the target terminal, and automatically retry when the execution fails, thereby avoiding script execution failures caused by network fluctuations or response delays, and improving the reliability and success rate of script execution. Thus, it solves the problems of poor flexibility, low efficiency, and high cost in the related art of setting a fixed timeout time and manually intervening technical means to execute the script.

[0051] Through the description of the above embodiments, those skilled in the art can clearly understand that the method according to the above embodiments can be implemented by means of software plus a necessary general hardware platform. Of course, it can also be implemented by hardware, but in many cases the former is a better implementation.

[0052] The embodiments of the present application also provide an automated script execution system, as Figure 2 shown, including: a network monitoring module for monitoring the network delay index and packet loss rate index of the current network data; a response monitoring module for monitoring the response duration of the target terminal during the execution of the automated script; a timeout management module for predicting the target timeout time according to the historical execution time data, network delay index, packet loss rate index, and response duration; a retry mechanism module for performing a target processing action according to the error type during the execution of the automated script when the execution status of the automated script is a failure status; a log collection module for collecting the execution result into the script log or machine log after the execution of the automated script ends.

[0053] Specifically, the network monitoring module detects the current network status before the script execution and feeds back the monitoring result to the timeout management module. For example, it detects indicators such as network delay and packet loss rate.

[0054] (1) Network status detection: Before the script execution, the network monitoring module detects the current network status, including indicators such as network latency and packet loss rate. Latency detection: Send an ICMP echo request (ping) to the target server and measure the round-trip time (RTT). Packet loss rate detection: Send a certain number of data packets and calculate the number of lost data packets.

[0055] (2) Feedback mechanism: Feed back the detection results to the timeout management module. For example, if the network latency exceeds 100 ms, notify the timeout management module to extend the timeout.

[0056] The response monitoring module monitors the response time of the target terminal (BMC) in real time during the script execution and feeds back the monitoring results to the timeout management module.

[0057] (1) Response time detection: During the script execution, the BMC response monitoring module monitors the response time of the BMC in real time. For example, record the sending time and response time of each BMC command and calculate the response duration.

[0058] (2) Anomaly detection: If the BMC response time exceeds the preset threshold (e.g., 30 seconds), record the anomaly and notify the timeout management module.

[0059] (3) Feedback mechanism: Feed back the monitoring results to the timeout management module. For example, if the BMC response time is long, notify the timeout management module to appropriately extend the timeout.

[0060] The timeout management module dynamically adjusts the script timeout according to the current network status and historical execution time data. For example, when the network latency is large, appropriately extend the timeout; when the network status is good, shorten the timeout.

[0061] (1) Initialization: Before the script execution, the timeout management module initializes the default timeout, for example, set it to 10 seconds.

[0062] (2) Dynamic adjustment: Dynamically adjust the timeout according to the feedback from the network monitoring module and the target response monitoring module. An adaptive algorithm can be used to adjust based on historical time execution data and current monitoring data. For example, use a weighted moving average algorithm to predict the appropriate timeout.

[0063] The retry mechanism module automatically retries the script execution when the script execution times out or fails. The number of retries and the interval time can be set according to specific situations. For example, retry three times, with a 5-second interval each time.

[0064] (1) Retry strategy: When the script execution times out or fails, the retry mechanism module automatically retries the script execution. The retry strategy can include fixed-interval retry and exponential backoff retry. Among them, the fixed-interval retry can be set to retry three times, with a 5-second interval between each retry; the exponential backoff retry has a 5-second interval for the first retry, a 10-second interval for the second retry, and a 20-second interval for the third retry.

[0065] (2) Number of retries: The retry mechanism module can set the maximum number of retries, such as 3 times. If the maximum number of retries is exceeded, record the failure and notify the user.

[0066] The retry mechanism module contains an intelligent error classification and handling mechanism to improve the efficiency and reliability of script execution, and avoid repeated retries caused by problems in the script itself, resulting in wasted time.

[0067] 1. During the script execution process, according to the error classification result, adopt corresponding processing strategies.

[0068] 2. If the error is caused by network or BMC response problems, the retry mechanism module retries. 3. If the error is caused by the script itself, record the error and stop retrying.

[0069] The log collection module collects the script log and machine log after the script ends, can record the results and error information of the script execution in detail, provides rich data support for the administrator, facilitates the administrator to analyze and handle problems, and improves the user experience and management efficiency.

[0070] In addition, the embodiment of the present application also provides an automated script execution device 10, as Figure 3 shown, including: an acquisition module 101, a determination module 102, and an adjustment module 103.

[0071] Among them, the acquisition module 101 is used to obtain the network delay index and packet loss rate index of the current network data before the automated script execution; the determination module 102 is used to determine the current network status according to the network delay index and packet loss rate index, and determine the initial timeout time of the automated script based on the current network status; the adjustment module 103 is used to execute the automated script with the initial timeout time as a limiting condition, and obtain the response duration of the target terminal during the execution of the automated script, and adjust the initial timeout time according to the response duration.

[0072] In an embodiment of the present application, the adjustment module 103 is further configured to obtain historical execution time data and current monitoring data of the automation script, where the current monitoring data is the network latency metric and packet loss rate metric when executing the automation script; predict the target timeout time according to the historical time execution data, response duration, network latency metric and packet loss rate metric when executing the automation script; and adjust the initial timeout time according to the target timeout time.

[0073] In an embodiment of the present application, the adjustment module 103 is further configured to predict the target timeout time according to the historical execution time data, response duration, network latency metric and packet loss rate metric when executing the automation script, including: calculating the weighted average value of the historical execution time data based on the weighted moving average algorithm; converting the packet loss rate metric into additional delay time, and respectively setting the first to third weight coefficients for the network latency metric, additional delay time and response duration; calculating the target timeout time based on the weighted average value, additional delay time, network latency metric, response duration, and the first to third weight coefficients.

[0074] In an embodiment of the present application, the calculation formula of the weighted moving average algorithm is:

[0075] Wherein, is the number of historical execution time data, is the weight of the th historical execution time data. is the execution time of the

[0076] In an embodiment of the present application, the calculation formula of the target timeout time is:

[0077] Wherein, is the adjustment coefficient, is the additional delay time corresponding to the first weight coefficient, is the network latency metric corresponding to the second weight coefficient, is the response duration corresponding to the third weight coefficient.

[0078] In an embodiment of the present application, the automation script execution device 10 further includes: a detection module, configured to detect the execution status of the automation script after adjusting the initial timeout time according to the response duration; an identification module, configured to identify the error type during the execution of the automation script if the execution status is a failure status; and an execution module, configured to execute the target processing action according to the error type.

[0079] In an embodiment of the present application, the execution module is further configured to trigger a retry mechanism if the error type is an external type, and re-execute the automation script according to the retry mechanism, where the external type is a temporary error caused by external factors; if the error type is an internal type, record the execution result and do not trigger the retry mechanism, where the internal type is a misalignment of the internal logic of the automation script.

[0080] In an embodiment of the present application, the external type includes at least one of network interruption, hardware failure, and response timeout, and the internal type includes at least one of code logic error, configuration error, and script design defect.

[0081] In an embodiment of the present application, the execution module is further configured to obtain the retry policy and the current number of retries of the retry mechanism, where the retry policy includes a fixed interval retry policy and an exponential backoff retry policy; if the current number of retries is less than the preset number threshold, re-execute the automation script based on any one of the retry policies.

[0082] In an embodiment of the present application, the automation script execution device 10 further includes a generation module, configured to not trigger the retry mechanism and generate a retry failure prompt if the current number of retries is greater than or equal to the preset number threshold.

[0083] In an embodiment of the present application, the acquisition module 101 is further configured to send a preset number of data packets to the target terminal, where the target terminal generates a response signal for the data packets; determine the number of lost data packets according to the response signal of the data packets, and determine the packet loss rate index of the current network data according to the number of lost data packets; send an echo request to the target terminal, where the target terminal receives the echo request and generates a response signal; calculate the round-trip time from sending the echo request to receiving the response signal, and determine the network delay index of the current network data according to the round-trip time.

[0084] In an embodiment of the present application, the adjustment module 103 is further configured to obtain a correspondence table between the packet loss rate index and the additional delay time; determine the additional delay time when executing the automation script according to the correspondence table and the packet loss rate index.

[0085] It should be noted that the description of the features in the embodiments corresponding to the automation script execution device can refer to the relevant descriptions in the embodiments corresponding to the automation script execution method, and will not be elaborated here one by one.

[0086] An automated script execution device proposed according to an embodiment of the present application can dynamically adjust the management and retry mechanism through the timeout time, dynamically adjust the timeout time for script execution according to the current network status and the response of the target terminal, and automatically retry when the execution fails, thus avoiding script execution failures caused by network fluctuations or response delays, and improving the reliability and success rate of script execution. Thereby, it solves the problems of poor flexibility, low efficiency, and high cost in the related art of executing scripts with a fixed timeout time set and manual intervention techniques.

[0087] An embodiment of the present application also provides an electronic device, including a memory and a processor. A computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above embodiments of the automated script execution method.

[0088] An embodiment of the present application also provides a computer-readable storage medium, in which a computer program is stored. The computer program is configured to execute the steps in any one of the above embodiments of the automated script execution method when running.

[0089] In an exemplary embodiment, the above computer-readable storage medium may include, but is not limited to: USB flash drives, read-only memories (ROM for short), random access memories (RAM for short), mobile hard disks, magnetic disks, or optical discs and other various media that can store computer programs.

[0090] An embodiment of the present application also provides a computer program product. The above computer program product includes a computer program, and when the computer program is executed by a processor, it implements the steps in any one of the above embodiments of the automated script execution method.

[0091] Those skilled in the art can further realize that the units and algorithm steps of each example described in combination with the embodiments disclosed herein can be implemented by electronic hardware, computer software, or a combination of the two. To clearly illustrate the interchangeability of hardware and software, the components and steps of each example have been generally described according to their functions in the above description. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present application.

[0092] The above has introduced in detail an automated script execution method provided by the present application. Specific examples are used in this article to elaborate on the principle and implementation manner of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea. It should be noted that for those of ordinary skill in the art in this technical field, without departing from the principle of the present application, several improvements and modifications can be made to the present application, and these improvements and modifications also fall within the protection scope of the claims of the present application.

Claims

1. An automated script execution method, characterized in that, Including: Before the execution of the automation script, obtain the network latency metric and packet loss rate metric of the current network data; Determine the current network state according to the network latency metric and the packet loss rate metric, and determine the initial timeout time of the automation script based on the current network state; Execute the automation script with the initial timeout time as a limiting condition, obtain the response duration of the target terminal during the execution of the automation script, and adjust the initial timeout time according to the response duration.

2. The automated script execution method according to claim 1, wherein The adjusting the initial timeout time according to the response duration includes: Obtain the historical execution time data and current monitoring data of the automation script, where the current monitoring data is the network latency metric and packet loss rate metric when executing the automation script; Predict the target timeout time according to the historical execution time data, the response duration, the network latency metric and the packet loss rate metric when executing the automation script; Adjust the initial timeout time according to the target timeout time.

3. The automated script execution method according to claim 2, wherein Predicting the target timeout time according to the historical execution time data, the response duration, the network latency metric and the packet loss rate metric when executing the automation script includes: Calculate the weighted average value of the historical execution time data based on the weighted moving average algorithm; Convert the packet loss rate metric into additional delay time, and set the first to third weight coefficients for the network latency metric, the additional delay time and the response duration respectively; Calculate the target timeout time based on the weighted average value, the additional delay time, the network latency metric, the response duration, and the first to third weight coefficients.

4. The automated script execution method according to claim 3, wherein The calculation formula of the weighted moving average algorithm is: wherein, is the quantity of historical execution time data, is the weight of the th historical execution time data; is the execution time of the th time.

5. The automated script execution method according to claim 3, wherein The calculation formula of the target timeout time is: Among them, is the adjustment coefficient, is the extra delay time The corresponding first weight coefficient, is the network delay index The corresponding second weight coefficient, is the response duration The corresponding third weight coefficient.

6. The automated script execution method according to claim 1, wherein After adjusting the initial timeout time according to the response duration, it further includes: Detect the execution status of the automation script; If the execution status is a failure status, identify the error type during the execution of the automation script; Execute the target processing action according to the error type.

7. The automated script execution method according to claim 6, characterized in that, Executing the target processing action according to the error type includes: If the error type is an external type, trigger the retry mechanism and re-execute the automation script according to the retry mechanism, where the external type is a temporary error caused by external factors; If the error type is an internal type, record the execution result and do not trigger the retry mechanism, where the internal type is a misalignment of the internal logic of the automation script.

8. The automated script execution method according to claim 7, wherein The external type includes at least one of network interruption, hardware failure, and response timeout, and the internal type includes at least one of code logic error, configuration error, and script design defect.

9. The automated script execution method according to claim 7, wherein The re-executing the automation script according to the retry mechanism includes: Obtain the retry policy of the retry mechanism and the current retry count, where the retry policy includes: fixed interval retry policy and exponential backoff retry policy; If the current retry count is less than the preset count threshold, re-execute the automation script based on any one of the retry policies.

10. The automated script execution method according to claim 9, wherein It also includes: If the current retry count is greater than or equal to the preset count threshold, the retry mechanism is not triggered, and a retry failure prompt is generated.

11. The automated script execution method according to claim 1, wherein The obtaining of the packet loss rate index and network delay index of the current network data includes: Sending a preset number of data packets to the target terminal, where the target terminal generates a response signal for the data packets; Determining the number of lost data packets according to the response signal of the data packets, and determining the packet loss rate index of the current network data according to the number of lost data packets; Sending an echo request to the target terminal, where the target terminal receives the echo request and generates a response signal; Calculating the round-trip time from sending the echo request to receiving the response signal, and determining the network delay index of the current network data according to the round-trip time.

12. An automated script execution system, characterized in that, It includes: A network monitoring module for monitoring the network delay index and packet loss rate index of the current network data; A response monitoring module for monitoring the response duration of the target terminal during the execution of the automation script; An overtime management module for predicting the target overtime time according to the historical execution time data, the network delay index, the packet loss rate index, and the response duration; A retry mechanism module for performing a target processing action according to the error type during the execution of the automation script when the execution status of the automation script is a failure status; A log collection module for collecting the execution result into the script log or machine log after the execution of the automation script ends.

13. A server, characterized in that, It includes: A memory for storing a computer program; A processor for implementing the steps of the automation script execution method according to any one of claims 1 to 11 when executing the computer program.

14. A computer-readable storage medium, characterized in that, A computer program is stored in the computer-readable storage medium, where the computer program implements the steps of the automation script execution method according to any one of claims 1 to 11 when executed by a processor.

15. A computer program product, comprising a computer program, characterized in that, The computer program implements the steps of the automation script execution method according to any one of claims 1 to 11 when executed by a processor.

Citation Information

Patent Citations

  • Household appliance communication encryption method, household appliance and server

    CN111212065A

  • Task processing method and device, equipment and storage medium

    CN119065798A

  • Network request method and device, equipment, storage medium and product

    CN119449806A

  • Application service configuration system

    US20210135941A1