aboutsummaryrefslogtreecommitdiffstats
path: root/lib/dominoRPC/Communication-remote
diff options
context:
space:
mode:
authorUlas Kozat <ulas.kozat@gmail.com>2016-05-15 21:31:15 -0700
committerUlas Kozat <ulas.kozat@gmail.com>2016-05-15 21:43:21 -0700
commit7893dd02c15f2a727eb50887c9ddb829fc71f556 (patch)
tree54efcdadfda729ec4301537d264f6ea4298716e9 /lib/dominoRPC/Communication-remote
parent06f85217ae3d5c9b429bad94827caed0641cd120 (diff)
Simple mapper/scheduler/partitioner functions implemented
Change-Id: I553b196943022451d8dc4984fe37b2b228c8f4cf Signed-off-by: Ulas C. Kozat <ulas.kozat@huawei.com>
Diffstat (limited to 'lib/dominoRPC/Communication-remote')
-rwxr-xr-xlib/dominoRPC/Communication-remote129
1 files changed, 129 insertions, 0 deletions
diff --git a/lib/dominoRPC/Communication-remote b/lib/dominoRPC/Communication-remote
new file mode 100755
index 0000000..77a96d7
--- /dev/null
+++ b/lib/dominoRPC/Communication-remote
@@ -0,0 +1,129 @@
+#!/usr/bin/env python
+#
+# Autogenerated by Thrift Compiler (0.9.3)
+#
+# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+#
+# options string: py
+#
+
+import sys
+import pprint
+from urlparse import urlparse
+from thrift.transport import TTransport
+from thrift.transport import TSocket
+from thrift.transport import TSSLSocket
+from thrift.transport import THttpClient
+from thrift.protocol import TBinaryProtocol
+
+from domino import Communication
+from domino.ttypes import *
+
+if len(sys.argv) <= 1 or sys.argv[1] == '--help':
+ print('')
+ print('Usage: ' + sys.argv[0] + ' [-h host[:port]] [-u url] [-f[ramed]] [-s[sl]] function [arg1 [arg2...]]')
+ print('')
+ print('Functions:')
+ print(' HeartBeatMessage d_heartbeat(HeartBeatMessage msg)')
+ print(' RegisterResponseMessage d_register(RegisterMessage msg)')
+ print(' SubscribeResponseMessage d_subscribe(SubscribeMessage msg)')
+ print(' PublishResponseMessage d_publish(PublishMessage msg)')
+ print(' PushResponseMessage d_push(PushMessage msg)')
+ print(' QueryResponseMessage d_query(QueryMessage msg)')
+ print('')
+ sys.exit(0)
+
+pp = pprint.PrettyPrinter(indent = 2)
+host = 'localhost'
+port = 9090
+uri = ''
+framed = False
+ssl = False
+http = False
+argi = 1
+
+if sys.argv[argi] == '-h':
+ parts = sys.argv[argi+1].split(':')
+ host = parts[0]
+ if len(parts) > 1:
+ port = int(parts[1])
+ argi += 2
+
+if sys.argv[argi] == '-u':
+ url = urlparse(sys.argv[argi+1])
+ parts = url[1].split(':')
+ host = parts[0]
+ if len(parts) > 1:
+ port = int(parts[1])
+ else:
+ port = 80
+ uri = url[2]
+ if url[4]:
+ uri += '?%s' % url[4]
+ http = True
+ argi += 2
+
+if sys.argv[argi] == '-f' or sys.argv[argi] == '-framed':
+ framed = True
+ argi += 1
+
+if sys.argv[argi] == '-s' or sys.argv[argi] == '-ssl':
+ ssl = True
+ argi += 1
+
+cmd = sys.argv[argi]
+args = sys.argv[argi+1:]
+
+if http:
+ transport = THttpClient.THttpClient(host, port, uri)
+else:
+ socket = TSSLSocket.TSSLSocket(host, port, validate=False) if ssl else TSocket.TSocket(host, port)
+ if framed:
+ transport = TTransport.TFramedTransport(socket)
+ else:
+ transport = TTransport.TBufferedTransport(socket)
+protocol = TBinaryProtocol.TBinaryProtocol(transport)
+client = Communication.Client(protocol)
+transport.open()
+
+if cmd == 'd_heartbeat':
+ if len(args) != 1:
+ print('d_heartbeat requires 1 args')
+ sys.exit(1)
+ pp.pprint(client.d_heartbeat(eval(args[0]),))
+
+elif cmd == 'd_register':
+ if len(args) != 1:
+ print('d_register requires 1 args')
+ sys.exit(1)
+ pp.pprint(client.d_register(eval(args[0]),))
+
+elif cmd == 'd_subscribe':
+ if len(args) != 1:
+ print('d_subscribe requires 1 args')
+ sys.exit(1)
+ pp.pprint(client.d_subscribe(eval(args[0]),))
+
+elif cmd == 'd_publish':
+ if len(args) != 1:
+ print('d_publish requires 1 args')
+ sys.exit(1)
+ pp.pprint(client.d_publish(eval(args[0]),))
+
+elif cmd == 'd_push':
+ if len(args) != 1:
+ print('d_push requires 1 args')
+ sys.exit(1)
+ pp.pprint(client.d_push(eval(args[0]),))
+
+elif cmd == 'd_query':
+ if len(args) != 1:
+ print('d_query requires 1 args')
+ sys.exit(1)
+ pp.pprint(client.d_query(eval(args[0]),))
+
+else:
+ print('Unrecognized method %s' % cmd)
+ sys.exit(1)
+
+transport.close()