parallelmodule

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 18, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package parallelmodule contains Starlark functions for running code in parallel. Unlike other Starlark modules in skycfg, this module is not loaded by skycfg by default.

Index

Constants

This section is empty.

Variables

View Source
var Module = &starlarkstruct.Module{
	Name: "parallel",
	Members: starlark.StringDict{
		"map": starlark.NewBuiltin("parallel.map", parMap),
	},
}

NewModule returns a Starlark module of parallel functions.

parallel = module(
    map,
)

def map(function, iterable):

Runs function on each element of iterable in parallel. Returns a list containing the result of function, in the same order as the original iterable. If any call to function fails, parallel.map fails as well. If multiple invocations fail, the error is chosen arbitrarily.

To guarantee safety, the following measures are taken:

  • The function and each element of iterable are frozen.
  • map cannot be called during module initialization. See https://github.com/google/starlark-go/issues/623.
  • map detects and forbids recursion, even if Starlark is configured to allow recursion.

Functions

func DefaultThreadCreator

func DefaultThreadCreator(parent *starlark.Thread, parallelFunc string, idx int) *starlark.Thread

Types

type ThreadCreator

type ThreadCreator func(parent *starlark.Thread, parallelFunc string, idx int) *starlark.Thread

func GetThreadCreator

func GetThreadCreator(t *starlark.Thread) ThreadCreator

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL