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
- setup
- teardown
- run
- runAndStream
- transfer
- uploadFile
- uploadJson
- uploadData
- downloadFile
- downloadData
- downloadJson
- beginBatch
- getWebsocketUri
- getIp
- createTcpProxy
- getDto
Constructors
constructor
• new ExeUnit(activity
, activityModule
, options?
): ExeUnit
Parameters
Name | Type |
---|---|
activity | Activity |
activityModule | ActivityModule |
options? | ExeUnitOptions |
Returns
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
Name | Type | Description |
---|---|---|
commandLine | string | Shell command to execute. |
options? | CommandOptions | Additional 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
Name | Type | Description |
---|---|---|
executable | string | Executable to run. |
args | string [] | Executable arguments. |
options? | CommandOptions | Additional 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
Name | Type | Description |
---|---|---|
commandLine | string | Shell 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
Name | Type | Description |
---|---|---|
executable | string | Executable to run. |
args | string [] | Executable arguments. |
options? | CommandOptions | Additional 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
Name | Type | Description |
---|---|---|
from | string | publicly available resource for reading. Supported protocols: file, http, ftp or gftp |
to | string | file path |
options? | CommandOptions | Additional 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
Name | Type |
---|---|
src | string |
dst | string |
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
Name | Type |
---|---|
json | any |
dst | string |
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
Name | Type |
---|---|
data | Uint8Array |
dst | string |
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
Name | Type |
---|---|
src | string |
dst | string |
options? | CommandOptions |
Returns
Promise
<Result
<any
>>
Defined in
src/activity/exe-unit/exe-unit.ts:294
downloadData
▸ downloadData(src
, options?
): Promise
<Result
<Uint8Array
>>
Parameters
Name | Type |
---|---|
src | string |
options? | CommandOptions |
Returns
Promise
<Result
<Uint8Array
>>
Defined in
src/activity/exe-unit/exe-unit.ts:299
downloadJson
▸ downloadJson(src
, options?
): Promise
<Result
<any
>>
Parameters
Name | Type |
---|---|
src | string |
options? | CommandOptions |
Returns
Promise
<Result
<any
>>
Defined in
src/activity/exe-unit/exe-unit.ts:304
beginBatch
▸ beginBatch(): Batch
Returns
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
Name | Type | Description |
---|---|---|
port | number | The 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
Name | Type | Description |
---|---|---|
portOnProvider | number | The port that the service running on the provider is listening to |
Returns
Defined in
src/activity/exe-unit/exe-unit.ts:359
getDto
▸ getDto(): ActivityDTO