Class: WorkContext
task/work.WorkContext
Work Context
Description
Table of contents
Constructors
Properties
Methods
- before
- run
- spawn
- transfer
- uploadFile
- uploadJson
- uploadData
- downloadFile
- downloadData
- downloadJson
- beginBatch
- getWebsocketUri
- getIp
- getState
Constructors
constructor
• new WorkContext(activity
, options?
): WorkContext
Parameters
Name | Type |
---|---|
activity | Activity |
options? | WorkOptions |
Returns
Defined in
Properties
provider
• Readonly
provider: ProviderInfo
Defined in
activity
• Readonly
activity: Activity
Defined in
Methods
before
▸ before(): Promise
<void
| Result
<any
>[]>
Returns
Promise
<void
| Result
<any
>[]>
Defined in
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
▸ 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
spawn
▸ spawn(commandLine
, options?
): Promise
<RemoteProcess
>
Spawn an executable on provider and return RemoteProcess object 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
▸ spawn(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
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
uploadFile
▸ uploadFile(src
, dst
, options?
): Promise
<Result
<any
>>
Parameters
Name | Type |
---|---|
src | string |
dst | string |
options? | CommandOptions |
Returns
Promise
<Result
<any
>>
Defined in
uploadJson
▸ uploadJson(json
, dst
, options?
): Promise
<Result
<any
>>
Parameters
Name | Type |
---|---|
json | any |
dst | string |
options? | CommandOptions |
Returns
Promise
<Result
<any
>>
Defined in
uploadData
▸ uploadData(data
, dst
, options?
): Promise
<Result
<any
>>
Parameters
Name | Type |
---|---|
data | Uint8Array |
dst | string |
options? | CommandOptions |
Returns
Promise
<Result
<any
>>
Defined in
downloadFile
▸ downloadFile(src
, dst
, options?
): Promise
<Result
<any
>>
Parameters
Name | Type |
---|---|
src | string |
dst | string |
options? | CommandOptions |
Returns
Promise
<Result
<any
>>
Defined in
downloadData
▸ downloadData(src
, options?
): Promise
<Result
<Uint8Array
>>
Parameters
Name | Type |
---|---|
src | string |
options? | CommandOptions |
Returns
Promise
<Result
<Uint8Array
>>
Defined in
downloadJson
▸ downloadJson(src
, options?
): Promise
<Result
<any
>>
Parameters
Name | Type |
---|---|
src | string |
options? | CommandOptions |
Returns
Promise
<Result
<any
>>
Defined in
beginBatch
▸ beginBatch(): Batch
Returns
Defined in
getWebsocketUri
▸ getWebsocketUri(port
): string
Parameters
Name | Type |
---|---|
port | number |
Returns
string
Defined in
getIp
▸ getIp(): string
Returns
string
Defined in
getState
▸ getState(): Promise
<ActivityStateEnum
>
Returns
Promise
<ActivityStateEnum
>