Giter Site home page Giter Site logo

Timeout on write_item? about reverb HOT 3 CLOSED

google-deepmind avatar google-deepmind commented on August 22, 2024 1
Timeout on write_item?

from reverb.

Comments (3)

acassirer avatar acassirer commented on August 22, 2024

Hey,

Sorry for the slow response!

I'm afraid that there currently isn't any timeout support in the writer. We have a backlog entry for the feature but haven't gotten around to implementing it yet as this isn't much of an issue for our own experiments where failing tasks are automatically restarted (and thus the blocking makes sense as the call eventually succeeds).

I'll bump up the priority on this feature but if this is causing you a lot of pain then maybe you could try offloading the call to a threadpool? You could then apply a timeout on the future instead.

Something along these lines maybe:

import concurrent.futures
import reverb

_TIMEOUT = 10  # Seconds.

def main():
    client = reverb.Client('localhost:8000')

    executor = futures.ThreadPoolExecutor(max_workers=1)
    with client.writer(max_sequence_length=2) as writer:
      for i in range(1000):
        try:
          # In general writer.append can also block due to communication.
          executor.submit(writer.append, tf.constant([1.]).result(_TIMEOUT)
          if i > 0:
            print(f'creating item for i={i}')
            executor.submit(writer.create_item, 'my_table', 2, 1.0).result(_TIMEOUT)
            print(f'wrote item for i={i}')
            time.sleep(0.5)
         except futures.TimeoutError:
           print('closing')

from reverb.

jmacglashan avatar jmacglashan commented on August 22, 2024

Okay, thanks! That might be a reasonable work around for now

from reverb.

ebrevdo avatar ebrevdo commented on August 22, 2024

This is fixed in the new TrajectoryWriter flush call (create_item is now asynchronous in the new API).

from reverb.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.