Giter Site home page Giter Site logo

Comments (3)

blester125 avatar blester125 commented on August 14, 2024

Mixing async and normal code can be tricky. Here is the skeleton of a common way to do it (sorry if I over-explain).

  1. Update the calls to tenorstore code to use the async versions of things (generally add an await and turn the function into an async def)
  2. Make a write all function who's job is to start all of the async tasks
  3. Execute this writer in a blocking way.
async write_tracked_file(...):
  """This is the update to make the tensorstore write async."""
  
 async write_all_tracked_files(...):
  """This is what schedules the async tasks to be done concurrently."""
   await aysncio.gather(
       write_tracked_file(x) for x in ...
  )

# From your real code. This is executing it in a blocking way in the main synchronous code
asyncio.run(write_all_tacked_files(...))

If we want to have a minimum python version of 3.7 we can just use this asyncio.run, otherwise we probably need a custom runner like

def async_run(to_run):
  loop = asyncio.get_event_loop()
  return loop.run_until_complete(write_all_tracked_files)

Let me know if anything is unclear

from git-theta.

blester125 avatar blester125 commented on August 14, 2024

The new update class modules changes how this will need to be implemented, we probably need to have async versions of the write and apply methods on those objects. We will also need to see if multiple async methods accessing different git commits causes contention, but effective parallelism/concurrency could be a major win

from git-theta.

blester125 avatar blester125 commented on August 14, 2024

This was done in #121

from git-theta.

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.