[translation] poller design#19041
Conversation
| continuation_token = kwargs.pop("continuation_token", None) | ||
| pipeline_response = None | ||
| if continuation_token: | ||
| pipeline_response = self._client.document_translation.get_translation_status( |
There was a problem hiding this comment.
this is weird I know, but necessary for us to use the job ID as the continuation_token instead of pickling the whole response
|
/azp run python - core - ci |
|
Azure Pipelines successfully started running 1 pipeline(s). |
maririos
left a comment
There was a problem hiding this comment.
Reviewed in general. no specifics on Python implementation for LRO
| to wait until the translation is complete. See the README for more information about LROs. | ||
| - Upon completion of the LRO, `begin_translation` now returns a pageable of `DocumentStatusResult`. All job-level metadata can still | ||
| be found on `poller.details`. | ||
| - `has_completed` has been removed from `JobStatusResult` and `DocumentStatusResult`. Use `poller.done()` to check if the |
There was a problem hiding this comment.
ohhh interesting. So if a user wants to know if a specific document is done, they will have to check the status of the document and "calculate it" or just wait until the poller finishes, right?
why?
There was a problem hiding this comment.
People found this confusing in the user study - they thought it was a dynamic property that would update the status in python. Moving to the poller allows us to actually have that dynamic property with done(). I feel it's less important to have on DocumentStatusResult, at that point you're actually interested in checking what the status is - "failed", "succeeded" etc to see what to do (at least that's how all our samples are written). Checking with johan on this one.
There was a problem hiding this comment.
Johan said to remove it
| :ivar int documents_not_yet_started_count: Number of documents that have not yet started being translated. | ||
| :ivar int documents_cancelled_count: Number of documents that were cancelled for translation. | ||
| :ivar int total_characters_charged: Total characters charged across all documents within the job. | ||
| :ivar bool has_completed: boolean to check whether a job has finished or not. |
There was a problem hiding this comment.
The JobStatusResult is used when the user calls list_submitted_jobs right? I don't fully understand why the property is gone after we saw in the user studies that it was helpful to have it
There was a problem hiding this comment.
Let me check the UX study notes - I remember the opposite feedback (at least for Python)
There was a problem hiding this comment.
interesting. I remember .NET people always using that property.
I also remember they confuse it with the HasCompleted from the operation so I guess we could remove it and if people complain then added back.
I don't feel strongly about either option
There was a problem hiding this comment.
oh interesting, didn't realize you also had a hasCompleted on the operation. Yeah, I checked the notes on the understanding of has_completed and there were 4 no and two maybes. Guessing those are mostly python participants 😄
| Value is between [0.0, 1.0]. | ||
| :ivar str id: Document Id. | ||
| :ivar int characters_charged: Characters charged for the document. | ||
| :ivar bool has_completed: boolean to check whether a document finished translation or not. |
sdk/translation/azure-ai-translation-document/azure/ai/translation/document/_polling.py
Outdated
Show resolved
Hide resolved
| ) | ||
|
|
||
| async def _submit_and_validate_translation_job_async(self, async_client, translation_inputs, total_docs_count=None): | ||
| async def _begin_and_validate_translation_async(self, async_client, translation_inputs, total_docs_count=None, language=None): |
There was a problem hiding this comment.
in which cases you will get here and not have documents to translate?
There was a problem hiding this comment.
and when is language none? sorry trying to understand the tests
There was a problem hiding this comment.
These are just options to pass if you want to validate certain properties. Let me look a little closer, it might need a bit of a refactor.
maririos
left a comment
There was a problem hiding this comment.
Overall design LGTM (no specific Python review)
| ] | ||
| ) # type: JobStatusResult | ||
| ) | ||
| result = poller.result() |
There was a problem hiding this comment.
i think you have to await this too
There was a problem hiding this comment.
thanks for catching. Also opened an issue to start running samples in the CI, would have caught that
…into fix_paging_types * 'master' of https://github.com/Azure/azure-sdk-for-python: (37 commits) [translation] poller design (Azure#19041) [AutoRelease] t2-resourcemover-2021-05-21-54304(wave4) (Azure#18849) [AutoRelease] t2-logz-2021-06-02-49354 (Azure#19035) prepare pipeline (Azure#19062) [AutoRelease] t2-recoveryservicesbackup-2021-05-26-33193 (Azure#18953) Get rid of DataFeedOptions (Azure#19054) [AutoRelease] t2-batchai-2021-06-02-38609 (Azure#19036) [appconfig] new gen code (Azure#18859) [Tables] mypy (Azure#19001) fix misleading url (Azure#19044) Create py.typed (Azure#19052) add override of opentelemetry-api to 1.3.0 (Azure#19048) Prepare for June Release (Azure#19043) [Key Vault] Add API version 7.2 for keys (Azure#18586) some misc fixes. (Azure#19024) [AppConfig] pre release (Azure#19027) [ACR] prerelease (Azure#19028) Add sdk/core to triggers and pr (Azure#19023) Event grid 4.3.0 regen code (Azure#19025) Handle 6 decimal places cloud event (Azure#19019) ...
…into update_analyze_output * 'master' of https://github.com/Azure/azure-sdk-for-python: (123 commits) [text analytics] Fix some issues i've found (Azure#19081) [Key Vault] Add API version 7.2 for administration (Azure#18997) hide to_analyze_request (Azure#19079) Add environment variable for redirecting IMDS token requests (Azure#18967) [translation] poller design (Azure#19041) [AutoRelease] t2-resourcemover-2021-05-21-54304(wave4) (Azure#18849) [AutoRelease] t2-logz-2021-06-02-49354 (Azure#19035) prepare pipeline (Azure#19062) [AutoRelease] t2-recoveryservicesbackup-2021-05-26-33193 (Azure#18953) Get rid of DataFeedOptions (Azure#19054) [AutoRelease] t2-batchai-2021-06-02-38609 (Azure#19036) [appconfig] new gen code (Azure#18859) [Tables] mypy (Azure#19001) fix misleading url (Azure#19044) Create py.typed (Azure#19052) add override of opentelemetry-api to 1.3.0 (Azure#19048) Prepare for June Release (Azure#19043) [Key Vault] Add API version 7.2 for keys (Azure#18586) some misc fixes. (Azure#19024) [AppConfig] pre release (Azure#19027) ...
Resolves #17915
Models translation as an LRO. Try not to focus on the names too much, will update in a separate PR.
Live tests pass: https://dev.azure.com/azure-sdk/internal/_build/results?buildId=923936&view=results