Module Expr Str ImportFrom alias ImportFrom alias alias ImportFrom alias ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr Call NameLoad Str decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Expr Str Assign NameStore Call NameLoad BinOpAdd NameLoad Num Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Num Expr Call AttributeLoad AttributeLoad NameLoad attr attr Str Dict NameLoad NameLoad Assign SubscriptStore AttributeLoad NameLoad attr Index NameLoad NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Return Call NameLoad AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign AttributeStore NameLoad attr Call NameLoad AttributeLoad AttributeLoad NameLoad attr attr Assign AttributeStore NameLoad attr Call NameLoad Expr Call AttributeLoad AttributeLoad NameLoad attr attr Str AttributeLoad NameLoad attr Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults body Expr Str If CompareIs NameLoad NameLoad body Expr Call AttributeLoad NameLoad attr orelse If Call NameLoad NameLoad NameLoad body Expr Call AttributeLoad NameLoad attr Return NameLoad orelse Expr Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Expr Str If AttributeLoad NameLoad attr body Expr Call AttributeLoad AttributeLoad NameLoad attr attr Str AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr orelse Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Expr Str Expr Call AttributeLoad AttributeLoad NameLoad attr attr Str AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Expr Call AttributeLoad AttributeLoad NameLoad attr attr Str NameLoad Assign NameStore ListComp Call NameLoad AttributeLoad AttributeLoad NameLoad attr attr NameLoad NameLoad NameLoad comprehension TupleStore NameStore NameStore Call AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad AttributeLoad AttributeLoad NameLoad attr attr attr AttributeLoad AttributeLoad NameLoad attr attr NameLoad For NameStore NameLoad body Expr Call NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Expr Call AttributeLoad AttributeLoad NameLoad attr attr Str NameLoad For TupleStore NameStore NameStore Call AttributeLoad NameLoad attr body Assign SubscriptStore AttributeLoad AttributeLoad NameLoad attr attr Index NameLoad NameLoad Expr Call AttributeLoad AttributeLoad NameLoad attr attr Num Num decorator_list FunctionDef arguments args NameParam defaults body Expr Str Expr Call AttributeLoad AttributeLoad NameLoad attr attr Str Expr Call AttributeLoad AttributeLoad NameLoad attr attr Num Num decorator_list decorator_list
N/A N/A 
Context manager to commit/rollback consumer offsets.
 logging getLogger kafka.errors check_error OffsetOutOfRangeError kafka.structs OffsetCommitRequestPayload OffsetCommitContext N/A object N/A N/A 
    Provides commit/rollback semantics around a `SimpleConsumer`.

    Usage assumes that `auto_commit` is disabled, that messages are consumed in
    batches, and that the consuming process will record its own successful
    processing of each message. Both the commit and rollback operations respect
    a "high-water mark" to ensure that last unsuccessfully processed message
    will be retried.

    Example:

    .. code:: python

        consumer = SimpleConsumer(client, group, topic, auto_commit=False)
        consumer.provide_partition_info()
        consumer.fetch_last_known_offsets()

        while some_condition:
            with OffsetCommitContext(consumer) as context:
                messages = consumer.get_messages(count, block=False)

                for partition, message in messages:
                    if can_process(message):
                        context.mark(partition, message.offset)
                    else:
                        break

                if not context:
                    sleep(delay)


    These semantics allow for deferred message processing (e.g. if `can_process`
    compares message time to clock time) and for repeated processing of the last
    unsuccessful message (until some external error is resolved).
     __init__ N/A N/A self consumer N/A N/A N/A 
        :param consumer: an instance of `SimpleConsumer`
         N/A N/A self consumer consumer N/A N/A self initial_offsets None N/A N/A self high_water_mark None N/A N/A self logger N/A getLogger kafka.context N/A mark N/A N/A self partition offset N/A N/A N/A 
        Set the high-water mark in the current context.

        In order to know the current partition, it is helpful to initialize
        the consumer to provide partition info via:

        .. code:: python

            consumer.provide_partition_info()

         N/A max_offset N/A max N/A offset 1 N/A N/A N/A self high_water_mark get partition 0 N/A N/A N/A N/A self logger debug Setting high-water mark to: %s N/A partition max_offset N/A N/A N/A self high_water_mark N/A partition max_offset N/A __nonzero__ N/A N/A self N/A N/A N/A 
        Return whether any operations were marked in the context.
         N/A N/A bool N/A self high_water_mark N/A __enter__ N/A N/A self N/A N/A N/A 
        Start a new context:

         -  Record the initial offsets for rollback
         -  Reset the high-water mark
         N/A N/A self initial_offsets N/A dict N/A N/A self consumer offsets N/A N/A self high_water_mark N/A dict N/A N/A N/A N/A self logger debug Starting context at: %s N/A self initial_offsets N/A self N/A __exit__ N/A N/A self exc_type exc_value traceback N/A N/A N/A 
        End a context.

         -  If there was no exception, commit up to the current high-water mark.
         -  If there was an offset of range error, attempt to find the correct
            initial offset.
         -  If there was any other error, roll back to the initial offsets.
         N/A N/A exc_type None N/A N/A N/A N/A self commit N/A N/A N/A isinstance exc_value OffsetOutOfRangeError N/A N/A N/A N/A self handle_out_of_range N/A True N/A N/A N/A N/A self rollback N/A commit N/A N/A self N/A N/A N/A 
        Commit this context's offsets:

         -  If the high-water mark has moved, commit up to and position the
            consumer at the high-water mark.
         -  Otherwise, reset to the consumer to the initial offsets.
         N/A N/A self high_water_mark N/A N/A N/A N/A N/A self logger info Committing offsets: %s N/A self high_water_mark N/A N/A N/A self commit_partition_offsets N/A self high_water_mark N/A N/A N/A self update_consumer_offsets N/A self high_water_mark N/A N/A N/A N/A self update_consumer_offsets N/A self initial_offsets N/A rollback N/A N/A self N/A N/A N/A 
        Rollback this context:

         -  Position the consumer at the initial offsets.
         N/A N/A N/A N/A self logger info Rolling back context: %s N/A self initial_offsets N/A N/A N/A self update_consumer_offsets N/A self initial_offsets N/A commit_partition_offsets N/A N/A self partition_offsets N/A N/A N/A 
        Commit explicit partition/offset pairs.
         N/A N/A N/A N/A self logger debug Committing partition offsets: %s partition_offsets N/A commit_requests N/A N/A OffsetCommitRequestPayload N/A N/A self consumer topic partition offset None N/A N/A partition offset N/A N/A partition_offsets items N/A commit_responses N/A N/A N/A N/A self consumer client send_offset_commit_request N/A N/A self consumer group commit_requests N/A commit_response commit_responses N/A N/A N/A check_error commit_response N/A update_consumer_offsets N/A N/A self partition_offsets N/A N/A N/A 
        Update consumer offsets to explicit positions.
         N/A N/A N/A N/A self logger debug Updating consumer offsets to: %s partition_offsets N/A N/A partition offset N/A N/A partition_offsets items N/A N/A N/A N/A N/A self consumer offsets N/A partition offset N/A N/A N/A N/A self consumer seek 0 1 N/A handle_out_of_range N/A N/A self N/A N/A N/A 
        Handle out of range condition by seeking to the beginning of valid
        ranges.

        This assumes that an out of range doesn't happen by seeking past the end
        of valid ranges -- which is far less likely.
         N/A N/A N/A N/A self logger info Seeking beginning of partition on out of range error N/A N/A N/A N/A self consumer seek 0 0 N/A N/A