def adaptation(operator, operation_context): rendezvous = _control.Rendezvous(operator, operation_context) outcome = operation_context.add_termination_callback(rendezvous.set_outcome) if outcome is None: pool.submit(_control.pool_wrap(in_pool, operation_context), rendezvous) return utilities.full_subscription(rendezvous) else: raise abandonment.Abandoned()
def _invoke(end, group, method, timeout, initial_metadata, payload, complete): rendezvous = _control.Rendezvous(None, None) operation_context, operator = end.operate( group, method, utilities.full_subscription(rendezvous), timeout, initial_metadata=initial_metadata, payload=payload, completion=_EMPTY_COMPLETION if complete else None) rendezvous.set_operator_and_context(operator, operation_context) outcome = operation_context.add_termination_callback(rendezvous.set_outcome) if outcome is not None: rendezvous.set_outcome(outcome) return rendezvous, operation_context, outcome
def adaptation(group, method, operator, operation_context): rendezvous = _control.Rendezvous(operator, operation_context) outcome = operation_context.add_termination_callback(rendezvous.set_outcome) if outcome is None: def in_pool(): request_consumer = multi_method( group, method, rendezvous, _ServicerContext(rendezvous)) for request in rendezvous: request_consumer.consume(request) request_consumer.terminate() pool.submit(_control.pool_wrap(in_pool, operation_context), rendezvous) return utilities.full_subscription(rendezvous) else: raise abandonment.Abandoned()