GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Getting metadata/progress of a long-running recognition · Issue #819 · GoogleCloudPlatform/java-docs-samples

Getting metadata/progress of a long-running recognition #819

New issue
Copy link
New issue
Copy link
Closed
Closed
Getting metadata/progress of a long-running recognition#819
Copy link
Assignees
gguussnnegrey

Description

@jbrew138
jbrew138
opened on Aug 21, 2017
Issue body actions

In which file did you encounter the issue?

java-docs-samples/speech/cloud-client/src/main/java/com/example/speech/Recognize.java

Did you change the file? If so, how?

I modified the while loop to attempt getting the progress of the operation in asyncRecognizeGcs(String gcsUri)

OperationFuture<LongRunningRecognizeResponse, LongRunningRecognizeMetadata,
    Operation> response =
    speech.longRunningRecognizeAsync(config, audio);

while (!response.isDone()) {
    ApiFuture<LongRunningRecognizeMetadata> future = response.peekMetadata();
    if (future != null) {
        LongRunningRecognizeMetadata meta = future.get();
        if (meta != null) {
             int percent = meta.getProgressPercent();
             System.out.println(String.format("Percent complete: %s%%", percent));
        }
    }
    Thread.sleep(500);
}

The while loop used to be:

while (!response.isDone()) {
    System.out.println("Waiting for response...");
    Thread.sleep(10000);
}

Describe the issue

API version in Gradle: 'com.google.cloud:google-cloud-speech:0.21.1-alpha'

Using some test audio about 14 seconds long, getting the metadata of the response doesn't return anything until the response is complete. Using response.peekMetadata() leads to returning 0% until the response is done. Using response.getMetadata() of course makes the later future.get() blocking, but the only time it returns is at the end with 100%.

From the documentation on the metadata in REST it does show that progress can be returned, but Java uses gRPC.

Perhaps I'm using the code incorrectly, but otherwise would hope for some documentation or the feature to be available in the Java client library. Having progress output for very long audio (now up to 3 hours after the recent update) is almost necessary.

Activity

  1. jabubake
    assigned
    gguuss
    on Oct 10, 2017
  2. jpaquinocivicom commented on Nov 20, 2017

    @jpaquinocivicom
    jpaquinocivicom
    on Nov 20, 2017
    More actions

    hi jbrew , are you able to solve this issue? i tried using 0.25.0-alpha version, but still not working, any work around?

    Reacted by Noel Lawrence Awitan, abigaelmanlapidcivicom and Kimberly Semillano
  3. lesv
    assigned
    nnegrey
    on Dec 6, 2017
  4. lesv commented on Dec 6, 2017

    @lesv
    lesv
    on Dec 6, 2017
    Contributor
    More actions

    @gguuss / @nnegrey PTAL

  5. gguuss commented on Dec 19, 2017

    @gguuss
    gguuss
    on Dec 19, 2017
    Contributor
    More actions

    OK, I was able to reproduce what @jbrew138 is seeing:

    • Updates come in and the metadata in the long running operations do not get updated
    • When the processing completes, metadata jumps to 100% from 0%

    According to the docs, this is actually the expected behavior, only the 100% progress indicator is guaranteed. That said, this looks like a feature that we should be implementing (intermediate updates to results in long running speech operations).

  6. bud4 commented on Oct 16, 2018

    @bud4
    bud4
    on Oct 16, 2018
    More actions

    it would be very useful to have an indication of the progress.
    i'm using REST to read progress . I realized that the progressPercent attribute is not present in the json if it has value 0 or if the file is small and therefore the progress goes immediately from 0 to 100 !!
    I think it would be more correct that the progressPercent attribute was always present even if it has a value of 0.

  7. bud4 commented on Oct 16, 2018

    @bud4
    bud4
    on Oct 16, 2018
    More actions

    @gguuss in json jumps from 0 to 100 is true for small file. try it with very large files. look at my previous comment

  8. nnegrey
    added
    Data Analytics / ML / IoT
    on Nov 30, 2018
  9. kurtisvg commented on Jun 10, 2019

    @kurtisvg
    kurtisvg
    on Jun 10, 2019
    Contributor
    More actions

    Notice: this issue has been closed because it has been inactive for 192 days. You may reopen this issue if it has been closed in error.

  10. kurtisvg
    closed this as completedon Jun 10, 2019
  11. minherz
    added 3 commits that reference this issue on Nov 9, 2022

    chore(main): release 0.122.18 (#819)

    bca12d8

    chore(main): release 0.122.18 (#819)

    ee4a32e

    chore(main): release 0.122.18 (#819)

    fc56f62
  12. olivi-eh
    added a commit that references this issue on Nov 11, 2022

    sample: changes in three tests to resolve flaky tests and presubmit e…

    48f8684
  13. Shabirmean
    added 3 commits that reference this issue on Nov 14, 2022

    chore(deps): update dependency com.google.cloud:libraries-bom to v24.…

    666e816

    chore(deps): update dependency com.google.cloud:libraries-bom to v24.…

    adb790b

    chore(deps): update dependency com.google.cloud:google-cloud-aiplatfo…

    b59eae8
  14. gcf-merge-on-green
    added a commit that references this issue on Dec 20, 2022

    samples: migrate code from googleapis/java-aiplatform (#7451)

    24b693d
  15. Sita04
    added a commit that references this issue on Feb 7, 2023

    chore(deps): update dependency com.google.cloud:libraries-bom to v24.…

    b970777
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @gguuss
    gguuss
  • @nnegrey
    nnegrey

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.