yajsapi - JavaScript high-level API
Yagna Contributor Guide

Class: Task

yajsapi / Exports / executor/task / Task

Class: Task

executor/task.Task

One computation unit.

description Represents one computation unit that will be run on the provider (e.g. rendering of one frame of an animation).

Type parameters

Name

TaskData

TaskResult

Table of contents

Constructors

Properties

Accessors

Methods

Constructors

constructor

new Task(data)

Create a new Task object.

Type parameters

Name

TaskData

TaskResult

Parameters

Name

Type

Description

data

TaskData

contains information needed to prepare command list for the provider

Defined in

yajsapi/executor/task.ts:38

Properties

_callbacks

Private _callbacks: Set<null | Function>

Defined in

yajsapi/executor/task.ts:31

_data

Private _data: any

Defined in

yajsapi/executor/task.ts:37

_emit_event

Private _emit_event: any

Defined in

yajsapi/executor/task.ts:30

_finished

Private _finished: null | number

Defined in

yajsapi/executor/task.ts:29

_handle

Private Optional _handle: [Handle<Task>, SmartQueue<Task>]

Defined in

yajsapi/executor/task.ts:32

_result

Private Optional _result: null | TaskResult

Defined in

yajsapi/executor/task.ts:36

_started

Private _started: null | number

Defined in

yajsapi/executor/task.ts:28

_status

Private _status: TaskStatus

Defined in

yajsapi/executor/task.ts:38

id

id: number = 0

Defined in

yajsapi/executor/task.ts:27

count

Static count: number = 0

Defined in

yajsapi/executor/task.ts:26

Accessors

counter

Static get counter(): number

Returns

number

Defined in

yajsapi/executor/task.ts:150

Methods

_add_callback

_add_callback(callback): void

Parameters

Name

Type

callback

Function

Returns

void

Defined in

yajsapi/executor/task.ts:59

_start

_start(_emitter): void

Parameters

Name

Type

_emitter

any

Returns

void

Defined in

yajsapi/executor/task.ts:63

_stop

_stop(retry?): void

Parameters

Name

Type

Default value

retry

boolean

false

Returns

void

Defined in

yajsapi/executor/task.ts:70

accept_result

accept_result(result?): void

Accept the result of this task.

description Must be called when the result is correct to mark this task as completed.

Parameters

Name

Type

Default value

Description

result

null | TaskResult

null

task computation result (optional)

Returns

void

Defined in

yajsapi/executor/task.ts:120

data

data(): TaskData

Returns

TaskData

Defined in

yajsapi/executor/task.ts:95

reject_result

reject_result(reason?, retry?): void

Reject the result of this task.

description Must be called when the result is not correct to indicate that the task should be retried.

Parameters

Name

Type

Default value

Description

reason

null | string

null

Task rejection description (optional)

retry

boolean

false

Task retry in case of rejects (optional)

Returns

void

Defined in

yajsapi/executor/task.ts:139

result

result(): undefined | null | TaskResult

Returns

undefined | null | TaskResult

Defined in

yajsapi/executor/task.ts:99

running_time

running_time(): null | number

Returns

null | number

Defined in

yajsapi/executor/task.ts:103

status

status(): TaskStatus

Returns

TaskStatus

Defined in

yajsapi/executor/task.ts:91

for_handle

Static for_handle(handle, queue, emitter): Task<"TaskData", "TaskResult">

Parameters

Name

Type

handle

Handle<Task>

queue

SmartQueue<Task>

emitter

default<[YaEvent], void>

Returns

Task<"TaskData", "TaskResult">

Defined in

yajsapi/executor/task.ts:80