Example #1
0
    def get(self):
        parser = reqparse.RequestParser()
        parser.add_argument('task_type')
        parser.add_argument('confirmed')
        args = parser.parse_args()
        task_type = args['task_type']
        confirmed = args['confirmed']
        print 'task_type:', task_type, 'confirmed:', confirmed
        t = time.clock()
        response = self.sender.sync_send(Message(content={
            'task_type': task_type,
            'confirmed': confirmed,
        },
                                                 correlation_id='task_list'),
                                         timeout=3)
        print 'get cost time: {}'.format(time.clock() - t)
        if response:
            try:
                resp = make_response(zlib.decompress(response.content))
                resp.headers['content-type'] = 'text/plain'
                return resp
            except:
                pass

        abort(404, message="fetch research task list failed.")
Example #2
0
 def delete(self, task_id):
     task_list = [task_id]
     self.sender.send(
         Message(content=json.dumps(task_list),
                 correlation_id='task_delete'))
     # response = sender.sync_send(Message(content=json.dumps(task_list), correlation_id='task_delete'), timeout=3)
     # update_list = json.loads(response.content)
     return '', 202
Example #3
0
 def post(self):
     parser = reqparse.RequestParser()
     parser.add_argument('investable_bond_list', type=list, location='json')
     args = parser.parse_args()
     print args
     investable_bond_list = args['investable_bond_list']
     self.sender.send(
         Message(content=json.dumps(investable_bond_list),
                 correlation_id='investment_pool_add'))
     return '', 202
Example #4
0
 def post(self):
     parser = reqparse.RequestParser()
     parser.add_argument('task_list', type=list, location='json')
     args = parser.parse_args()
     print args
     task_list = args['task_list']
     self.sender.send(
         Message(content=json.dumps(task_list), correlation_id='task_add'))
     # response = sender.sync_send(Message(content=json.dumps(task_list), correlation_id='task_add'), timeout=3)
     # update_list = json.loads(response.content)
     return '', 202
Example #5
0
File: rest.py Project: qazzcl/jssp
    def put(self, key):
        parser = reqparse.RequestParser()
        parser.add_argument('bonds', type=list, location='json')
        args = parser.parse_args()
        print args
        investable_bond = args['bonds']
        investable_bond['key'] = key
        investable_bond_list = [investable_bond]

        self.sender.send(
            Message(content=json.dumps(investable_bond_list),
                    correlation_id='investment_pool_update'))
        return '', 202
Example #6
0
    def put(self, order_id):
        parser = reqparse.RequestParser()
        parser.add_argument('order', type=list, location='json')
        args = parser.parse_args()
        print args
        order = args['order']
        order['order_id'] = order_id
        order_list = [order]

        self.sender.send(
            Message(content=json.dumps(order_list),
                    correlation_id='money_order_update'))
        return '', 202
Example #7
0
    def put(self, task_id):
        parser = reqparse.RequestParser()
        parser.add_argument('task', type=list, location='json')
        args = parser.parse_args()
        print args
        task = args['task']
        task['task_id'] = task_id
        task_list = [task]

        self.sender.send(
            Message(content=json.dumps(task_list),
                    correlation_id='manager_task_update'))
        return '', 202
Example #8
0
    def get(self):
        t = time.clock()
        response = self.sender.sync_send(Message(correlation_id='order_list'),
                                         timeout=3)
        print 'get cost time: {}'.format(time.clock() - t)
        if response:
            try:
                resp = make_response(zlib.decompress(response.content))
                resp.headers['content-type'] = 'text/plain'
                return resp
            except:
                pass

        abort(404, message="fetch money order list failed.")
Example #9
0
File: rest.py Project: qazzcl/jssp
    def get(self, key):
        t = time.clock()
        response = self.sender.sync_send(Message(content={'key': key},
                                                 correlation_id='demo1'),
                                         timeout=3)
        print 'get cost time: {}'.format(time.clock() - t)
        if response:
            try:
                resp = make_response(zlib.decompress(response.content))
                resp.headers['content-type'] = 'text/plain'
                return resp
            except:
                pass

        abort(404, message="Demo1: get method failed.")
Example #10
0
    def get(self, task_id):
        t = time.clock()
        response = self.sender.sync_send(Message(content={'task_id': task_id},
                                                 correlation_id='single_task'),
                                         timeout=3)
        print 'get cost time: {}'.format(time.clock() - t)
        if response:
            try:
                resp = make_response(zlib.decompress(response.content))
                resp.headers['content-type'] = 'text/plain'
                return resp
            except:
                pass

        abort(404, message="fetch manager bond task failed.")
Example #11
0
    def get(self, bond_key_listed_market):
        t = time.clock()
        response = self.sender.sync_send(Message(
            content={'bond_key_listed_market': bond_key_listed_market},
            correlation_id='bond'),
                                         timeout=3)
        print 'get cost time: {}'.format(time.clock() - t)
        if response:
            try:
                resp = make_response(zlib.decompress(response.content))
                resp.headers['content-type'] = 'text/plain'
                return resp
            except:
                pass

        abort(404, message="fetch bond info failed.")
Example #12
0
    def post(self):
        parser = reqparse.RequestParser()
        parser.add_argument('filter_params', type=dict, location='json')
        args = parser.parse_args()
        filter_params = args['filter_params']
        t = time.clock()
        response = self.sender.sync_send(Message(
            content=json.dumps(filter_params), correlation_id='import'),
                                         timeout=30)
        print 'get cost time: {}'.format(time.clock() - t)
        if response:
            try:
                resp = make_response(zlib.decompress(response.content))
                resp.headers['content-type'] = 'text/plain'
                return resp
            except:
                pass

        abort(404, message="fetch account cash failed.")
Example #13
0
    def get(self):
        parser = reqparse.RequestParser()
        parser.add_argument('bond_key_listed_market')
        args = parser.parse_args()
        bond_key_listed_market = args['bond_key_listed_market']
        print 'bond_key_listed_market:', bond_key_listed_market
        t = time.clock()
        response = self.sender.sync_send(Message(
            content={'bond_key_listed_market': bond_key_listed_market},
            correlation_id='order_list'),
                                         timeout=3)
        print 'get cost time: {}'.format(time.clock() - t)
        if response:
            try:
                resp = make_response(zlib.decompress(response.content))
                resp.headers['content-type'] = 'text/plain'
                return resp
            except:
                pass

        abort(404, message="fetch secondary order list failed.")
Example #14
0
    def get(self):
        parser = reqparse.RequestParser()
        parser.add_argument('investable')
        args = parser.parse_args()
        investable = args['investable']
        print 'investable:', investable
        t = time.clock()
        response = self.sender.sync_send(Message(
            content={'investable': investable},
            correlation_id='investment_pool'),
                                         timeout=3)
        print 'get cost time: {}'.format(time.clock() - t)
        if response:
            try:
                resp = make_response(zlib.decompress(response.content))
                resp.headers['content-type'] = 'text/plain'
                return resp
            except:
                pass

        abort(404, message="fetch investable bond list failed.")
Example #15
0
File: rest.py Project: qazzcl/jssp
    def get(self):
        parser = reqparse.RequestParser()
        parser.add_argument('type')
        parser.add_argument('status')
        args = parser.parse_args()
        task_type = args['type']
        status = args['status']
        t = time.clock()
        response = self.sender.sync_send(Message(content={
            'task_type': task_type,
            'status': status,
        },
                                                 correlation_id='demo2_get'),
                                         timeout=3)
        print 'get cost time: {}'.format(time.clock() - t)
        if response:
            try:
                resp = make_response(zlib.decompress(response.content))
                resp.headers['content-type'] = 'text/plain'
                return resp
            except:
                pass

        abort(404, message="Demo2: get method failed.")
Example #16
0
 def delete(self, order_id):
     order_list = [order_id]
     self.sender.send(
         Message(content=json.dumps(order_list),
                 correlation_id='money_order_delete'))
     return '', 202
Example #17
0
 def delete(self, task_id):
     task_list = [task_id]
     self.sender.send(
         Message(content=json.dumps(task_list),
                 correlation_id='manager_task_delete'))
     return '', 202
Example #18
0
 def delete(self, bond_key_listed_market):
     investable_bond_list = [bond_key_listed_market]
     self.sender.send(
         Message(content=json.dumps(investable_bond_list),
                 correlation_id='investment_pool_delete'))
     return '', 202