JS API Reference

Class: ExeUnit

activity/exe-unit/exe-unit.ExeUnit

Groups most common operations that the requestors might need to implement their workflows

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new ExeUnit(activity, activityModule, options?): ExeUnit

Parameters

NameType
activityActivity
activityModuleActivityModule
options?ExeUnitOptions

Returns

ExeUnit

Defined in

src/activity/exe-unit/exe-unit.ts:69

Properties

provider

Readonly provider: ProviderInfo

Defined in

src/activity/exe-unit/exe-unit.ts:60


activity

Readonly activity: Activity

Defined in

src/activity/exe-unit/exe-unit.ts:70


activityModule

Readonly activityModule: ActivityModule

Defined in

src/activity/exe-unit/exe-unit.ts:71

Methods

setup

setup(): Promise<void | Result<any>[]>

This function initializes the exe unit by deploying the image to the remote machine and preparing and running the environment. This process also includes running setup function if the user has defined it

Returns

Promise<void | Result<any>[]>

Defined in

src/activity/exe-unit/exe-unit.ts:110


teardown

teardown(): Promise<void>

This function starts the teardown function if the user has defined it. It is run before the machine is destroyed.

Returns

Promise<void>

Defined in

src/activity/exe-unit/exe-unit.ts:152


run

run(commandLine, options?): Promise<Result<any>>

Execute a command on provider using a shell (/bin/sh).

Parameters

NameTypeDescription
commandLinestringShell command to execute.
options?CommandOptionsAdditional run options.

Returns

Promise<Result<any>>

Defined in

src/activity/exe-unit/exe-unit.ts:198

run(executable, args, options?): Promise<Result<any>>

Execute an executable on provider.

Parameters

NameTypeDescription
executablestringExecutable to run.
argsstring[]Executable arguments.
options?CommandOptionsAdditional run options.

Returns

Promise<Result<any>>

Defined in

src/activity/exe-unit/exe-unit.ts:207


runAndStream

runAndStream(commandLine, options?): Promise<RemoteProcess>

Run an executable on provider and return RemoteProcess that will allow streaming that contain stdout and stderr as Readable

Parameters

NameTypeDescription
commandLinestringShell command to execute.
options?Omit<CommandOptions, "capture">Additional run options.

Returns

Promise<RemoteProcess>

Defined in

src/activity/exe-unit/exe-unit.ts:231

runAndStream(executable, args, options?): Promise<RemoteProcess>

Parameters

NameTypeDescription
executablestringExecutable to run.
argsstring[]Executable arguments.
options?CommandOptionsAdditional run options.

Returns

Promise<RemoteProcess>

Defined in

src/activity/exe-unit/exe-unit.ts:237


transfer

transfer(from, to, options?): Promise<Result<any>>

Generic transfer command, requires the user to provide a publicly readable transfer source

Parameters

NameTypeDescription
fromstringpublicly available resource for reading. Supported protocols: file, http, ftp or gftp
tostringfile path
options?CommandOptionsAdditional run options.

Returns

Promise<Result<any>>

Defined in

src/activity/exe-unit/exe-unit.ts:272


uploadFile

uploadFile(src, dst, options?): Promise<Result<any>>

Parameters

NameType
srcstring
dststring
options?CommandOptions

Returns

Promise<Result<any>>

Defined in

src/activity/exe-unit/exe-unit.ts:277


uploadJson

uploadJson(json, dst, options?): Promise<Result<any>>

Parameters

NameType
jsonany
dststring
options?CommandOptions

Returns

Promise<Result<any>>

Defined in

src/activity/exe-unit/exe-unit.ts:283


uploadData

uploadData(data, dst, options?): Promise<Result<any>>

Parameters

NameType
dataUint8Array
dststring
options?CommandOptions

Returns

Promise<Result<any>>

Defined in

src/activity/exe-unit/exe-unit.ts:289


downloadFile

downloadFile(src, dst, options?): Promise<Result<any>>

Parameters

NameType
srcstring
dststring
options?CommandOptions

Returns

Promise<Result<any>>

Defined in

src/activity/exe-unit/exe-unit.ts:294


downloadData

downloadData(src, options?): Promise<Result<Uint8Array>>

Parameters

NameType
srcstring
options?CommandOptions

Returns

Promise<Result<Uint8Array>>

Defined in

src/activity/exe-unit/exe-unit.ts:299


downloadJson

downloadJson(src, options?): Promise<Result<any>>

Parameters

NameType
srcstring
options?CommandOptions

Returns

Promise<Result<any>>

Defined in

src/activity/exe-unit/exe-unit.ts:304


beginBatch

beginBatch(): Batch

Returns

Batch

Defined in

src/activity/exe-unit/exe-unit.ts:320


getWebsocketUri

getWebsocketUri(port): string

Provides a WebSocket URI that allows communicating with a remote process listening on the target port

Parameters

NameTypeDescription
portnumberThe port number used by the service running within an activity on the provider

Returns

string

Defined in

src/activity/exe-unit/exe-unit.ts:329


getIp

getIp(): string

Returns

string

Defined in

src/activity/exe-unit/exe-unit.ts:342


createTcpProxy

createTcpProxy(portOnProvider): TcpProxy

Creates a new TCP proxy that will allow tunnelling the TPC traffic from the provider via the requestor

Parameters

NameTypeDescription
portOnProvidernumberThe port that the service running on the provider is listening to

Returns

TcpProxy

Defined in

src/activity/exe-unit/exe-unit.ts:359


getDto

getDto(): ActivityDTO

Returns

ActivityDTO

Defined in

src/activity/exe-unit/exe-unit.ts:369