def __call__(self, op):
    'Choose a ps task index for the given `Operation`.\n\n    Args:\n      op: An `Operation` to be placed on ps.\n\n    Returns:\n      The next ps task index to use for the `Operation`. Returns the next\n      index, in the range `[offset, offset + num_tasks)`.\n\n    Raises:\n      ValueError: If attempting to place non-PS Op.\n    '
    if (op.type not in self._next_task_per_op):
        raise ValueError(("Unknown op type '%s' for placement:" % op.type))
    task = self._next_task_per_op[op.type]
    self._next_task_per_op[op.type] = (((task + 1) % self._num_tasks) if self._num_tasks else 0)
    return task
Choose a ps task index for the given `Operation`.

Args:
  op: An `Operation` to be placed on ps.

Returns:
  The next ps task index to use for the `Operation`. Returns the next
  index, in the range `[offset, offset + num_tasks)`.

Raises:
  ValueError: If attempting to place non-PS Op.
def __call__(self, op):
    'Choose a ps task index for the given `Operation`.\n\n    Args:\n      op: An `Operation` to be placed on ps.\n\n    Returns:\n      The next ps task index to use for the `Operation`. Returns the next\n      index, in the range `[offset, offset + num_tasks)`.\n\n    Raises:\n      ValueError: If attempting to place non-PS Op.\n    '
    if (op.type not in self._next_task_per_op):
        raise ValueError(("Unknown op type '%s' for placement:" % op.type))
    task = self._next_task_per_op[op.type]
    self._next_task_per_op[op.type] = (((task + 1) % self._num_tasks) if self._num_tasks else 0)
    return task