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

Hierarchy

  • WorkContext

Table of contents

Constructors

Properties

Methods

Constructors

constructor

Parameters:

Name

Type

Default value

ctx_id

string

-

storage

StorageProvider

-

emitter

null | default<[StorageEvent], void>

null

Returns: WorkContext

Defined in: yajsapi/executor/ctx.ts:284

Properties

_emitter

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

Defined in: yajsapi/executor/ctx.ts:284

_id

Private _id: any

Defined in: yajsapi/executor/ctx.ts:280

_pending_steps

Private _pending_steps: Work[]

Defined in: yajsapi/executor/ctx.ts:282

_started

Private _started: boolean

Defined in: yajsapi/executor/ctx.ts:283

_storage

Private _storage: StorageProvider

Defined in: yajsapi/executor/ctx.ts:281

Methods

_prepare

_prepare(): void

Returns: void

Defined in: yajsapi/executor/ctx.ts:297

begin

begin(): void

Returns: void

Defined in: yajsapi/executor/ctx.ts:303

commit

commit(__namedParameters: { timeout?: undefined | number }): Work

Creates sequence of commands to be sent to provider.

Parameters:

__namedParameters: object

Name

Type

timeout?

undefined | number

Returns: Work

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

Defined in: yajsapi/executor/ctx.ts:368

download_file

download_file(src_path: string, dst_path: string): 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:347

log

log(args: any): void

Parameters:

Name

Type

args

any

Returns: void

Defined in: yajsapi/executor/ctx.ts:359

run

run(cmd: string, args?: Iterable<string>, env?: null | object): void

Schedule running a command.

Parameters:

Name

Type

Default value

Description

cmd

string

-

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

args?

Iterable<string>

-

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

send_file

send_file(src_path: string, dst_path: string): 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:322

send_json

send_json(json_path: string, data: {}): void

Schedule sending JSON data to the provider.

Parameters:

Name

Type

Description

json_path

string

remote (provider) path

data

{}

object representing JSON data

Returns: void

Defined in: yajsapi/executor/ctx.ts:311

sign

sign(): void

Returns: void

Defined in: yajsapi/executor/ctx.ts:354