task

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2024 License: MIT Imports: 38 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultMaxTaskProcessingTime = 10 * time.Minute
	DefaultMinTaskProcessingTime = 5 * time.Second
	DefaultMaxConcurrentTasks    = 3
)
View Source
const (
	OUTPUT_ENABLED    = "enabled"
	OUTPUT_DISABLED   = "disabled"
	OUTPUT_ONLY_SHORT = "only_short"
	IPFS_PREFIX       = "ipfs://"
	ARWEAVE_PREFIX    = "ar://"
)

Variables

View Source
var (
	OutputNameEmpty         = OutputName("empty_output")
	OutputNameOSSourceMP4   = OutputName("source_mp4")
	OutputNameOSPlaylistHLS = OutputName("playlist_hls")
	OutputNameIPFSSourceMP4 = OutputName("ipfs_source_mp4")
	OutputNameClipSource    = OutputName("clip_source")
)
View Source
var ContinueAsync = &TaskHandlerOutput{Continue: true}

If this special output is returned it means the task is yielding execution until another async event is received about it. Likely triggered by an external callback (e.g. catalyst's VOD upload callback) or delayed event.

View Source
var DefaultClient = clients.BaseClient{}
View Source
var (
	// Feature flag whether to use Catalyst's IPFS support or not.
	FlagCatalystSupportsIPFS = false
)

Functions

func IsUnretriable

func IsUnretriable(err error) bool

func NewCatalystError added in v0.7.4

func NewCatalystError(msg string, unretriable bool) error

Types

type Accumulator added in v0.4.11

type Accumulator struct {
	// contains filtered or unexported fields
}

func NewAccumulator added in v0.4.11

func NewAccumulator() *Accumulator

func (*Accumulator) Accumulate added in v0.4.11

func (a *Accumulator) Accumulate(size uint64)

func (*Accumulator) Size added in v0.4.11

func (a *Accumulator) Size() uint64

type CatalystError added in v0.7.4

type CatalystError struct {
	// contains filtered or unexported fields
}

func (CatalystError) Error added in v0.7.4

func (e CatalystError) Error() string

type ExportTaskConfig added in v0.4.5

type ExportTaskConfig struct {
	PinataAccessToken  string
	PlayerImmutableURL *url.URL
	PlayerExternalURL  *url.URL
}

type InputError added in v0.11.0

type InputError struct {
	// contains filtered or unexported fields
}

type OutputName added in v0.5.0

type OutputName string

type ProgressReporter added in v0.7.0

type ProgressReporter struct {
	// contains filtered or unexported fields
}

func NewProgressReporter added in v0.7.0

func NewProgressReporter(ctx context.Context, lapi *api.Client, taskID, step string) *ProgressReporter

func (*ProgressReporter) Set added in v0.7.0

func (p *ProgressReporter) Set(val float64)

func (*ProgressReporter) Stop added in v0.7.0

func (p *ProgressReporter) Stop()

func (*ProgressReporter) Track added in v0.7.0

func (p *ProgressReporter) Track(getProgress func() float64, end float64)

func (*ProgressReporter) TrackCount added in v0.7.0

func (p *ProgressReporter) TrackCount(getCount func() uint64, size uint64, endProgress float64)

func (*ProgressReporter) TrackReader added in v0.7.0

func (p *ProgressReporter) TrackReader(r io.Reader, size uint64, endProgress float64) *ReadCounter

type ReadCounter added in v0.2.0

type ReadCounter struct {
	// contains filtered or unexported fields
}

func NewReadCounter added in v0.2.0

func NewReadCounter(r io.Reader) *ReadCounter

func (*ReadCounter) Count added in v0.2.0

func (h *ReadCounter) Count() uint64

func (*ReadCounter) Read added in v0.2.0

func (h *ReadCounter) Read(p []byte) (int, error)

type ReadHasher

type ReadHasher struct {
	// contains filtered or unexported fields
}

func NewReadHasher

func NewReadHasher(r io.Reader) *ReadHasher

func (*ReadHasher) FinishReader

func (h *ReadHasher) FinishReader() (int64, error)

func (*ReadHasher) MD5

func (h *ReadHasher) MD5() string

func (*ReadHasher) Read

func (h *ReadHasher) Read(p []byte) (int, error)

func (*ReadHasher) SHA256

func (h *ReadHasher) SHA256() string

type Runner

type Runner interface {
	Start() error
	HandleCatalysis(ctx context.Context, taskId, nextStep, attemptID string, callback *clients.CatalystCallback) error
	Shutdown(ctx context.Context) error
}

func NewRunner

func NewRunner(opts RunnerOptions) Runner

type RunnerOptions

type RunnerOptions struct {
	AMQPUri                 string
	ExchangeName, QueueName string
	OldQueueName            string
	DeadLetter              struct {
		ExchangeName, QueueName string
	}

	MinTaskProcessingTime time.Duration
	MaxTaskProcessingTime time.Duration
	MaxConcurrentTasks    uint
	HumanizeErrors        bool

	LivepeerAPIOptions api.ClientOptions
	Catalyst           *clients.CatalystOptions
	ExportTaskConfig
	UploadTaskConfig

	VodDecryptPrivateKey string
	VodDecryptPublicKey  string

	TaskHandlers map[string]TaskHandler
}

type TaskContext

type TaskContext struct {
	context.Context

	data.TaskInfo
	*api.Task
	Progress                *ProgressReporter
	InputAsset, OutputAsset *api.Asset
	InputOSObj, OutputOSObj *api.ObjectStore
	// contains filtered or unexported fields
}

func (TaskContext) HandleCatalysis added in v0.4.17

func (r TaskContext) HandleCatalysis(ctx context.Context, taskId, nextStep, attemptID string, callback *clients.CatalystCallback) error

func (TaskContext) Shutdown added in v0.2.0

func (r TaskContext) Shutdown(ctx context.Context) error

func (TaskContext) Start added in v0.2.0

func (r TaskContext) Start() error

func (*TaskContext) WithContext added in v0.4.5

func (t *TaskContext) WithContext(ctx context.Context) *TaskContext

type TaskHandler

type TaskHandler func(tctx *TaskContext) (*TaskHandlerOutput, error)

type TaskHandlerOutput added in v0.7.6

type TaskHandlerOutput struct {
	*data.TaskOutput
	Continue bool
}

func TaskClip added in v0.11.0

func TaskClip(tctx *TaskContext) (*TaskHandlerOutput, error)

func TaskExport added in v0.2.0

func TaskExport(tctx *TaskContext) (*TaskHandlerOutput, error)

func TaskExportData added in v0.11.0

func TaskExportData(tctx *TaskContext) (*TaskHandlerOutput, error)

func TaskTranscodeFile added in v0.8.1

func TaskTranscodeFile(tctx *TaskContext) (*TaskHandlerOutput, error)

func TaskUpload added in v0.4.17

func TaskUpload(tctx *TaskContext) (*TaskHandlerOutput, error)

type UnretriableError

type UnretriableError struct {
	// contains filtered or unexported fields
}

func (UnretriableError) Error

func (e UnretriableError) Error() string

func (UnretriableError) Unwrap

func (e UnretriableError) Unwrap() error

type UploadTaskConfig added in v0.11.0

type UploadTaskConfig struct {
	// Ordered list of IPFS gateways (includes /ipfs/ suffix) to import assets from
	ImportIPFSGatewayURLs []*url.URL
}

Jump to

Keyboard shortcuts

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