@gen.coroutine
  def _ExecuteAll(self, operation_id=None):
    """Tries to acquire the operation lock. If it is acquired, queries for each operation owned
    by the user and executes each in turn.
    """
    self._requery = False

    results = yield gen.Task(Lock.TryAcquire,
                             self._client,
                             LockResourceType.Operation,
                             str(self._user_id),
                             resource_data=operation_id,
                             detect_abandonment=True)
    self._lock, status = results.args

    if status == Lock.FAILED_TO_ACQUIRE_LOCK:
      # Another server has the lock, so can't wait synchronously for the operations to complete.
      # TODO(Andy): We could poll the operations table if we want to support this.
      for operation_id in self._sync_cb_map.keys():
        self._InvokeSyncCallbacks(operation_id, CannotWaitError,
                                  'Cannot wait for the operation to complete, because another server '
                                  'owns the operation lock.')
      return

    try:
      next_ops = None
      if status == Lock.ACQUIRED_ABANDONED_LOCK and self._lock.resource_data is not None:
        # Execute the operation stored in lock.resource_data if it still exists. It is important
        # to continue with whatever operation was currently running when the abandon occurred.
        # This is because that operation may have only been partly complete.
        op = yield gen.Task(Operation.Query,
                            self._client,
                            self._user_id,
                            self._lock.resource_data,
                            col_names=None,
                            must_exist=False,
                            consistent_read=True)
        next_ops = [op]

      last_op_id = None
      while True:
        if next_ops is None:
          # Get 10 ops at a time, looking for one that is not in quarantine.
          # Use consistent reads, in order to avoid reading already deleted operations. We've
          # seen cases where an op runs, then deletes itself, but then an inconsistent read
          # gets an old version that hasn't yet been deleted and re-runs it.
          next_ops = yield gen.Task(Operation.RangeQuery,
                                    self._client,
                                    self._user_id,
                                    range_desc=None,
                                    limit=10,
                                    col_names=None,
                                    excl_start_key=last_op_id,
                                    consistent_read=True)
          if len(next_ops) == 0:
            # No more operations to process.
            break

        for op in next_ops:
          # Run the op if it is not in quarantine or if it's no longer in backoff.
          if not op.quarantine or not op.IsBackedOff():
            yield self._ExecuteOp(op)

            # Look for next op to run; always run earliest op possible.
            last_op_id = None
            break
          else:
            # Skip quarantined operation.
            logging.info('queried quarantined operation "%s", user %d backed off for %.2fs; skipping...' %
                         (op.operation_id, op.user_id, time.time() - op.backoff))
            last_op_id = op.operation_id

        next_ops = None
    finally:
      # Release the operation lock.
      yield gen.Task(self._lock.Release, self._client)

      if self._lock.acquire_failures is not None:
        # Another caller tried to acquire the lock, so there may be more operations available.
        logging.info('other servers tried to acquire lock "%s"; there may be more operations pending' % self._lock)
        self._requery = True
dataset/ETHPy150Open viewfinderco/viewfinder/backend/op/user_op_manager.py/UserOpManager._ExecuteAll/swapped operands of `-`