@@ -76,21 +76,21 @@ class _OrderedSequencerStatus(str, enum.Enum):
7676
7777
7878class OrderedSequencer (sequencer_base .Sequencer ):
79- """ Sequences messages into batches ordered by an ordering key for one topic.
79+ """Sequences messages into batches ordered by an ordering key for one topic.
8080
81- A sequencer always has at least one batch in it, unless paused or stopped.
82- When no batches remain, the |publishes_done_callback| is called so the
83- client can perform cleanup.
81+ A sequencer always has at least one batch in it, unless paused or stopped.
82+ When no batches remain, the |publishes_done_callback| is called so the
83+ client can perform cleanup.
8484
85- Public methods are thread-safe.
85+ Public methods are thread-safe.
8686
87- Args:
88- client:
89- The publisher client used to create this sequencer.
90- topic:
91- The topic. The format for this is ``projects/{project}/topics/{topic}``.
92- ordering_key:
93- The ordering key for this sequencer.
87+ Args:
88+ client:
89+ The publisher client used to create this sequencer.
90+ topic:
91+ The topic. The format for this is ``projects/{project}/topics/{topic}``.
92+ ordering_key:
93+ The ordering key for this sequencer.
9494 """
9595
9696 def __init__ (self , client : "PublisherClient" , topic : str , ordering_key : str ):
@@ -107,23 +107,23 @@ def __init__(self, client: "PublisherClient", topic: str, ordering_key: str):
107107 self ._state = _OrderedSequencerStatus .ACCEPTING_MESSAGES
108108
109109 def is_finished (self ) -> bool :
110- """ Whether the sequencer is finished and should be cleaned up.
110+ """Whether the sequencer is finished and should be cleaned up.
111111
112- Returns:
113- Whether the sequencer is finished and should be cleaned up.
112+ Returns:
113+ Whether the sequencer is finished and should be cleaned up.
114114 """
115115 with self ._state_lock :
116116 return self ._state == _OrderedSequencerStatus .FINISHED
117117
118118 def stop (self ) -> None :
119- """ Permanently stop this sequencer.
119+ """Permanently stop this sequencer.
120120
121- This differs from pausing, which may be resumed. Immediately commits
122- the first batch and cancels the rest.
121+ This differs from pausing, which may be resumed. Immediately commits
122+ the first batch and cancels the rest.
123123
124- Raises:
125- RuntimeError:
126- If called after stop() has already been called.
124+ Raises:
125+ RuntimeError:
126+ If called after stop() has already been called.
127127 """
128128 with self ._state_lock :
129129 if self ._state == _OrderedSequencerStatus .STOPPED :
@@ -143,13 +143,13 @@ def stop(self) -> None:
143143 batch .cancel (batch_base .BatchCancellationReason .CLIENT_STOPPED )
144144
145145 def commit (self ) -> None :
146- """ Commit the first batch, if unpaused.
146+ """Commit the first batch, if unpaused.
147147
148- If paused or no batches exist, this method does nothing.
148+ If paused or no batches exist, this method does nothing.
149149
150- Raises:
151- RuntimeError:
152- If called after stop() has already been called.
150+ Raises:
151+ RuntimeError:
152+ If called after stop() has already been called.
153153 """
154154 with self ._state_lock :
155155 if self ._state == _OrderedSequencerStatus .STOPPED :
@@ -161,11 +161,11 @@ def commit(self) -> None:
161161 self ._ordered_batches [0 ].commit ()
162162
163163 def _batch_done_callback (self , success : bool ) -> None :
164- """ Deal with completion of a batch.
164+ """Deal with completion of a batch.
165165
166- Called when a batch has finished publishing, with either a success
167- or a failure. (Temporary failures are retried infinitely when
168- ordering keys are enabled.)
166+ Called when a batch has finished publishing, with either a success
167+ or a failure. (Temporary failures are retried infinitely when
168+ ordering keys are enabled.)
169169 """
170170 ensure_cleanup_and_commit_timer_runs = False
171171 with self ._state_lock :
@@ -209,10 +209,10 @@ def _batch_done_callback(self, success: bool) -> None:
209209 self ._client .ensure_cleanup_and_commit_timer_runs ()
210210
211211 def _pause (self ) -> None :
212- """ Pause this sequencer: set state to paused, cancel all batches, and
213- clear the list of ordered batches.
212+ """Pause this sequencer: set state to paused, cancel all batches, and
213+ clear the list of ordered batches.
214214
215- _state_lock must be taken before calling this method.
215+ _state_lock must be taken before calling this method.
216216 """
217217 assert (
218218 self ._state != _OrderedSequencerStatus .FINISHED
@@ -225,7 +225,7 @@ def _pause(self) -> None:
225225 self ._ordered_batches .clear ()
226226
227227 def unpause (self ) -> None :
228- """ Unpause this sequencer.
228+ """Unpause this sequencer.
229229
230230 Raises:
231231 RuntimeError:
@@ -241,7 +241,7 @@ def _create_batch(
241241 commit_retry : "OptionalRetry" = gapic_v1 .method .DEFAULT ,
242242 commit_timeout : "types.OptionalTimeout" = gapic_v1 .method .DEFAULT ,
243243 ) -> "_batch.thread.Batch" :
244- """ Create a new batch using the client's batch class and other stored
244+ """Create a new batch using the client's batch class and other stored
245245 settings.
246246
247247 Args:
@@ -266,7 +266,7 @@ def publish(
266266 retry : "OptionalRetry" = gapic_v1 .method .DEFAULT ,
267267 timeout : "types.OptionalTimeout" = gapic_v1 .method .DEFAULT ,
268268 ) -> futures .Future :
269- """ Publish message for this ordering key.
269+ """Publish message for this ordering key.
270270
271271 Args:
272272 message:
0 commit comments