yajsapi - JavaScript high-level API
Yagna Contributor Guide

Class: WorkContext

yajsapi / Exports / executor/ctx / WorkContext

Class: WorkContext

executor/ctx.WorkContext

An object used to schedule commands to be sent to provider.

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new WorkContext(ctx_id, storage, emitter?)

Parameters

Name

Type

Default value

ctx_id

string

undefined

storage

StorageProvider

undefined

emitter

null | default<[StorageEvent], void>

null

Defined in

yajsapi/executor/ctx.ts:289

Properties

_emitter

Private _emitter: null | default<[StorageEvent], void>

Defined in

yajsapi/executor/ctx.ts:289

_id

Private _id: any

Defined in

yajsapi/executor/ctx.ts:285

_pending_steps

Private _pending_steps: Work[]

Defined in

yajsapi/executor/ctx.ts:287

_started

Private _started: boolean

Defined in

yajsapi/executor/ctx.ts:288

_storage

Private _storage: StorageProvider

Defined in

yajsapi/executor/ctx.ts:286

Methods

_prepare

_prepare(): void

Returns

void

Defined in

yajsapi/executor/ctx.ts:302

begin

begin(): void

Returns

void

Defined in

yajsapi/executor/ctx.ts:308

commit

commit(__namedParameters?): Work

Creates sequence of commands to be sent to provider.

Parameters

Name

Type

__namedParameters

Object

__namedParameters.timeout?

number

Returns

Work

Work object (the latter contains sequence commands added before calling this method)

Defined in

yajsapi/executor/ctx.ts:373

download_file

download_file(src_path, dst_path): void

Schedule downloading remote file from the provider.

Parameters

Name

Type

Description

src_path

string

remote (provider) path

dst_path

string

local (requestor) path

Returns

void

Defined in

yajsapi/executor/ctx.ts:352

log

log(args): void

Parameters

Name

Type

args

any

Returns

void

Defined in

yajsapi/executor/ctx.ts:364

run

run(cmd, args?, env?): void

Schedule running a command.

Parameters

Name

Type

Default value

Description

cmd

string

undefined

command to run on the provider, e.g. /my/dir/run.sh

args?

Iterable

undefined

command arguments, e.g. "input1.txt", "output1.txt"

env

null | object

null

optional object with environmental variables

Returns

void

Defined in

yajsapi/executor/ctx.ts:339

send_file

send_file(src_path, dst_path): void

Schedule sending file to the provider.

Parameters

Name

Type

Description

src_path

string

local (requestor) path

dst_path

string

remote (provider) path

Returns

void

Defined in

yajsapi/executor/ctx.ts:327

send_json

send_json(json_path, data): void

Schedule sending JSON data to the provider.

Parameters

Name

Type

Description

json_path

string

remote (provider) path

data

Object

object representing JSON data

Returns

void

Defined in

yajsapi/executor/ctx.ts:316

sign

sign(): void

Returns

void

Defined in

yajsapi/executor/ctx.ts:359