Execute ordered request

        :param ordered: an ordered request
        :return: whether executed
17901
def processOrdered(self, ordered: Ordered):
        

        if ordered.instId not in self.instances.ids:
            logger.warning('{} got ordered request for instance {} which '
                           'does not exist'.format(self, ordered.instId))
            return False

        if ordered.instId != self.instances.masterId:
            # Requests from backup replicas are not executed
            logger.trace("{} got ordered requests from backup replica {}"
                         .format(self, ordered.instId))
            with self.metrics.measure_time(MetricsName.MONITOR_REQUEST_ORDERED_TIME):
                self.monitor.requestOrdered(ordered.valid_reqIdr + ordered.invalid_reqIdr,
                                            ordered.instId,
                                            self.requests,
                                            byMaster=False)
            return False

        logger.trace("{} got ordered requests from master replica"
                     .format(self))

        logger.debug("{} executing Ordered batch {} {} of {} requests; state root {}; txn root {}"
                     .format(self.name,
                             ordered.viewNo,
                             ordered.ppSeqNo,
                             len(ordered.valid_reqIdr),
                             ordered.stateRootHash,
                             ordered.txnRootHash))

        three_pc_batch = ThreePcBatch.from_ordered(ordered)
        if self.db_manager.ledgers[AUDIT_LEDGER_ID].uncommittedRootHash is None:
            # if we order request during view change
            # in between catchup rounds, then the 3PC batch will not be applied,
            # since it was reverted before catchup started, and only COMMITs were
            # processed in between catchup that led to this ORDERED msg
            logger.info("{} applying stashed requests for batch {} {} of {} requests; state root {}; txn root {}"
                        .format(self.name,
                                three_pc_batch.view_no,
                                three_pc_batch.pp_seq_no,
                                len(three_pc_batch.valid_digests),
                                three_pc_batch.state_root,
                                three_pc_batch.txn_root))

            self.apply_stashed_reqs(three_pc_batch)

        self.executeBatch(three_pc_batch,
                          ordered.valid_reqIdr,
                          ordered.invalid_reqIdr,
                          ordered.auditTxnRootHash)

        with self.metrics.measure_time(MetricsName.MONITOR_REQUEST_ORDERED_TIME):
            self.monitor.requestOrdered(ordered.valid_reqIdr + ordered.invalid_reqIdr,
                                        ordered.instId,
                                        self.requests,
                                        byMaster=True)

        return True
291853
def as_ordered(self, inplace=False):
        
        inplace = validate_bool_kwarg(inplace, 'inplace')
        return self.set_ordered(True, inplace=inplace)
86321
def execute(self):
        
        if hasattr(self, "_executed"):
            return self._executed

        es = connections.get_connection(self._using)

        if getattr(self, "_full", False) is False:
            self._executed = ShallowResponse(es.search(index=self._index,
                                                   doc_type=self._doc_type,
                                                   body=self.to_dict(),
                                                   **self._params),
                                         callbacks=self._doc_type_map)
        else:
            self._executed = FullResponse(es.search(index=self._index,
                                                doc_type=self._doc_type,
                                                body=self.to_dict(),
                                                **self._params))

        return self._executed
950921
async def execute(self, *, return_exceptions=False):
        
        assert not self._done, "Pipeline already executed. Create new one."
        self._done = True

        if self._pipeline:
            if isinstance(self._pool_or_conn, AbcPool):
                async with self._pool_or_conn.get() as conn:
                    return await self._do_execute(
                        conn, return_exceptions=return_exceptions)
            else:
                return await self._do_execute(
                    self._pool_or_conn,
                    return_exceptions=return_exceptions)
        else:
            return await self._gather_result(return_exceptions)
84875
def execute(asynchronous: bool = False):
    
    r = Response()
    r.update(server=server_runner.get_server_data())

    cmd, args = parse_command_args(r)
    if r.failed:
        return flask.jsonify(r.serialize())

    try:
        commander.execute(cmd, args, r)
        if not r.thread:
            return flask.jsonify(r.serialize())

        if not asynchronous:
            r.thread.join()

        server_runner.active_execution_responses[r.thread.uid] = r

        # Watch the thread for a bit to see if the command finishes in
        # that time. If it does the command result will be returned directly
        # to the caller. Otherwise, a waiting command will be issued
        count = 0
        while count < 5:
            count += 1
            r.thread.join(0.25)
            if not r.thread.is_alive():
                break

        if r.thread.is_alive():
            return flask.jsonify(
                Response()
                .update(
                    run_log=r.get_thread_log(),
                    run_status='running',
                    run_uid=r.thread.uid,
                    step_changes=server_runner.get_running_step_changes(True),
                    server=server_runner.get_server_data()
                )
                .serialize()
            )

        del server_runner.active_execution_responses[r.thread.uid]
        r.update(
            run_log=r.get_thread_log(),
            run_status='complete',
            run_multiple_updates=False,
            run_uid=r.thread.uid
        )
    except Exception as err:
        r.fail(
            code='KERNEL_EXECUTION_FAILURE',
            message='Unable to execute command',
            cmd=cmd,
            args=args,
            error=err
        )

    return flask.jsonify(r.serialize())
521298
def execute(self, ignore_cache=False, raise_on_error=True):
        
        if ignore_cache or not hasattr(self, '_response'):
            es = connections.get_connection(self._using)

            responses = es.msearch(
                index=self._index,
                body=self.to_dict(),
                **self._params
            )

            out = []
            for s, r in zip(self._searches, responses['responses']):
                if r.get('error', False):
                    if raise_on_error:
                        raise TransportError('N/A', r['error']['type'], r['error'])
                    r = None
                else:
                    r = Response(s, r)
                out.append(r)

            self._response = out

        return self._response
251385
def derive_ordering(self):
        
        if '_order' in self.request.GET:
            return self.request.GET['_order']
        elif self.default_order:
            return self.default_order
        else:
            return None
731790
def do_execute(self):
        
        if isinstance(self.input.payload, Instance):
            inst = self.input.payload
            data = Instances.template_instances(inst.dataset, 1)
            data.add_instance(inst)
        else:
            inst = None
            data = self.input.payload
        relname = data.relationname
        keep = self.resolve_option("keep_relationname")

        if inst is None:
            if (self._filter is None) or self._header.equal_headers(data) is not None:
                self._header = Instances.template_instances(data)
                self._filter = filters.Filter.make_copy(self.resolve_option("setup"))
                self._filter.inputformat(data)
            filtered = self._filter.filter(data)
            if keep:
                filtered.relationname = relname
            self._output.append(Token(filtered))
        else:
            if (self._filter is None) or self._header.equal_headers(data) is not None:
                self._header = Instances.template_instances(data)
                self._filter = filters.Filter.make_copy(self.resolve_option("setup"))
                self._filter.inputformat(data)
                filtered = self._filter.filter(data)
                if keep:
                    filtered.relationname = relname
                self._output.append(Token(filtered.get_instance(0)))
            else:
                self._filter.input(inst)
                self._filter.batch_finished()
                filtered = self._filter.output()
                if keep:
                    filtered.dataset.relationname = relname
                self._output.append(Token(filtered))

        return None
504483
def show_order(self, order_id):
        """"""
        request = self._get('transactions/orders/' + str(order_id))
        return self.responder(request)
468578
def execute(self, request, *args, **path_args):
        # type: (BaseHttpRequest, tuple, Dict[Any]) -> Any
        
        binding = self.binding
        if binding:
            # Provide binding as decorators are executed prior to binding
            return self.callback(binding, request, *args, **path_args)
        else:
            return self.callback(request, *args, **path_args)
615908
def order(self, order=None):
        
        if order is None:
            return int(self.url.order)
        self.url.order = str(order)
757967
def execute(self, ignore_cache=False):
        
        if ignore_cache or not hasattr(self, '_response'):
            es = connections.get_connection(self._using)

            self._response = self._response_class(
                self,
                es.search(
                    index=self._index,
                    body=self.to_dict(),
                    **self._params
                )
            )
        return self._response
696541
def filter_queryset(self, request, queryset, view):
        "
        self.ordering_param = view.SORT

        ordering = self.get_ordering(request, queryset, view)
        if ordering:
            return queryset.order_by(*ordering)

        return queryset
1310176
def is_request_sent(request, relation='ceph'):
    
    states = get_request_states(request, relation=relation)
    for rid in states.keys():
        if not states[rid]['sent']:
            return False

    return True
1206538
def placeOrder(self, contract, order, orderId=None, account=None):
        

        # get latest order id before submitting an order
        self.requestOrderIds()

        # continue...
        useOrderId = self.orderId if orderId == None else orderId
        if account:
            order.m_account = account
        self.ibConn.placeOrder(useOrderId, contract, order)

        account_key = order.m_account
        self.orders[useOrderId] = {
            "id":       useOrderId,
            "symbol":   self.contractString(contract),
            "contract": contract,
            "status":   "SENT",
            "reason":   None,
            "avgFillPrice": 0.,
            "parentId": 0,
            "time": datetime.fromtimestamp(int(self.time)),
            "account": None
        }
        if hasattr(order, "m_account"):
            self.orders[useOrderId]["account"] = order.m_account

        # return order id
        return useOrderId
360172
def execute(self, return_results=True):
        '''
        
        '''
        if self.results:
            return self.results if return_results else None

        self.execute_raw()

        if self._raw_results_only:
            self.results = self.raw_results
        else:
            self.map_results()

        if return_results:
            return self.results
284585
def do_execute(self):
        
        self.first_active.input = self.input
        result = self._director.execute()
        if result is None:
            self._output.append(self.input)
        return result