https://github.com/emcfarlane/starlarkgroup
Go routines in Starlark
https://github.com/emcfarlane/starlarkgroup
Last synced: 3 months ago
JSON representation
Go routines in Starlark
- Host: GitHub
- URL: https://github.com/emcfarlane/starlarkgroup
- Owner: emcfarlane
- License: bsd-3-clause
- Created: 2020-03-10T17:49:35.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-02-25T10:27:28.000Z (over 3 years ago)
- Last Synced: 2025-06-19T13:53:54.994Z (about 1 year ago)
- Language: Go
- Size: 27.3 KB
- Stars: 3
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# starlarkgroup
[](https://pkg.go.dev/mod/github.com/emcfarlane/starlarkgroup)

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.
```python
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]
```