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

Add speech api streaming sample. #239

Merged
merged 1 commit into from
Apr 7, 2016
Merged

Add speech api streaming sample. #239

merged 1 commit into from
Apr 7, 2016

Conversation

jerjou
Copy link
Contributor

@jerjou jerjou commented Apr 4, 2016

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Apr 4, 2016
@jerjou
Copy link
Contributor Author

jerjou commented Apr 4, 2016

Oh wait I should write a test shouldn't I...

@jerjou jerjou force-pushed the speech-streaming branch 2 times, most recently from faa1ded to fad9687 Compare April 7, 2016 03:14
@jerjou
Copy link
Contributor Author

jerjou commented Apr 7, 2016

Okay, added tests.
However, the sample doesn't seem to work in python3 (it segfaults). After digging around a bunch, I think the problem is in the generated grpc lib. I skipped the test for python 3 for now..

PTAL

@@ -86,6 +86,11 @@ def session_tests(session, interpreter, extra_pytest_args=None):
# allows users to run a particular test instead of all of them.
for sample in (session.posargs or
collect_sample_dirs('.', SESSION_TESTS_BLACKLIST)):
# Install additional dependencies if they exist
Copy link
Contributor

Choose a reason for hiding this comment

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

This could cause some weirdness with clashing dependency versions. I'm okay with this for now, but we should be careful.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah - I think we should move to a world where, instead of having a global requirements-py[23].txt at the top level, each sample module would have its own smaller requirements.txt, and the global one would be either empty, or only include the stuff needed for pytest.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh I see what you mean - the virtualenvs are split by session, not by subdir.
Hrm... that's a puzzle... perhaps we could have a separate virtualenv for each subdir that contains a requirements.txt?

Pros:

  • Also tests that requirements.txt are valid

Cons:

  • Adds overhead to testing

The con might be mitigated if we could run the tests in parallel..

Copy link
Contributor

Choose a reason for hiding this comment

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

I tried that originally, and it's dreadfully slow. :/

@theacodes
Copy link
Contributor

Finished first review pass. In general, I like this but I'm unsure about the control flow. It seems weird to me, but most threaded things are. hmm..

@jerjou
Copy link
Contributor Author

jerjou commented Apr 7, 2016

Updated.

Re: control flow - yeah, I had an iteration where I made the request stream a class that was an iterator, with a stop method. It's probably the Right Way to do it, but it looked uglier / harder to explain, because then I had to deal with the record_audio context around the iteration.. so I figured this was better just because it's easier to see what's going on, even if the control flow is a bit icky.

(something like:

class RequestStream:
    def __init__(self):
        self.stop_audio = threading.Event()
        self.audio_stream = record_audio(..)
        self.is_first_request = True
    def __iter__(self):
        self.audio_stream.__enter__()
    def __next__(self):
        if self.is_first_request:
            self.is_first_request = False
            # ... do the special thing
        else if not self.stop_audio.is_set():
            # do the normal thing
        else:
            self.audio_stream.__exit__()
            raise StopIteration()

Just seemed like a lot of different pieces were interleaved.
I dunno - open to suggestions.

Travis is having trouble pulling down grpcio... will look into that.

@jerjou jerjou force-pushed the speech-streaming branch 5 times, most recently from 61c480d to bd7b58d Compare April 7, 2016 22:37
@theacodes
Copy link
Contributor

Please rebase, but otherwise I suppose this LGTM. I would appreciate some more time put into the control flow. Perhaps we can chat about it in person next week?

@jerjou
Copy link
Contributor Author

jerjou commented Apr 7, 2016

Rebased.

What do you have in mind for the control flow? At this point it's not a matter of time so much as lack of better ideas.

@theacodes
Copy link
Contributor

What do you have in mind for the control flow? At this point it's not a matter of time so much as lack of better ideas.

Not sure, I'd have to more deeply understand a few things. Much better to discuss in person. Feel free to merge.

@jerjou jerjou merged commit b187310 into master Apr 7, 2016
@jerjou jerjou deleted the speech-streaming branch April 7, 2016 23:21
engelke pushed a commit that referenced this pull request Nov 28, 2022
)

[![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [google-cloud-resource-manager](https://github.com/googleapis/python-resource-manager) | `==0.30.3` -> `==1.0.1` | [![age](https://badges.renovateapi.com/packages/pypi/google-cloud-resource-manager/1.0.1/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/pypi/google-cloud-resource-manager/1.0.1/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/pypi/google-cloud-resource-manager/1.0.1/compatibility-slim/0.30.3)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/pypi/google-cloud-resource-manager/1.0.1/confidence-slim/0.30.3)](https://docs.renovatebot.com/merge-confidence/) |

---

### Release Notes

<details>
<summary>googleapis/python-resource-manager</summary>

### [`v1.0.1`](https://github.com/googleapis/python-resource-manager/blob/master/CHANGELOG.md#&#8203;101-httpswwwgithubcomgoogleapispython-resource-managercomparev100v101-2021-07-20)

[Compare Source](https://github.com/googleapis/python-resource-manager/compare/v0.30.3...v1.0.1)

</details>

---

### Configuration

📅 **Schedule**: At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box.

---

This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/python-asset).
dandhlee pushed a commit that referenced this pull request Nov 29, 2022
)

[![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [google-cloud-resource-manager](https://github.com/googleapis/python-resource-manager) | `==0.30.3` -> `==1.0.1` | [![age](https://badges.renovateapi.com/packages/pypi/google-cloud-resource-manager/1.0.1/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/pypi/google-cloud-resource-manager/1.0.1/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/pypi/google-cloud-resource-manager/1.0.1/compatibility-slim/0.30.3)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/pypi/google-cloud-resource-manager/1.0.1/confidence-slim/0.30.3)](https://docs.renovatebot.com/merge-confidence/) |

---

### Release Notes

<details>
<summary>googleapis/python-resource-manager</summary>

### [`v1.0.1`](https://github.com/googleapis/python-resource-manager/blob/master/CHANGELOG.md#&#8203;101-httpswwwgithubcomgoogleapispython-resource-managercomparev100v101-2021-07-20)

[Compare Source](https://github.com/googleapis/python-resource-manager/compare/v0.30.3...v1.0.1)

</details>

---

### Configuration

📅 **Schedule**: At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box.

---

This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/python-asset).
holtskinner pushed a commit that referenced this pull request Jan 3, 2023
…ssing samples (#239)

* docs(samples): add processing samples for OCR, quality, splitter and specialized

* Update quality, specialized and splitter samples

* Fix lint issues

* Fix snippet tags

* update library from v1 to v1beta3

* restore previous processing sample to avoid sample tag breakage
holtskinner pushed a commit that referenced this pull request Jan 4, 2023
…ssing samples (#239)

* docs(samples): add processing samples for OCR, quality, splitter and specialized

* Update quality, specialized and splitter samples

* Fix lint issues

* Fix snippet tags

* update library from v1 to v1beta3

* restore previous processing sample to avoid sample tag breakage
dandhlee pushed a commit that referenced this pull request Jan 5, 2023
…ssing samples (#239)

* docs(samples): add processing samples for OCR, quality, splitter and specialized

* Update quality, specialized and splitter samples

* Fix lint issues

* Fix snippet tags

* update library from v1 to v1beta3

* restore previous processing sample to avoid sample tag breakage
telpirion pushed a commit that referenced this pull request Jan 18, 2023
See UPGRADING.md for a list of changes.
dandhlee pushed a commit that referenced this pull request Feb 6, 2023
See UPGRADING.md for a list of changes.
telpirion pushed a commit that referenced this pull request Mar 13, 2023
See UPGRADING.md for a list of changes.
dizcology pushed a commit that referenced this pull request Jun 15, 2023
* chore(deps): update all dependencies

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* revert

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Anthonios Partheniou <partheniou@google.com>
leahecole pushed a commit that referenced this pull request Jun 16, 2023
* chore(deps): update all dependencies

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* revert

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Anthonios Partheniou <partheniou@google.com>
Avani-Thakker-Crest pushed a commit to Avani-Thakker-Crest/python-docs-samples that referenced this pull request Jun 21, 2023
* chore(deps): update all dependencies

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* revert

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Anthonios Partheniou <partheniou@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants