G
G
Golem SDK
Search
K

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
undefined
emitter
null | default<[StorageEvent], void>
null
Defined in

Properties

_emitter

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

_id

Private _id: any
Defined in

_pending_steps

Private _pending_steps: Work[]
Defined in

_started

Private _started: boolean
Defined in

_storage

Private _storage: StorageProvider
Defined in

Methods

_prepare

_prepare(): void
Returns
void
Defined in

begin

begin(): void
Returns
void
Defined in

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

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

log

log(args): void
Parameters
Name
Type
args
any
Returns
void
Defined in

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

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

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

sign

sign(): void
Returns
void
Defined in