yajsapi - Java Script 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

Hierarchy

  • Task

Table of contents

Constructors

Properties

Accessors

Methods

Constructors

constructor

  • new Task(data: TaskData): Task

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

Returns: Task

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: undefined | [Handle<Task>, SmartQueue<Task>]

Defined in: yajsapi/executor/task.ts:32

_result

Private Optional _result: undefined | 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

Staticcounter(): number

Returns: number

Defined in: yajsapi/executor/task.ts:150

Methods

_add_callback

_add_callback(callback: Function): void

Parameters:

Name

Type

callback

Function

Returns: void

Defined in: yajsapi/executor/task.ts:59

_start

_start(_emitter: any): void

Parameters:

Name

Type

_emitter

any

Returns: void

Defined in: yajsapi/executor/task.ts:63

_stop

_stop(retry?: boolean): void

Parameters:

Name

Type

Default value

retry

boolean

false

Returns: void

Defined in: yajsapi/executor/task.ts:70

accept_result

accept_result(result?: null | TaskResult): 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?: null | string, retry?: boolean): 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

Staticfor_handle(handle: Handle<Task<any, any>>, queue: SmartQueue<Task<any, any>>, emitter: default<[YaEvent], void>): Task<TaskData, TaskResult>

Parameters:

Name

Type

handle

Handle<Task<any, any>>

queue

SmartQueue<Task<any, any>>

emitter

default<[YaEvent], void>

Returns: Task<TaskData, TaskResult>

Defined in: yajsapi/executor/task.ts:80