Git Product home page Git Product logo

starlarkgroup's Introduction

starlarkgroup

GoDev test

Go errgroup.Group for starlark. Allows a starlark thread to spawn go routines. Each go routine can be optionally pooled and rate limited. Arguments to go are frozen. Wait returns a tuple of sorted values in order of calling. Calls are lazy evaluated and only executed when wait() is called.

def square(x):
    return x*x

def square_all(vs):
    # Create a group of 10 go routines, limited every 10ms with a burst of 10.
    g = group(n = 10, every = "10ms", burst = 10)
    for i in vs:
        g.go(square, i)  # args[1:] and kwargs passed to arg[0]
    return g.wait()

print(square_all(range(10)))  # prints: [0, 1, 4, 9, 16, 25, 36, 49, 64, 81]

starlarkgroup's People

Contributors

emcfarlane avatar

Watchers

 avatar

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.