CN108920286A - A method of high efficiency uses Python script under Thrift RPC environment - Google Patents

A method of high efficiency uses Python script under Thrift RPC environment Download PDF

Info

Publication number
CN108920286A
CN108920286A CN201810688537.XA CN201810688537A CN108920286A CN 108920286 A CN108920286 A CN 108920286A CN 201810688537 A CN201810688537 A CN 201810688537A CN 108920286 A CN108920286 A CN 108920286A
Authority
CN
China
Prior art keywords
script
function
thrift
rpc
high efficiency
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201810688537.XA
Other languages
Chinese (zh)
Inventor
刘远锋
白鸿钧
张明凯
陈宇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Henan Thought Rail Traffic Technology Research Institute Co Ltd
Original Assignee
Henan Thought Rail Traffic Technology Research Institute 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 Henan Thought Rail Traffic Technology Research Institute Co Ltd filed Critical Henan Thought Rail Traffic Technology Research Institute Co Ltd
Priority to CN201810688537.XA priority Critical patent/CN108920286A/en
Publication of CN108920286A publication Critical patent/CN108920286A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/547Remote procedure calls [RPC]; Web services

Abstract

A method of high efficiency uses Python script under Thrift RPC environment:Execute following step:1) enter in human-computer interaction interface and wish to carry out interface where functional block, selection wherein some or several functions;2) start Thrift RPC client, connect RPC service end;3) selected function is sent to by server-side by Thrift RPC client.Compared with the existing technology:1)The present invention improves the flexibility of far call Python script utilization, so that being no longer limited to some or several scripts when far call script.2)The efficiency of far call script is improved, needs to be implemented multiple scripts originally, now only needing one script of execution just can solve, and effectively reduces the time, improves efficiency.3)Safety increases, and places data into buffer area and executes, and executes later emptying buffer again, can effectively prevent script and be maliciously tampered or delete.

Description

A method of high efficiency uses Python script under Thrift RPC environment
Technical field
The method that high efficiency that the present invention relates to a kind of under Thrift RPC environment uses Python script.
Background technique
Python is instantly the most practical scripting language (script as a kind of completely object-oriented language One of language), in practical script use process, the calling of Python script can substantially be attributed to two classes:The first kind For local calling, the second class is far call.
Local call refers to an existing ready-made script in the machine, and the Run Script order ./run.py in the machine Or python run.py calls python interpreter to run the ready-made script.
Far call refers to the script that an existing function is fixed in the machine, and in addition a machine passes through network and the machine It interacts, sends and request to the machine when needing to be implemented the script, the machine receives the foot that request executes the fixed function automatically This, this process is far call.
Either local to call still far call script, precondition is that the machine must have one or more to have existed Script for using.
It is either local on windows platform to call or far call its essence is all the function for executing some script Can, but it is the more processes of a network interaction of far call that far call, which is different from the place locally called, and is called Person is also different, and the caller locally called is the program user of the machine, and the caller of far call is an other machine User.
1. if as soon as you think far call script under Windows environment, then must be obtained on called machine There is the ready-made script for having the function, if this when, you wanted some functions to put into this script, You must go to change this script manually or re-establish a new script, in this case can to user and guardian with It is inconvenient to come, very not flexible.
2. when far call, if you want that, using multiple functional blocks, callee must must just possess accordingly The script of quantity, the quantity of script and the quantity of functional block correspond, if the function of these functional blocks is similar, and Original script is inconvenient to change again, then the script of these identity functions can not just be fused into a script, can thus go out The problem of existing triviality and function repeatability, is unfavorable for the operation of program, efficiency is also relatively low.
Summary of the invention
To solve the above problems, the present invention, which provides a kind of high efficiency under Thrift RPC environment, uses Python script Method.
Technical solution of the present invention is specially:
A method of high efficiency uses Python script under Thrift RPC environment:Execute following step:
1) enter in human-computer interaction interface and wish to carry out interface where functional block, selection wherein some or several function Energy;
2) start Thrift RPC client, connect RPC service end;
3) selected function is sent to by server-side by Thrift RPC client;
4) server-side, which receives, comes from the selected function of man-machine interactively interface user;
5) received function is mapped with function required for function;
6) according to the functional sequence received, the function corresponded to is sequentially arranged in an orderly sequence according to this;
7) buffer area is opened up, the function for required for function, correctly having established Rankine-Hugoniot relations will be executed and write into buffer area In;
8) Python script execution part is called, the script of the buffer area is executed.
Further:The man-machine interactively interface uses web interface.
Further:The step 3) is in Thrift RPC client and server-side transmission process to selected function It is packaged.
Further:The step 8) specifically executes following processes:
1) Python script is read in buffer area;
If 2) there are the other libraries of dependence during perform script, loads and rely on library, it's not true can skip this step;
3) perform script executes emptying buffer after completing.
Compared with the existing technology, technical effect of the invention is;
1)The present invention improves the flexibility of far call Python script utilization, so that no longer limiting to when far call script One or several scripts of Mr. Yu.
2)The efficiency of far call script is improved, needs to be implemented multiple scripts originally, now only needs and executes a foot It originally can solve, effectively reduce the time, improve efficiency.
3)Safety increases, and places data into buffer area and executes, and executes later emptying buffer again, can be effective Prevent script to be maliciously tampered or delete.
Detailed description of the invention
Fig. 1 is design overall flow figure of the invention.
Specific embodiment
A kind of high efficiency under Thrift RPC environment proposed by the present invention uses the method master-plan of Python script On be divided into three parts:Web interface part, Thrift RPC Remote data processing part, Python execution part.Web interface portion Point mainly open that user is given to use, the major function of this part is some or the several function that user can select to be executed Energy.The major function of Thrift RPC Remote data processing part is responsible for remote data communication, and handles obtained data. The major function of Python execution part is to execute some or several functions, these functions and web interface certain customers institute The function of selection mutually corresponds.
Whole flow chart is as shown in Figure 1:
1) enter the interface where the functional block that wishes to carry out in web interface, selection wherein some or several functions;
2) start Thrift RPC client, connect RPC service end;
3) selected function is sent to by server-side by Thrift RPC client;
4) server-side, which receives, comes from the selected function of web interface user;
5) received function is mapped with function required for function;
6) according to the functional sequence received, the function corresponded to is sequentially arranged in an orderly sequence according to this;
7) buffer area is opened up, the function for required for function, correctly having established Rankine-Hugoniot relations will be executed and write into buffer area In the middle;
8) Python script execution part is called, the script of the buffer area is executed.
It is carrying out 8) calling Python script execution part, is executing following step when executing the script of the buffer area:
1) Python script is read in buffer area;
If 2) there are the other libraries of dependence during perform script, loads and rely on library, it's not true can skip this step;
3) perform script executes emptying buffer after completing.
In conjunction with above-mentioned process to web interface part, Thrift RPC Remote data processing part, Python execution part into Row is explained in detail below:
1.Web interface portion
Since this part is that user oriented is open, when interface is opened, user is capable of grasping into you are desired for selectivity Control the interface where function.
1) enter the interface where the functional block that wishes to carry out, selection wherein some or several functions.
2) start Thrift RPC client, connect RPC service end.
3) selected function is sent to by server-side by client.
Selected function will be sealed in transmission process that selected function is sent to server-side in client Dress to solve the problems, such as that format is lost in transmission process, while ensure that transmission safety and efficiency;
2. Thrift RPC Remote data processing part
The function of this part is the core of entire prioritization scheme, it can play the role of one and form a connecting link, and upper energy is same Web interface parts by hand, it is lower to come into contacts with Python execution part.Meanwhile in entire prioritization scheme, this part is also held The role for carrying server-side, when machine rigid starting up, Thrift RPC service end can also be opened with machine startup Dynamic operation.
1) it receives and comes from the selected function of web interface user.
2) function required for received function being executed the function with this part is mapped.
3) according to the functional sequence received, the function corresponded to is sequentially arranged according to this one it is orderly Sequence.
4) open up a buffer area, will execute function required for, correctly established Rankine-Hugoniot relations function write into it is slow It rushes in area.
5) Python script execution part is called, the script of the buffer area is executed.
1) it receiving in the selected function of web interface user, server-side receives the request from client, Server-side understand that a series of selected functions of user as a result,.In existing old scheme, come when server-side receives From when the function request of client, can go that existing script, such as server-side is called to receive client request at once Two functions A and B, then existing call method will go the local script A.py and B.py for retrieving corresponding function then this A script execution is got up, but does so clearly very unreasonable, such words computer if function is very more These functions must be corresponded in the presence of many scripts in the middle, in addition if someone goes to change or delete these scripts, that Corresponding function certainly cannot run succeeded, and have very big risk, be highly detrimental to operation and maintenance.So in this programme In take another new method to change this status.In second step, after receiving the function to be executed, no longer Go it is local retrieve script, but by these execute these functions needed for function be retrieved in a program, after being retrieved It executes third step and these functions is carried out to the sequence of sequencing according to the execution sequence of function, if it says needed for executing function A The function wanted is a1 and a2, and executing the function that function B needs is b1 and b2, if the request sequence of function is AB, we The sequence of function sequence formed herein can be a1, a2, b1, b2.Sequence executes the 4th step after arranging, orderly by these Function composition script write into the buffer area that one is opened up, can effectively prevent script distorting or deleting by malice in this way It removes, greatly improves the safety of script.The the 5) step can be finally executed, by this script to executing.
3. Python execution part
The major function of this part is that the script in buffer area is achieved the effect that user wants to executing.
1) Python script is read in buffer area.
If 2) there are the other libraries of dependence during perform script, loads and rely on library, it's not true can skip this step Suddenly.
3) perform script executes emptying buffer after completing.
The present invention is directed to the status of current far call python script, proposes a kind of optimization method, present invention design By application python script technology more stronger than wide, transplantability and remote technology Thrift RPC in a kind of new method It combines both.I.e. using Thrift RPC, conveniently remote capability realizes the transmission of data, while utilizing script Characteristic realize the execution of some functional block, the two is combined in a kind of new method, to break through the part limitation of script Property, the practicability and popularity of strong extension script.
What has been described above is only a preferred embodiment of the present invention, it is noted that for those skilled in the art, Without depart from that overall concept of the invention, several changes and improvements can also be made, these also should be considered as of the invention Protection scope.

Claims (4)

1. a kind of method that high efficiency under Thrift RPC environment uses Python script, it is characterised in that:Execute following steps Suddenly:
1) enter in human-computer interaction interface and wish to carry out interface where functional block, selection wherein some or several function Energy;
2) start Thrift RPC client, connect RPC service end;
3) selected function is sent to by server-side by Thrift RPC client;
4) server-side, which receives, comes from the selected function of man-machine interactively interface user;
5) received function is mapped with function required for function;
6) according to the functional sequence received, the function corresponded to is sequentially arranged in an orderly sequence according to this;
7) buffer area is opened up, the function for required for function, correctly having established Rankine-Hugoniot relations will be executed and write into buffer area In;
8) Python script execution part is called, the script of the buffer area is executed.
2. the method that a kind of high efficiency under Thrift RPC environment as described in claim 1 uses Python script, special Sign is:The man-machine interactively interface uses web interface.
3. the method that a kind of high efficiency under Thrift RPC environment as described in claim 1 uses Python script, special Sign is:The step 3) is packaged selected function with server-side transmission process in Thrift RPC client.
4. the method that a kind of high efficiency under Thrift RPC environment as described in claim 1 uses Python script, special Sign is:The step 8) specifically executes following processes:
1) Python script is read in buffer area;
If 2) there are the other libraries of dependence during perform script, loads and rely on library, it's not true can skip this step;
3) perform script executes emptying buffer after completing.
CN201810688537.XA 2018-06-28 2018-06-28 A method of high efficiency uses Python script under Thrift RPC environment Pending CN108920286A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810688537.XA CN108920286A (en) 2018-06-28 2018-06-28 A method of high efficiency uses Python script under Thrift RPC environment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810688537.XA CN108920286A (en) 2018-06-28 2018-06-28 A method of high efficiency uses Python script under Thrift RPC environment

Publications (1)

Publication Number Publication Date
CN108920286A true CN108920286A (en) 2018-11-30

Family

ID=64421992

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810688537.XA Pending CN108920286A (en) 2018-06-28 2018-06-28 A method of high efficiency uses Python script under Thrift RPC environment

Country Status (1)

Country Link
CN (1) CN108920286A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110737538A (en) * 2019-10-29 2020-01-31 曹严清 algorithm model calling system based on thrift

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2002044919A1 (en) * 2000-12-01 2002-06-06 Armeen Mazda Method of ∫script⊃ based remote javascript function call of web page
CN101025686A (en) * 2007-03-22 2007-08-29 中兴通讯股份有限公司 Automation test system and test script generating and operating method
CN101571798A (en) * 2008-04-29 2009-11-04 环达电脑(上海)有限公司 Method for generating and using automatic test script
CN103984624A (en) * 2014-04-29 2014-08-13 北京京东尚科信息技术有限公司 Automatic testing method and system for webpage

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2002044919A1 (en) * 2000-12-01 2002-06-06 Armeen Mazda Method of ∫script⊃ based remote javascript function call of web page
CN101025686A (en) * 2007-03-22 2007-08-29 中兴通讯股份有限公司 Automation test system and test script generating and operating method
CN101571798A (en) * 2008-04-29 2009-11-04 环达电脑(上海)有限公司 Method for generating and using automatic test script
CN103984624A (en) * 2014-04-29 2014-08-13 北京京东尚科信息技术有限公司 Automatic testing method and system for webpage

Non-Patent Citations (4)

* Cited by examiner, † Cited by third party
Title
SHUAI LI: "Dubbo"s serialization protocol extension and optimization of its RPC protocol thrift", 《IEEE XPLORE》 *
徐宗昌: "《装备IETM的互操作性与交互性》", 30 April 2014 *
罗坚: "《C语言程序设计》", 29 February 2016 *
董玉德: "《CAD二次开发理论与技术》", 31 October 2009 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110737538A (en) * 2019-10-29 2020-01-31 曹严清 algorithm model calling system based on thrift
CN110737538B (en) * 2019-10-29 2022-03-25 曹严清 Algorithm model calling system based on thrift

Similar Documents

Publication Publication Date Title
US4782517A (en) System and method for defining and providing telephone network services
US7940911B2 (en) Method and apparatus for providing a specialized resource function in a telephone network
EP1808004B1 (en) Providing a service framework at an endpoint
JP4362178B2 (en) Wireless communication apparatus having API between user application program and telephone program and method thereof
US8237664B2 (en) Application adaptive mobile terminal
US7058164B1 (en) Externally interrupting a communication session
KR20100120136A (en) Techniques for transfer error recovery
JPH10336349A (en) Telephone calling method using distributed information retrieval means and computer readable recording medium
CN102054173A (en) Smart card and method for integrating multiple telecom applications on same
EP0981890A1 (en) Methods and apparatus for creating automated servers for display telephones
CN108920286A (en) A method of high efficiency uses Python script under Thrift RPC environment
US20150029898A1 (en) Method, apparatus, and article of manufacture for web-based control of a call server
KR900010588A (en) Application encapsulation system for implications in the purpose management facility and bonding method thereof
CN101452403A (en) Drawing support method and device
US7110521B2 (en) Interface means between a network switch and a CTI server means and apparatus for providing a service to a customer including such an interface means
CN1767679A (en) Terminal for mobile communications
CN106559550A (en) SIM management method and electronic installation
US11876929B2 (en) Second level interactive voice response component
CN113852718B (en) Voice channel establishing method and device, electronic equipment and storage medium
CN109918598A (en) A kind of web page rendering method based on Android TV browser
JPH08280047A (en) Communication system
CN106603797B (en) To method, mobile terminal and the computer readable storage medium of communicating number grouping
US20030046443A1 (en) Updating mobile agents
EP1365322A1 (en) Improvements relating to computer programs
CN100501670C (en) Method for transplanting mobile information equipment onto compact type virtual machine platform

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
RJ01 Rejection of invention patent application after publication

Application publication date: 20181130

RJ01 Rejection of invention patent application after publication