CN112181485A - Script execution method and device, electronic equipment and storage medium - Google Patents

Script execution method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN112181485A
CN112181485A CN202011126150.9A CN202011126150A CN112181485A CN 112181485 A CN112181485 A CN 112181485A CN 202011126150 A CN202011126150 A CN 202011126150A CN 112181485 A CN112181485 A CN 112181485A
Authority
CN
China
Prior art keywords
script
execution
determining
target
names
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202011126150.9A
Other languages
Chinese (zh)
Other versions
CN112181485B (en
Inventor
华洪亮
汪小伏
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Bank Co Ltd
Original Assignee
Ping An Bank Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ping An Bank Co Ltd filed Critical Ping An Bank Co Ltd
Priority to CN202011126150.9A priority Critical patent/CN112181485B/en
Publication of CN112181485A publication Critical patent/CN112181485A/en
Application granted granted Critical
Publication of CN112181485B publication Critical patent/CN112181485B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/71Version control; Configuration management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/602Providing cryptographic facilities or services
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45504Abstract machines for programme code execution, e.g. Java virtual machine [JVM], interpreters, emulators
    • G06F9/45508Runtime interpretation or emulation, e g. emulator loops, bytecode interpretation
    • G06F9/45512Command shells

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • Health & Medical Sciences (AREA)
  • Bioethics (AREA)
  • General Health & Medical Sciences (AREA)
  • Computer Hardware Design (AREA)
  • Stored Programmes (AREA)

Abstract

The invention relates to data processing and provides a script execution method and device, electronic equipment and a storage medium. The method can extract a plurality of script names from a script execution request, obtain a plurality of scripts to be executed corresponding to the script names from a version control system, check grammar, determine a target script, sort the target script based on the script names to obtain a script list, execute the target script in the script list according to the sequence from front to back, interrupt the execution of any script when the execution failure of any script is detected, determine the execution environment of the any script when the execution failure of the script is detected, determine the breakpoint position of the interrupted execution of the script, and determine the script, the execution environment and the breakpoint position as the response result of the script execution request. The invention improves the script execution efficiency and saves resources. In addition, the invention also relates to a block chain technology, and the response result can be stored in the block chain.

Description

Script execution method and device, electronic equipment and storage medium
Technical Field
The present invention relates to the field of data processing technologies, and in particular, to a script execution method and apparatus, an electronic device, and a storage medium.
Background
In the system development process, a plurality of environments are generally required, such as a development environment, a system test environment, a user test environment and the like, a developer generally executes a script in the development environment, and a system test environment and a user test environment generally need to be executed by a test manager or a version manager, and the script is currently executed by manually copying the script into a PLSQL tool regardless of the developer, the tester and the version manager. Meanwhile, different environments need different user roles to participate, so that when developers forget to inform testers of executing the scripts in the test environment after completing script development in the development environment, related functions of the test environment cannot be tested, and in addition, the existing script execution scheme can also cause repeated execution of the scripts, so that resources are wasted.
Disclosure of Invention
In view of the above, it is desirable to provide a script execution method, device, electronic device and storage medium, which can not only improve the script execution efficiency, but also avoid the problems of missed execution and repeated execution of the script, and save resources.
In one aspect, the present invention provides a script execution method, where the script execution method includes:
when a script execution request is received, extracting a plurality of script names from the script execution request;
acquiring a plurality of scripts to be executed corresponding to the script names from a version control system;
performing grammar check on the plurality of scripts to be executed, and determining the scripts to be executed passing the grammar check as target scripts;
sequencing the target script based on the script names to obtain a script list;
executing the target scripts in the script list according to the sequence from front to back;
when detecting that any script fails to be executed, interrupting the execution of the any script;
determining the execution environment of the arbitrary script when the execution of the arbitrary script fails, and determining the breakpoint position of the interrupted execution of the arbitrary script;
and determining the arbitrary script, the execution environment and the breakpoint position as a response result of the script execution request.
According to a preferred embodiment of the present invention, the extracting the plurality of script names from the script execution request includes:
acquiring a thread connection pool, and acquiring any idle thread from the thread connection pool;
analyzing the message of the script execution request by using the any idle thread to obtain message information carried by the script execution request;
and acquiring a preset label, and acquiring information corresponding to the preset label from the message information as the plurality of script names.
According to a preferred embodiment of the present invention, the obtaining the multiple scripts to be executed corresponding to the multiple script names from the version control system includes:
determining a database path where a database in the version control system is located;
acquiring a configuration table from the database path;
traversing file names in the configuration table, and determining the traversed file names which are the same as the script names as a plurality of target names;
and acquiring a plurality of file storage paths of the target names, and acquiring the scripts to be executed from the file storage paths.
According to a preferred embodiment of the present invention, the syntax checking of the plurality of scripts to be executed includes:
acquiring a script instruction in each script to be executed;
determining the data volume of the script instruction, and determining an execution thread according to the data volume;
determining the instruction type of the script instruction, and acquiring a preset format according to the instruction type;
detecting whether the script instruction conforms to the preset format by using the execution thread;
and when detecting that any script instruction does not conform to the preset format, determining that the any script instruction does not pass syntax verification, and determining the script to be executed where the any script instruction is located as an error script.
According to a preferred embodiment of the invention, the method further comprises:
extracting a target instruction which does not pass syntax verification in the error script, and determining the instruction position of the target instruction;
generating prompt information of the error script according to the target instruction and the instruction position;
and sending the prompt information to the terminal equipment of the appointed contact person.
According to a preferred embodiment of the present invention, the sorting the target script based on the plurality of script names to obtain a script list includes:
determining the creation time of the script names, and determining the target number of the script names with the same creation time;
when the target number is larger than a preset value, extracting a sequence number in each script name, and sequencing the target scripts according to the sequence of the sequence numbers from small to large to obtain a script list; or
And when the target number is less than or equal to the preset value, sequencing the target scripts according to the sequence from small to large of the creation time to obtain the script list.
According to a preferred embodiment of the present invention, after determining the arbitrary script, the execution environment, and the breakpoint location as a response result of the script execution request, the method further includes:
encrypting the response result by adopting a symmetric encryption algorithm to obtain a ciphertext, and detecting the environment type of the execution environment;
when the execution environment is a development environment, determining a creating user of the arbitrary script, and sending the ciphertext to the equipment of the creating user; or
And when the execution environment is a test environment, determining a test user of any script, sending the ciphertext to the equipment of the test user, receiving a test report submitted by the test user, and sending the test report to the equipment of the creation user.
In another aspect, the present invention further provides a script execution apparatus, including:
an extracting unit configured to extract a plurality of script names from a script execution request when the script execution request is received;
the acquisition unit is used for acquiring a plurality of scripts to be executed corresponding to the script names from the version control system;
the determining unit is used for carrying out grammar check on the plurality of scripts to be executed and determining the scripts to be executed passing the grammar check as target scripts;
the sequencing unit is used for sequencing the target script based on the script names to obtain a script list;
the execution unit is used for executing the target scripts in the script list according to the sequence from front to back;
an interruption unit configured to interrupt execution of an arbitrary script when an execution failure of the arbitrary script is detected;
the determining unit is further configured to determine an execution environment in which the arbitrary script fails to be executed, and determine a breakpoint position at which the arbitrary script is interrupted to be executed;
the determining unit is further configured to determine the arbitrary script, the execution environment, and the breakpoint position as a response result of the script execution request.
In another aspect, the present invention further provides an electronic device, including:
a memory storing computer readable instructions; and
a processor executing computer readable instructions stored in the memory to implement the script execution method.
In another aspect, the present invention also provides a computer-readable storage medium, in which computer-readable instructions are stored, and the computer-readable instructions are executed by a processor in an electronic device to implement the script execution method.
It can be seen from the above technical solutions that the present invention can extract a plurality of script names from a script execution request when the script execution request is received, can comprehensively obtain all scripts that need to be processed, and obtain a plurality of scripts to be executed corresponding to the script names from a version control system, because a developer can upload the scripts to the version control system in time after the scripts are developed, for this purpose, by obtaining the latest scripts corresponding to the script names from the version control system, performing syntax check on the plurality of scripts to be executed, and determining the scripts to be executed that pass the syntax check as target scripts, checking the syntax of the scripts before executing the scripts, it is possible to avoid script execution failure due to syntax error, thereby improving script execution success rate, avoiding occupation of threads due to repeated script execution for many times, sorting the target script based on the script names to obtain a script list, executing the target script in the script list in a front-to-back order, when detecting that any script fails to be executed, interrupting the execution of the any script, determining the execution environment of the any script when the execution of the any script fails, and determining the breakpoint position of the interrupted execution of the any script, by interrupting the execution of any script in time, the execution environment and the breakpoint position can be accurately determined, so that the script can be executed from the breakpoint position after the script is repaired, thereby avoiding repeated execution of the script program in the script, meanwhile, the specific position where the breakpoint position is favorable for reminding developers of problems is determined, and the arbitrary script, the execution environment and the breakpoint position are determined as the response result of the script execution request. The invention realizes the automatic execution of the script, can avoid the problems of missed execution and repeated execution of the script, saves resources, and simultaneously, the smooth execution of the script does not need to depend on the manual execution of professionals, and can improve the script execution efficiency, thereby accelerating the development progress.
Drawings
FIG. 1 is a flow chart of a preferred embodiment of the script execution method of the present invention.
FIG. 2 is a functional block diagram of a preferred embodiment of the script execution apparatus of the present invention.
FIG. 3 is a schematic structural diagram of an electronic device implementing a script execution method according to a preferred embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention will be described in detail with reference to the accompanying drawings and specific embodiments.
FIG. 1 is a flow chart of a preferred embodiment of the script execution method of the present invention. The order of the steps in the flow chart may be changed and some steps may be omitted according to different needs.
The script execution method is applied to one or more electronic devices, which are devices capable of automatically performing numerical calculation and/or information processing according to computer readable instructions set or stored in advance, and the hardware of the electronic devices includes, but is not limited to, a microprocessor, an Application Specific Integrated Circuit (ASIC), a Programmable Gate Array (FPGA), a Digital Signal Processor (DSP), an embedded device, and the like.
The electronic device may be any electronic product capable of performing human-computer interaction with a user, for example, a Personal computer, a tablet computer, a smart phone, a Personal Digital Assistant (PDA), a game machine, an interactive Internet Protocol Television (IPTV), a smart wearable device, and the like.
The electronic device may include a network device and/or a user device. Wherein the network device includes, but is not limited to, a single network electronic device, an electronic device group consisting of a plurality of network electronic devices, or a Cloud Computing (Cloud Computing) based Cloud consisting of a large number of hosts or network electronic devices.
The network in which the electronic device is located includes, but is not limited to: the internet, a wide area Network, a metropolitan area Network, a local area Network, a Virtual Private Network (VPN), and the like.
S10, when a script execution request is received, extracts a plurality of script names from the script execution request.
In at least one embodiment of the present invention, the message information carried in the script execution request includes: the script name generation device comprises a request number, a preset label and a plurality of script names.
Further, the plurality of script names refer to file names of a plurality of script files. The plurality of script names may be in the form of a serial number-UM number. For example, the script name is 3-jiaoben 231.
In at least one embodiment of the present invention, the electronic device extracting a plurality of script names from the script execution request includes:
acquiring a thread connection pool, and acquiring any idle thread from the thread connection pool;
analyzing the message of the script execution request by using the any idle thread to obtain message information carried by the script execution request;
and acquiring a preset label, and acquiring information corresponding to the preset label from the message information as the plurality of script names.
The preset tag is a predefined tag, for example, the preset tag may be a name.
The time for creating the idle thread can be saved by acquiring the idle thread from the thread connection pool, the idle thread is further utilized to process the message of the script execution request, other requests with higher priority are saved by processing the thread, meanwhile, the whole script execution request does not need to be analyzed, the analysis efficiency of the script execution request is improved, and the multiple script names can be accurately extracted from the script execution request through the mapping relation between the preset label and the script name.
In at least one embodiment of the present invention, by obtaining the multiple script names, all scripts that need to be processed can be comprehensively obtained
And S11, acquiring a plurality of scripts to be executed corresponding to the script names from the version control system.
In at least one embodiment of the present invention, the version control system is a system that records changes in the content of one or several files in order to refer to a particular version revision in the future. The version control system can be applied to text files of software source codes, and can carry out version control on any type of files. For example: the version control system may include, but is not limited to: svn, git, etc.
In at least one embodiment of the invention, the plurality of scripts to be executed may include database scripts.
In at least one embodiment of the present invention, the obtaining, by the electronic device, a plurality of scripts to be executed corresponding to the plurality of script names from the version control system includes:
determining a database path where a database in the version control system is located;
acquiring a configuration table from the database path;
traversing file names in the configuration table, and determining the traversed file names which are the same as the script names as a plurality of target names;
and acquiring a plurality of file storage paths of the target names, and acquiring the scripts to be executed from the file storage paths.
And the configuration table stores a plurality of file names and file storage paths of each file name.
By the embodiment, the multiple scripts to be executed can be quickly and accurately acquired.
In at least one embodiment of the present invention, since the developer may upload the script to the version control system in time after the script is developed, the latest script corresponding to the script name can be acquired from the version control system.
And S12, performing grammar check on the plurality of scripts to be executed, and determining the scripts to be executed passing the grammar check as target scripts.
In at least one embodiment of the present invention, the target script refers to a script to be executed that is checked by syntax such as format.
In at least one embodiment of the present invention, the syntax checking, by the electronic device, of the scripts to be executed includes:
acquiring a script instruction in each script to be executed;
determining the data volume of the script instruction, and determining an execution thread according to the data volume;
determining the instruction type of the script instruction, and acquiring a preset format according to the instruction type;
detecting whether the script instruction conforms to the preset format by using the execution thread;
and when detecting that any script instruction does not conform to the preset format, determining that the any script instruction does not pass syntax verification, and determining the script to be executed where the any script instruction is located as an error script.
Wherein the instruction types may include, but are not limited to: JAVA type, C language type, etc.
Further, the preset format refers to an instruction format specific to the instruction type.
Through the implementation mode, a proper execution thread can be determined according to the data volume of the script instruction, and grammar verification of the script to be executed is facilitated.
In at least one embodiment of the invention, the method further comprises:
extracting a target instruction which does not pass syntax verification in the error script, and determining the instruction position of the target instruction;
generating prompt information of the error script according to the target instruction and the instruction position;
and sending the prompt information to the terminal equipment of the appointed contact person.
Wherein the designated contact may be a developer responsible for script development.
Through the embodiment, when the script to be executed does not pass grammar verification, the target instruction causing the script to be executed to fail the grammar verification can be timely acquired, and the target instruction is timely sent to the terminal equipment of the appointed contact person, so that a prompt effect is achieved.
S13, the target script is sequenced based on the script names, and a script list is obtained.
In at least one embodiment of the present invention, the script list stores the target script and a sequence number of the target script in the script list.
In at least one embodiment of the present invention, the electronic device sorts the target script based on the script names, and obtaining the script list includes:
determining the creation time of the script names, and determining the target number of the script names with the same creation time;
when the target number is larger than a preset value, extracting a sequence number in each script name, and sequencing the target scripts according to the sequence of the sequence numbers from small to large to obtain a script list; or
And when the target number is less than or equal to the preset value, sequencing the target scripts according to the sequence from small to large of the creation time to obtain the script list.
Wherein the preset value is a positive integer, and the preset value is usually set to 1.
By the implementation mode, when the target number is smaller than or equal to the preset value, the target scripts can be directly sequenced according to the creation time of the script names, the sequence numbers in the script names do not need to be extracted, and sequencing efficiency is improved.
In at least one embodiment of the present invention, the target script can be executed according to a certain logic sequence by sequencing the target script, so that the execution of the script is more standard, which is beneficial to the management of the script.
S14, executing the target scripts in the script list according to the sequence from front to back.
In at least one embodiment of the present invention, for example, the script list is sequence number 1: a target script A; sequence number 2: a target script B; sequence No. 3: and a target script C. Therefore, the electronic device executes the target script a, then executes the target script B, and finally executes the target script C in the order from front to back.
S15, interrupting the execution of any script when the execution failure of the script is detected.
In at least one embodiment of the present invention, during the execution of the target script, a case that the target script fails to be executed may occur due to a syntax error of the target script, or the like. When the execution of any script fails, the execution of the unexecuted script instruction in the any script is influenced, so that the execution efficiency is reduced. Therefore, when the any script is detected, the execution of the any script is interrupted, and the any script is suspended, so that the related contact personnel can update and repair the any script conveniently.
And S16, determining the execution environment of the arbitrary script when the execution of the arbitrary script fails, and determining the breakpoint position of the interrupted execution of the arbitrary script.
In at least one embodiment of the present invention, the execution environment may be a development environment, a system test environment, or a user test environment, and the present invention does not limit the execution environment.
Further, the breakpoint position refers to a position where a script instruction causing the execution of the arbitrary script to fail is located. For example, the breakpoint location may be line 10.
In at least one embodiment of the present invention, the electronic device determining an execution environment in which the arbitrary script fails to be executed includes:
acquiring an environment identifier for executing the any script currently;
determining the execution environment using the environment identification.
In at least one embodiment of the present invention, the electronic device determines an interrupt instruction causing the arbitrary script to be interrupted, determines a line number where the interrupt instruction is located in the arbitrary script, and determines the line number as the breakpoint position.
In at least one embodiment of the invention, the execution environment and the breakpoint position can be accurately determined by interrupting the execution of any script in time, so that the script can be executed from the breakpoint position after the script is repaired, the script program in the script is prevented from being repeatedly executed, and meanwhile, the specific position of a developer with a problem is favorably reminded by determining the breakpoint position.
And S17, determining the arbitrary script, the execution environment and the breakpoint position as a response result of the script execution request.
It is emphasized that, in order to further ensure the privacy and security of the response result, the response result may also be stored in a node of a block chain.
In at least one embodiment of the present invention, the response result refers to a result obtained by processing the script execution request.
In at least one embodiment of the present invention, after determining the arbitrary script, the execution environment, and the breakpoint location as a response result of the script execution request, the method further includes:
encrypting the response result by adopting a symmetric encryption algorithm to obtain a ciphertext, and detecting the environment type of the execution environment;
when the execution environment is a development environment, determining a creating user of the arbitrary script, and sending the ciphertext to the equipment of the creating user; or
And when the execution environment is a test environment, determining a test user of any script, sending the ciphertext to the equipment of the test user, receiving a test report submitted by the test user, and sending the test report to the equipment of the creation user.
Through the implementation mode, the sending address of the ciphertext can be determined according to the environment type of the execution environment, and a direct responsible person can receive the response result in time.
It can be seen from the above technical solutions that the present invention can extract a plurality of script names from a script execution request when the script execution request is received, can comprehensively obtain all scripts that need to be processed, and obtain a plurality of scripts to be executed corresponding to the script names from a version control system, because a developer can upload the scripts to the version control system in time after the scripts are developed, for this purpose, by obtaining the latest scripts corresponding to the script names from the version control system, performing syntax check on the plurality of scripts to be executed, and determining the scripts to be executed that pass the syntax check as target scripts, checking the syntax of the scripts before executing the scripts, it is possible to avoid script execution failure due to syntax error, thereby improving script execution success rate, avoiding occupation of threads due to repeated script execution for many times, sorting the target script based on the script names to obtain a script list, executing the target script in the script list in a front-to-back order, when detecting that any script fails to be executed, interrupting the execution of the any script, determining the execution environment of the any script when the execution of the any script fails, and determining the breakpoint position of the interrupted execution of the any script, by interrupting the execution of any script in time, the execution environment and the breakpoint position can be accurately determined, so that the script can be executed from the breakpoint position after the script is repaired, thereby avoiding repeated execution of the script program in the script, meanwhile, the specific position where the breakpoint position is favorable for reminding developers of problems is determined, and the arbitrary script, the execution environment and the breakpoint position are determined as the response result of the script execution request. The invention realizes the automatic execution of the script, can avoid the problems of missed execution and repeated execution of the script, saves resources, and simultaneously, the smooth execution of the script does not need to depend on the manual execution of professionals, and can improve the script execution efficiency, thereby accelerating the development progress.
FIG. 2 is a functional block diagram of a preferred embodiment of the script execution apparatus according to the present invention. The script execution device 11 includes an extraction unit 110, an acquisition unit 111, a determination unit 112, a sorting unit 113, an execution unit 114, an interruption unit 115, a generation unit 116, a transmission unit 117, and an encryption unit 118. The module/unit referred to herein is a series of computer readable instruction segments that can be accessed by the processor 13 and perform a fixed function and that are stored in the memory 12. In the present embodiment, the functions of the modules/units will be described in detail in the following embodiments.
When receiving a script execution request, the extraction unit 110 extracts a plurality of script names from the script execution request.
In at least one embodiment of the present invention, the message information carried in the script execution request includes: the script name generation device comprises a request number, a preset label and a plurality of script names.
Further, the plurality of script names refer to file names of a plurality of script files. The plurality of script names may be in the form of a serial number-UM number. For example, the script name is 3-jiaoben 231.
In at least one embodiment of the present invention, the extracting unit 110 extracts a plurality of script names from the script execution request includes:
acquiring a thread connection pool, and acquiring any idle thread from the thread connection pool;
analyzing the message of the script execution request by using the any idle thread to obtain message information carried by the script execution request;
and acquiring a preset label, and acquiring information corresponding to the preset label from the message information as the plurality of script names.
The preset tag is a predefined tag, for example, the preset tag may be a name.
The time for creating the idle thread can be saved by acquiring the idle thread from the thread connection pool, the idle thread is further utilized to process the message of the script execution request, other requests with higher priority are saved by processing the thread, meanwhile, the whole script execution request does not need to be analyzed, the analysis efficiency of the script execution request is improved, and the multiple script names can be accurately extracted from the script execution request through the mapping relation between the preset label and the script name.
In at least one embodiment of the present invention, by obtaining the multiple script names, all scripts that need to be processed can be comprehensively obtained
The acquisition unit 111 acquires a plurality of scripts to be executed corresponding to the plurality of script names from the version control system.
In at least one embodiment of the present invention, the version control system is a system that records changes in the content of one or several files in order to refer to a particular version revision in the future. The version control system can be applied to text files of software source codes, and can carry out version control on any type of files. For example: the version control system may include, but is not limited to: svn, git, etc.
In at least one embodiment of the invention, the plurality of scripts to be executed may include database scripts.
In at least one embodiment of the present invention, the acquiring unit 111 acquires a plurality of scripts to be executed corresponding to the plurality of script names from a version control system, including:
determining a database path where a database in the version control system is located;
acquiring a configuration table from the database path;
traversing file names in the configuration table, and determining the traversed file names which are the same as the script names as a plurality of target names;
and acquiring a plurality of file storage paths of the target names, and acquiring the scripts to be executed from the file storage paths.
And the configuration table stores a plurality of file names and file storage paths of each file name.
By the embodiment, the multiple scripts to be executed can be quickly and accurately acquired.
In at least one embodiment of the present invention, since the developer may upload the script to the version control system in time after the script is developed, the latest script corresponding to the script name can be acquired from the version control system.
The determining unit 112 performs syntax checking on the plurality of scripts to be executed, and determines the scripts to be executed passing the syntax checking as target scripts.
In at least one embodiment of the present invention, the target script refers to a script to be executed that is checked by syntax such as format.
In at least one embodiment of the present invention, the syntax checking of the plurality of scripts to be executed by the determining unit 112 includes:
acquiring a script instruction in each script to be executed;
determining the data volume of the script instruction, and determining an execution thread according to the data volume;
determining the instruction type of the script instruction, and acquiring a preset format according to the instruction type;
detecting whether the script instruction conforms to the preset format by using the execution thread;
and when detecting that any script instruction does not conform to the preset format, determining that the any script instruction does not pass syntax verification, and determining the script to be executed where the any script instruction is located as an error script.
Wherein the instruction types may include, but are not limited to: JAVA type, C language type, etc.
Further, the preset format refers to an instruction format specific to the instruction type.
Through the implementation mode, a proper execution thread can be determined according to the data volume of the script instruction, and grammar verification of the script to be executed is facilitated.
In at least one embodiment of the present invention, the extracting unit 110 extracts a target instruction that fails syntax checking in the error script, and determines an instruction position where the target instruction is located;
the generating unit 116 generates prompt information of the error script according to the target instruction and the instruction position;
the sending unit 117 sends the prompt information to the terminal device of the designated contact.
Wherein the designated contact may be a developer responsible for script development.
Through the embodiment, when the script to be executed does not pass grammar verification, the target instruction causing the script to be executed to fail the grammar verification can be timely acquired, and the target instruction is timely sent to the terminal equipment of the appointed contact person, so that a prompt effect is achieved.
The sorting unit 113 sorts the target script based on the script names, resulting in a script list.
In at least one embodiment of the present invention, the script list stores the target script and a sequence number of the target script in the script list.
In at least one embodiment of the present invention, the sorting unit 113 sorts the target script based on the script names, and obtaining a script list includes:
determining the creation time of the script names, and determining the target number of the script names with the same creation time;
when the target number is larger than a preset value, extracting a sequence number in each script name, and sequencing the target scripts according to the sequence of the sequence numbers from small to large to obtain a script list; or
And when the target number is less than or equal to the preset value, sequencing the target scripts according to the sequence from small to large of the creation time to obtain the script list.
Wherein the preset value is a positive integer, and the preset value is usually set to 1.
By the implementation mode, when the target number is smaller than or equal to the preset value, the target scripts can be directly sequenced according to the creation time of the script names, the sequence numbers in the script names do not need to be extracted, and sequencing efficiency is improved.
In at least one embodiment of the present invention, the target script can be executed according to a certain logic sequence by sequencing the target script, so that the execution of the script is more standard, which is beneficial to the management of the script.
The execution unit 114 executes the target scripts in the script list in order from front to back.
In at least one embodiment of the present invention, for example, the script list is sequence number 1: a target script A; sequence number 2: a target script B; sequence No. 3: and a target script C. Therefore, the electronic device executes the target script a, then executes the target script B, and finally executes the target script C in the order from front to back.
When detecting that any script fails to be executed, the interruption unit 115 interrupts the execution of the any script.
In at least one embodiment of the present invention, during the execution of the target script, a case that the target script fails to be executed may occur due to a syntax error of the target script, or the like. When the execution of any script fails, the execution of the unexecuted script instruction in the any script is influenced, so that the execution efficiency is reduced. Therefore, when the any script is detected, the execution of the any script is interrupted, and the any script is suspended, so that the related contact personnel can update and repair the any script conveniently.
The determination unit 112 determines an execution environment in which the arbitrary script fails to be executed, and determines a breakpoint position at which the arbitrary script is interrupted from being executed.
In at least one embodiment of the present invention, the execution environment may be a development environment, a system test environment, or a user test environment, and the present invention does not limit the execution environment.
Further, the breakpoint position refers to a position where a script instruction causing the execution of the arbitrary script to fail is located. For example, the breakpoint location may be line 10.
In at least one embodiment of the present invention, the determining unit 112 determines the execution environment in which the arbitrary script fails to be executed, including:
acquiring an environment identifier for executing the any script currently;
determining the execution environment using the environment identification.
In at least one embodiment of the present invention, the determining unit 112 determines an interruption instruction causing the arbitrary script to be interrupted, determines a line number where the interruption instruction is located in the arbitrary script, and determines the line number as the breakpoint position.
In at least one embodiment of the invention, the execution environment and the breakpoint position can be accurately determined by interrupting the execution of any script in time, so that the script can be executed from the breakpoint position after the script is repaired, the script program in the script is prevented from being repeatedly executed, and meanwhile, the specific position of a developer with a problem is favorably reminded by determining the breakpoint position.
The determination unit 112 determines the arbitrary script, the execution environment, and the breakpoint position as a response result of the script execution request.
It is emphasized that, in order to further ensure the privacy and security of the response result, the response result may also be stored in a node of a block chain.
In at least one embodiment of the present invention, the response result refers to a result obtained by processing the script execution request.
In at least one embodiment of the present invention, after determining the arbitrary script, the execution environment, and the breakpoint position as the response result of the script execution request, the encryption unit 118 encrypts the response result by using a symmetric encryption algorithm to obtain a ciphertext, and detects an environment type to which the execution environment belongs;
when the execution environment is a development environment, determining a creating user of the arbitrary script, and sending the ciphertext to the device of the creating user; or
When the execution environment is a test environment, the determining unit 112 determines a test user of the arbitrary script, sends the ciphertext to the device of the test user, receives a test report submitted by the test user, and sends the test report to the device of the creating user.
Through the implementation mode, the sending address of the ciphertext can be determined according to the environment type of the execution environment, and a direct responsible person can receive the response result in time.
It can be seen from the above technical solutions that the present invention can extract a plurality of script names from a script execution request when the script execution request is received, can comprehensively obtain all scripts that need to be processed, and obtain a plurality of scripts to be executed corresponding to the script names from a version control system, because a developer can upload the scripts to the version control system in time after the scripts are developed, for this purpose, by obtaining the latest scripts corresponding to the script names from the version control system, performing syntax check on the plurality of scripts to be executed, and determining the scripts to be executed that pass the syntax check as target scripts, checking the syntax of the scripts before executing the scripts, it is possible to avoid script execution failure due to syntax error, thereby improving script execution success rate, avoiding occupation of threads due to repeated script execution for many times, sorting the target script based on the script names to obtain a script list, executing the target script in the script list in a front-to-back order, when detecting that any script fails to be executed, interrupting the execution of the any script, determining the execution environment of the any script when the execution of the any script fails, and determining the breakpoint position of the interrupted execution of the any script, by interrupting the execution of any script in time, the execution environment and the breakpoint position can be accurately determined, so that the script can be executed from the breakpoint position after the script is repaired, thereby avoiding repeated execution of the script program in the script, meanwhile, the specific position where the breakpoint position is favorable for reminding developers of problems is determined, and the arbitrary script, the execution environment and the breakpoint position are determined as the response result of the script execution request. The invention realizes the automatic execution of the script, can avoid the problems of missed execution and repeated execution of the script, saves resources, and simultaneously, the smooth execution of the script does not need to depend on the manual execution of professionals, and can improve the script execution efficiency, thereby accelerating the development progress.
Fig. 3 is a schematic structural diagram of an electronic device implementing a script execution method according to a preferred embodiment of the present invention.
In one embodiment of the present invention, the electronic device 1 includes, but is not limited to, a memory 12, a processor 13, and computer readable instructions, such as a script execution program, stored in the memory 12 and executable on the processor 13.
It will be appreciated by a person skilled in the art that the schematic diagram is only an example of the electronic device 1 and does not constitute a limitation of the electronic device 1, and that it may comprise more or less components than shown, or some components may be combined, or different components, e.g. the electronic device 1 may further comprise an input output device, a network access device, a bus, etc.
The Processor 13 may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic device, discrete hardware component, etc. The processor 13 is an operation core and a control center of the electronic device 1, and is connected to each part of the whole electronic device 1 by various interfaces and lines, and executes an operating system of the electronic device 1 and various installed application programs, program codes, and the like.
The processor 13 executes an operating system of the electronic device 1 and various installed application programs. The processor 13 executes the application program to implement the steps in the various script execution method embodiments described above, such as the steps shown in fig. 1.
Illustratively, the computer readable instructions may be partitioned into one or more modules/units that are stored in the memory 12 and executed by the processor 13 to implement the present invention. The one or more modules/units may be a series of computer readable instruction segments capable of performing specific functions, which are used for describing the execution process of the computer readable instructions in the electronic device 1. For example, the computer-readable instructions may be divided into an extraction unit 110, an acquisition unit 111, a determination unit 112, a sorting unit 113, an execution unit 114, an interruption unit 115, a generation unit 116, a transmission unit 117, and an encryption unit 118.
The memory 12 may be used for storing the computer readable instructions and/or modules, and the processor 13 implements various functions of the electronic device 1 by executing or executing the computer readable instructions and/or modules stored in the memory 12 and invoking data stored in the memory 12. The memory 12 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application program required by at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may store data created according to use of the electronic device, and the like. The memory 12 may include non-volatile and volatile memories, such as: a hard disk, a memory, a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), at least one magnetic disk storage device, a Flash memory device, or other storage device, and also volatile memory, such as: a variable memory.
The memory 12 may be an external memory and/or an internal memory of the electronic device 1. Further, the memory 12 may be a memory having a physical form, such as a memory stick, a TF Card (Trans-flash Card), or the like.
The integrated modules/units of the electronic device 1 may be stored in a computer-readable storage medium if they are implemented in the form of software functional units and sold or used as separate products. Based on such understanding, all or part of the flow of the method according to the above embodiments may be implemented by hardware that is configured to be instructed by computer readable instructions, which may be stored in a computer readable storage medium, and when the computer readable instructions are executed by a processor, the steps of the method embodiments may be implemented.
Wherein the computer readable instructions comprise computer readable instruction code which may be in source code form, object code form, an executable file or some intermediate form, and the like. The computer-readable medium may include: any entity or device capable of carrying the computer-readable instruction code, recording medium, usb disk, removable hard disk, magnetic disk, optical disk, computer Memory, Read-Only Memory (ROM), Random Access Memory (RAM), and the like.
The block chain is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, a consensus mechanism, an encryption algorithm and the like. A block chain (Blockchain), which is essentially a decentralized database, is a series of data blocks associated by using a cryptographic method, and each data block contains information of a batch of network transactions, so as to verify the validity (anti-counterfeiting) of the information and generate a next block. The blockchain may include a blockchain underlying platform, a platform product service layer, an application service layer, and the like.
In connection with fig. 1, the memory 12 in the electronic device 1 stores computer-readable instructions that are executable by the processor 13 to implement:
when a script execution request is received, extracting a plurality of script names from the script execution request;
acquiring a plurality of scripts to be executed corresponding to the script names from a version control system;
performing grammar check on the plurality of scripts to be executed, and determining the scripts to be executed passing the grammar check as target scripts;
sequencing the target script based on the script names to obtain a script list;
executing the target scripts in the script list according to the sequence from front to back;
when detecting that any script fails to be executed, interrupting the execution of the any script;
determining the execution environment of the arbitrary script when the execution of the arbitrary script fails, and determining the breakpoint position of the interrupted execution of the arbitrary script;
and determining the arbitrary script, the execution environment and the breakpoint position as a response result of the script execution request.
Specifically, the processor 13 may refer to the description of the relevant steps in the embodiment corresponding to fig. 1 for a specific implementation method of the computer readable instructions, which is not described herein again.
In the embodiments provided in the present invention, it should be understood that the disclosed system, apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the modules is only one logical functional division, and other divisions may be realized in practice.
The computer readable storage medium has computer readable instructions stored thereon, wherein the computer readable instructions are executed by the processor 13 to implement the steps of:
when a script execution request is received, extracting a plurality of script names from the script execution request;
acquiring a plurality of scripts to be executed corresponding to the script names from a version control system;
performing grammar check on the plurality of scripts to be executed, and determining the scripts to be executed passing the grammar check as target scripts;
sequencing the target script based on the script names to obtain a script list;
executing the target scripts in the script list according to the sequence from front to back;
when detecting that any script fails to be executed, interrupting the execution of the any script;
determining the execution environment of the arbitrary script when the execution of the arbitrary script fails, and determining the breakpoint position of the interrupted execution of the arbitrary script;
and determining the arbitrary script, the execution environment and the breakpoint position as a response result of the script execution request.
The modules described as separate parts may or may not be physically separate, and parts displayed as modules may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment.
In addition, functional modules in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, or in a form of hardware plus a software functional module.
The present embodiments are therefore to be considered in all respects as illustrative and not restrictive, the scope of the invention being indicated by the appended claims rather than by the foregoing description, and all changes which come within the meaning and range of equivalency of the claims are therefore intended to be embraced therein. Any reference signs in the claims shall not be construed as limiting the claim concerned.
Furthermore, it is obvious that the word "comprising" does not exclude other elements or steps, and the singular does not exclude the plural. A plurality of units or means recited in the system claims may also be implemented by one unit or means in software or hardware. The terms second, etc. are used to denote names, but not any particular order.
Finally, it should be noted that the above embodiments are only for illustrating the technical solutions of the present invention and not for limiting, and although the present invention is described in detail with reference to the preferred embodiments, it should be understood by those skilled in the art that modifications or equivalent substitutions may be made on the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention.

Claims (10)

1. A script execution method, wherein the script execution method comprises:
when a script execution request is received, extracting a plurality of script names from the script execution request;
acquiring a plurality of scripts to be executed corresponding to the script names from a version control system;
performing grammar check on the plurality of scripts to be executed, and determining the scripts to be executed passing the grammar check as target scripts;
sequencing the target script based on the script names to obtain a script list;
executing the target scripts in the script list according to the sequence from front to back;
when detecting that any script fails to be executed, interrupting the execution of the any script;
determining the execution environment of the arbitrary script when the execution of the arbitrary script fails, and determining the breakpoint position of the interrupted execution of the arbitrary script;
and determining the arbitrary script, the execution environment and the breakpoint position as a response result of the script execution request.
2. The script execution method of claim 1, wherein said extracting a plurality of script names from the script execution request comprises:
acquiring a thread connection pool, and acquiring any idle thread from the thread connection pool;
analyzing the message of the script execution request by using the any idle thread to obtain message information carried by the script execution request;
and acquiring a preset label, and acquiring information corresponding to the preset label from the message information as the plurality of script names.
3. The script execution method of claim 1, wherein said obtaining a plurality of scripts to be executed corresponding to said plurality of script names from a version control system comprises:
determining a database path where a database in the version control system is located;
acquiring a configuration table from the database path;
traversing file names in the configuration table, and determining the traversed file names which are the same as the script names as a plurality of target names;
and acquiring a plurality of file storage paths of the target names, and acquiring the scripts to be executed from the file storage paths.
4. The script execution method of claim 1, wherein said syntax checking said plurality of scripts to be executed comprises:
acquiring a script instruction in each script to be executed;
determining the data volume of the script instruction, and determining an execution thread according to the data volume;
determining the instruction type of the script instruction, and acquiring a preset format according to the instruction type;
detecting whether the script instruction conforms to the preset format by using the execution thread;
and when detecting that any script instruction does not conform to the preset format, determining that the any script instruction does not pass syntax verification, and determining the script to be executed where the any script instruction is located as an error script.
5. The script execution method of claim 4, wherein said method further comprises:
extracting a target instruction which does not pass syntax verification in the error script, and determining the instruction position of the target instruction;
generating prompt information of the error script according to the target instruction and the instruction position;
and sending the prompt information to the terminal equipment of the appointed contact person.
6. The script execution method of claim 1, wherein said sorting said target script based on said plurality of script names, resulting in a script list comprises:
determining the creation time of the script names, and determining the target number of the script names with the same creation time;
when the target number is larger than a preset value, extracting a sequence number in each script name, and sequencing the target scripts according to the sequence of the sequence numbers from small to large to obtain a script list; or
And when the target number is less than or equal to the preset value, sequencing the target scripts according to the sequence from small to large of the creation time to obtain the script list.
7. The script execution method according to claim 1, wherein after determining the arbitrary script, the execution environment, and the breakpoint location as a result of a response to the script execution request, the method further comprises:
encrypting the response result by adopting a symmetric encryption algorithm to obtain a ciphertext, and detecting the environment type of the execution environment;
when the execution environment is a development environment, determining a creating user of the arbitrary script, and sending the ciphertext to the equipment of the creating user; or
And when the execution environment is a test environment, determining a test user of any script, sending the ciphertext to the equipment of the test user, receiving a test report submitted by the test user, and sending the test report to the equipment of the creation user.
8. A script execution apparatus, characterized in that the script execution apparatus comprises:
an extracting unit configured to extract a plurality of script names from a script execution request when the script execution request is received;
the acquisition unit is used for acquiring a plurality of scripts to be executed corresponding to the script names from the version control system;
the determining unit is used for carrying out grammar check on the plurality of scripts to be executed and determining the scripts to be executed passing the grammar check as target scripts;
the sequencing unit is used for sequencing the target script based on the script names to obtain a script list;
the execution unit is used for executing the target scripts in the script list according to the sequence from front to back;
an interruption unit configured to interrupt execution of an arbitrary script when an execution failure of the arbitrary script is detected;
the determining unit is further configured to determine an execution environment in which the arbitrary script fails to be executed, and determine a breakpoint position at which the arbitrary script is interrupted to be executed;
the determining unit is further configured to determine the arbitrary script, the execution environment, and the breakpoint position as a response result of the script execution request.
9. An electronic device, characterized in that the electronic device comprises:
a memory storing computer readable instructions; and
a processor executing computer readable instructions stored in the memory to implement the script execution method of any one of claims 1 to 7.
10. A computer-readable storage medium characterized by: the computer readable storage medium has stored therein computer readable instructions which are executed by a processor in an electronic device to implement the script execution method of any one of claims 1 to 7.
CN202011126150.9A 2020-10-20 2020-10-20 Script execution method and device, electronic equipment and storage medium Active CN112181485B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011126150.9A CN112181485B (en) 2020-10-20 2020-10-20 Script execution method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011126150.9A CN112181485B (en) 2020-10-20 2020-10-20 Script execution method and device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN112181485A true CN112181485A (en) 2021-01-05
CN112181485B CN112181485B (en) 2024-03-15

Family

ID=73923498

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011126150.9A Active CN112181485B (en) 2020-10-20 2020-10-20 Script execution method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN112181485B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113297028A (en) * 2021-03-18 2021-08-24 中国平安人寿保险股份有限公司 Script execution method and device, computer equipment and storage medium
CN114398104A (en) * 2022-01-19 2022-04-26 中国平安人寿保险股份有限公司 Script processing method, device, equipment and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108885568A (en) * 2016-03-30 2018-11-23 亚马逊技术有限公司 First already present data set is handled at on-demand code execution environments
CN109726107A (en) * 2018-06-01 2019-05-07 平安普惠企业管理有限公司 Test method, device, equipment and storage medium
CN110377583A (en) * 2019-06-17 2019-10-25 平安普惠企业管理有限公司 Database script executes method, apparatus, computer equipment and storage medium
US10496532B1 (en) * 2019-08-14 2019-12-03 Capital One Services, Llc Automatically reconfiguring a performance test environment
CN111142899A (en) * 2019-12-12 2020-05-12 东软集团股份有限公司 Database script execution method and device, storage medium and electronic equipment

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108885568A (en) * 2016-03-30 2018-11-23 亚马逊技术有限公司 First already present data set is handled at on-demand code execution environments
CN109726107A (en) * 2018-06-01 2019-05-07 平安普惠企业管理有限公司 Test method, device, equipment and storage medium
CN110377583A (en) * 2019-06-17 2019-10-25 平安普惠企业管理有限公司 Database script executes method, apparatus, computer equipment and storage medium
US10496532B1 (en) * 2019-08-14 2019-12-03 Capital One Services, Llc Automatically reconfiguring a performance test environment
CN111142899A (en) * 2019-12-12 2020-05-12 东软集团股份有限公司 Database script execution method and device, storage medium and electronic equipment

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113297028A (en) * 2021-03-18 2021-08-24 中国平安人寿保险股份有限公司 Script execution method and device, computer equipment and storage medium
CN114398104A (en) * 2022-01-19 2022-04-26 中国平安人寿保险股份有限公司 Script processing method, device, equipment and storage medium
CN114398104B (en) * 2022-01-19 2024-06-04 中国平安人寿保险股份有限公司 Script processing method, device, equipment and storage medium

Also Published As

Publication number Publication date
CN112181485B (en) 2024-03-15

Similar Documents

Publication Publication Date Title
CN113050900B (en) Screen sharing method, device, equipment and storage medium
CN112667240A (en) Program code conversion method and related device
CN112181485B (en) Script execution method and device, electronic equipment and storage medium
CN110825731A (en) Data storage method and device, electronic equipment and storage medium
CN112433705A (en) Script generation method and device, electronic equipment and storage medium
CN112948418A (en) Dynamic query method, device, equipment and storage medium
CN112711398A (en) Method, device and equipment for generating buried point file and storage medium
CN113536770B (en) Text analysis method, device and equipment based on artificial intelligence and storage medium
CN113900955A (en) Automatic testing method, device, equipment and storage medium
CN114418398A (en) Scene task development method, device, equipment and storage medium
CN113918467A (en) Financial system testing method, device, equipment and storage medium
CN112181482B (en) Version verification method and device, electronic equipment and storage medium
CN111651363A (en) Test data acquisition method, test data acquisition device, electronic device and medium
CN112819305A (en) Service index analysis method, device, equipment and storage medium
CN112817742B (en) Data migration method, device, equipment and storage medium
CN117131545A (en) Data processing method and device, storage medium and terminal
CN112395319B (en) Cache sharing method and device, server and storage medium
CN114003784A (en) Request recording method, device, equipment and storage medium
CN114610386A (en) Interaction method, device, equipment and storage medium of H5 and application program
CN115205032A (en) Credit investigation query method, apparatus, device and storage medium
CN114329095A (en) System logic diagram generation method, device, equipment and storage medium
CN113886263A (en) System testing method, device, equipment and storage medium
CN114398104B (en) Script processing method, device, equipment and storage medium
CN112434237A (en) Page loading method and device, electronic equipment and storage medium
CN112667501A (en) Link testing method and device based on automatic baffle and related equipment

Legal Events

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