question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Getting metadata/progress of a long-running recognition

See original GitHub issue

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.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
jpaquinocivicomcommented, Nov 20, 2017

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

0reactions
kurtisvgcommented, Jun 10, 2019

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

progress bar of google speech-to-text api ... - Stack Overflow
I am running a long_running_recognize operation and would like to know the progress of the same. from google.cloud import speech_v1 as speech ...
Read more >
Package google.longrunning | Service Infrastructure
Service-specific metadata associated with the operation. It typically contains progress information and common metadata such as create time.
Read more >
`progressPercent` is missing from the metadata · Issue #420 ...
Make a long running recognize request: client .longRunningRecognize(request) .then(responses => { const [operation, initialApiResponse] = responses; ...
Read more >
What is metadata and how does it work? - TechTarget
Metadata is data that describes other data, providing a structured reference that helps to sort and identify attributes of the information it describes....
Read more >
The Ultimate Guide to Music Metadata - Soundcharts
1. Keep Track of the Metadata From the Get-Go · 2. Finalize Agreements and Define Splits Before a Song Leaves the Studio ·...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found