"Hello, punk", } >>> ''' class HelloWorldService(ServiceBase): @srpc(String, Integer, _returns=Iterable(String)) def say_hello(name, times): ''' Docstrings for service methods appear as documentation in the wsdl <b>what fun</b> @param name the name to say hello to @param the number of times to say hello @return the completed array ''' for i in range(times): yield 'Hello, %s' % name if __name__=='__main__': logging.basicConfig(level=logging.DEBUG) logging.getLogger('rpclib.protocol.xml').setLevel(logging.DEBUG) logging.info("listening to http://127.0.0.1:7789") logging.info("wsdl is at: http://localhost:7789/?wsdl") wsgi_app = wsgi_soap_application([HelloWorldService], 'rpclib.examples.hello.soap') server = make_server('127.0.0.1', 7789, wsgi_app) server.serve_forever()
logging.error("No data set with name: "+data_set_name) else: input = base_dfs_dir+"snat_datasets/"+dataset[0] output = base_dfs_dir+"snat_output/"+algorithm_name+"-"+data_set_name+"-"+str(int(time())) cmd = [hadoop_dir+"bin/hadoop","jar","algorithms/"+algo[0][1],algo[0][2],input,output] logging.info(cmd) ret = subprocess.call(cmd) cmd = [hadoop_dir+"bin/hadoop","dfs","-cat",output+"/part-r-00000"] ret2 = subprocess.check_output(cmd) return ByteArray.from_string(ret2) return ByteArray.from_string("fail!") @srpc(String, _returns=String) def show_status(required_data): # TODO: pass proper data to required_data cmd = ["curl","localhost:"+required_data] return subprocess.check_output(cmd) if __name__=='__main__': logging.basicConfig(level=logging.DEBUG) logging.getLogger('rpclib.protocol.xml').setLevel(logging.DEBUG) logging.info("listening to http://127.0.0.1:7792") logging.info("wsdl is at: http://localhost:7792/?wsdl") wsgi_app = wsgi_soap_application([SnatService], 'warwick.snat.soap') server = make_server('127.0.0.1', 7792, wsgi_app) server.serve_forever()
''' class HelloWorldService(ServiceBase): @srpc(String, Integer, _returns=Iterable(String)) def say_hello(name, times): ''' Docstrings for service methods appear as documentation in the wsdl <b>what fun</b> @param name the name to say hello to @param the number of times to say hello @return the completed array ''' for i in range(times): yield 'Hello, %s' % name if __name__ == '__main__': logging.basicConfig(level=logging.DEBUG) logging.getLogger('rpclib.protocol.xml').setLevel(logging.DEBUG) logging.info("listening to http://127.0.0.1:7789") logging.info("wsdl is at: http://localhost:7789/?wsdl") wsgi_app = wsgi_soap_application([HelloWorldService], 'rpclib.examples.hello.soap') server = make_server('127.0.0.1', 7789, wsgi_app) server.serve_forever()