G
G
Golem SDK
Search…
yapapi - Python high-level API
yajsapi - JavaScript high-level API
Yagna Contributor Guide
Powered By GitBook
Class: Task

Class: 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

Properties

_callbacks

Private _callbacks: Set<null | Function>
Defined in

_data

Private _data: any
Defined in

_emit_event

Private _emit_event: any
Defined in

_finished

Private _finished: null | number
Defined in

_handle

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

_result

Private Optional _result: null | TaskResult
Defined in

_started

Private _started: null | number
Defined in

_status

Private _status: TaskStatus
Defined in

id

id: number = 0
Defined in

count

Static count: number = 0
Defined in

Accessors

counter

Static get counter(): number
Returns
number
Defined in

Methods

_add_callback

_add_callback(callback): void
Parameters
Name
Type
callback
Function
Returns
void
Defined in

_start

_start(_emitter): void
Parameters
Name
Type
_emitter
any
Returns
void
Defined in

_stop

_stop(retry?): void
Parameters
Name
Type
Default value
retry
boolean
false
Returns
void
Defined in

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

data

data(): TaskData
Returns
TaskData
Defined in

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

result

result(): undefined | null | TaskResult
Returns
undefined | null | TaskResult
Defined in

running_time

running_time(): null | number
Returns
null | number
Defined in

status

status(): TaskStatus
Returns
Defined in

for_handle

Static for_handle(handle, queue, emitter): Task<"TaskData", "TaskResult">
Parameters
Name
Type
handle
queue
emitter
default<[YaEvent], void>
Returns
Task<"TaskData", "TaskResult">
Defined in
Last modified 6d ago