parallel

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateIndexes

func GenerateIndexes(spec *execution.ParallelismSpec) []execution.ParallelIndex

GenerateIndexes generates the indexes for a ParallelismSpec. The order of results is guaranteed to be deterministic.

func GetDefaultIndex

func GetDefaultIndex() execution.ParallelIndex

GetDefaultIndex returns the default ParallelIndex for a non-parallel job.

func GetParallelStatus

func GetParallelStatus(job *execution.Job, tasks []execution.TaskRef) (execution.ParallelStatus, error)

GetParallelStatus returns the complete ParallelStatus for the Job.

func GetParallelStatusCounters

func GetParallelStatusCounters(indexes []execution.ParallelIndexStatus) execution.ParallelStatusCounters

GetParallelStatusCounters returns the parallel task summary status of a Job according to a list of TaskRef.

func GetParallelTaskSummary

func GetParallelTaskSummary(job *execution.Job, tasks []execution.TaskRef) (execution.ParallelStatusSummary, error)

GetParallelTaskSummary returns the parallel task summary status of a Job according to a list of TaskRef.

func HashIndex

func HashIndex(index execution.ParallelIndex) (string, error)

HashIndex returns a deterministic hash of a ParallelIndex. For example, the result of GetDefaultIndex() returns "gezdqo".

Example
package main

import (
	"fmt"

	"github.com/furiko-io/furiko/pkg/execution/util/parallel"
)

func main() {
	hash, err := parallel.HashIndex(parallel.GetDefaultIndex())
	if err != nil {
		panic(err)
	}
	fmt.Println(hash)
}
Output:

gezdqo

func HashIndexes

func HashIndexes(indexes []execution.ParallelIndex) (map[int]string, map[string]int, error)

HashIndexes returns mapping of hashes of ParallelIndex. The first maps the slice index to the hash, and the second maps the hash to the slice index.

Types

type IndexCreationRequest

type IndexCreationRequest struct {
	ParallelIndex execution.ParallelIndex
	RetryIndex    int64
	Earliest      time.Time
}

IndexCreationRequest contains an index that should be created, and the earliest time it can be created.

func ComputeMissingIndexesForCreation

func ComputeMissingIndexesForCreation(
	job *execution.Job,
	indexes []execution.ParallelIndex,
) ([]IndexCreationRequest, error)

ComputeMissingIndexesForCreation returns a list of expected indexes based on taskStatuses.

Jump to

Keyboard shortcuts

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