parameters: (self, worker)
docstring: Executes the closure on the given worker.
  
      Args:
        worker: a `Worker` object.
docstring_summary: Executes the closure on the given worker.
docstring_tokens: Executes the closure on the given worker .
function: def execute_on(self, worker):
      """Executes the closure on the given worker.
  
      Args:
        worker: a `Worker` object.
      """
      replica_args = _select_worker_slice(worker.worker_index, self._args)
      replica_kwargs = _select_worker_slice(worker.worker_index, self._kwargs)
  
      e = (
          _maybe_rebuild_remote_values(worker, replica_args) or
          _maybe_rebuild_remote_values(worker, replica_kwargs))
      if e:
        if not isinstance(e, InputError):
          e = InputError(e)
        raise e
  
      with ops.device(worker.device_name):
        with context.executor_scope(worker.executor):
          with coordinator_context.with_dispatch_context(worker):
            with metric_utils.monitored_timer("closure_execution"):
              output_values = self._function(
                  *nest.map_structure(_maybe_get_remote_value, replica_args),
                  **nest.map_structure(_maybe_get_remote_value, replica_kwargs))
      self.maybe_call_with_output_remote_value(
          lambda r: r._set_values(output_values))
function_tokens: def execute_on ( self , worker ) : replica_args = _select_worker_slice ( worker . worker_index , self . _args ) replica_kwargs = _select_worker_slice ( worker . worker_index , self . _kwargs ) e = ( _maybe_rebuild_remote_values ( worker , replica_args ) or _maybe_rebuild_remote_values ( worker , replica_kwargs ) ) if e : if not isinstance ( e , InputError ) : e = InputError ( e ) raise e with ops . device ( worker . device_name ) : with context . executor_scope ( worker . executor ) : with coordinator_context . with_dispatch_context ( worker ) : with metric_utils . monitored_timer ( "closure_execution" ) : output_values = self . _function ( * nest . map_structure ( _maybe_get_remote_value , replica_args ) , * * nest . map_structure ( _maybe_get_remote_value , replica_kwargs ) ) self . maybe_call_with_output_remote_value ( lambda r : r . _set_values ( output_values ) )