Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update buffered sender #13851

Merged
merged 16 commits into from
Oct 2, 2020
Merged

Update buffered sender #13851

merged 16 commits into from
Oct 2, 2020

Conversation

xiangyan99
Copy link
Member

  • Stopped supporting window kwargs for SearchIndexDocumentBatchingClient
  • Splitted kwarg hook into new_callback, progress_callback, error_callback, remove_callback for SearchIndexDocumentBatchingClient
  • Added auto_flush_interval support for SearchIndexDocumentBatchingClient
  • Added max_retry_count support for SearchIndexDocumentBatchingClient

_RETRY_LIMIT = 10
_DEFAULT_AUTO_FLUSH_INTERVAL = 60
_DEFAULT_BATCH_SIZE = 100
_MAX_RETRY_COUNT = 3
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tiniest nit: can you also call this _DEFAULT_MAX_RETRY_COUNT

assert client._window == 100
assert client._auto_flush
await client.close()
async with SearchIndexDocumentBatchingClient("endpoint", "index name", CREDENTIAL, window=100) as client:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't look like you have tests for the new kwargs (i.e. error_callback, progress_callback etc). can you add tests for these?

**Breaking Changes**

- Stopped supporting `window` kwargs for `SearchIndexDocumentBatchingClient`
- Splitted kwarg `hook` into `new_callback`, `progress_callback`, `error_callback`, `remove_callback` for `SearchIndexDocumentBatchingClient`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We continue to use the suffix _hook or the prefix on_ to represent callbacks in other SDKs - are we able to align?
e.g.

  • storage blobs on_error
  • event hubs on_error/on_partition_initialize etc
  • In Datalake we use the _hook suffix when the callback handles a few different operations (e.g. not just errors).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update changelog to reflect new on_ prefix to callbacks

@xiangyan99 xiangyan99 changed the title Update batching client Update buffered sender Sep 29, 2020
**Breaking Changes**

- Stopped supporting `window` kwargs for `SearchIndexDocumentBatchingClient`
- Splitted kwarg `hook` into `new_callback`, `progress_callback`, `error_callback`, `remove_callback` for `SearchIndexDocumentBatchingClient`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update changelog to reflect new on_ prefix to callbacks

# type: (List[dict]) -> None
"""Queue upload documents actions.

:param documents: A list of documents to upload.
:type documents: List[dict]
"""
actions = self._index_documents_batch.add_upload_actions(documents)
self._new_callback(actions)
self._new_action_callback(actions)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: i think it would be more clear if the private variables tracking the on_ hooks were named the same as what users would pass in (in this case, self._on_new)

@xiangyan99 xiangyan99 merged commit a77fbd6 into master Oct 2, 2020
@xiangyan99 xiangyan99 deleted the search_batching_client-updates branch October 2, 2020 18:32
iscai-msft added a commit that referenced this pull request Oct 7, 2020
…into fr-business-cards

* 'master' of https://github.com/Azure/azure-sdk-for-python: (71 commits)
  move the environment prep above the tooling that needs it (#14246)
  Increment version for appconfiguration releases (#14245)
  Azure Communication Service - Phone Number Administration (#14237)
  [text analytics] fix query param in cli call to get endpoint (#14243)
  Resolve Failing Documentation Build for azure-mgmt-core (#14239)
  Add code reviewers (#14229)
  [ServiceBus] make amqp_message properties read-only (#14095)
  [ServiceBus]remove topic parameter object settability (#14116)
  app config owner (#12986)
  [KeyVault] Handle Role Definition UUID Name Internally (#14218)
  Increment version for storage releases (#14224)
  Update Key Vault changelogs for October release (#14226)
  [ServiceBus] CI Test hotfixes (#14195)
  [text analytics] regen TA with GA autorest (#14215)
  [Storage][STG74]ChangeLog (#14192)
  fixes python 2.7 issue with unicode and strings again! (#14216)
  Feature/storage stg74 (#14175)
  Update communication pacakges to version b2 (#14209)
  [KeyVault] Add Status Methods to Query Backup and Restore Operations (#14158)
  Update buffered sender (#13851)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants