Interface: ActivityModule
activity/activity.module.ActivityModule
Implemented by
Table of contents
Properties
Methods
- createActivity
- destroyActivity
- refreshActivity
- findActivityById
- createExeUnit
- createScriptExecutor
- executeScript
- getBatchResults
- observeStreamingBatchEvents
Properties
events
• events: EventEmitter
<ActivityEvents
, any
>
Defined in
src/activity/activity.module.ts:12
Methods
createActivity
▸ createActivity(agreement
): Promise
<Activity
>
Create and start a new activity on the provider for the supplied agreement
Parameters
Name | Type |
---|---|
agreement | Agreement |
Returns
Promise
<Activity
>
The resulting activity on the provider for further use
Defined in
src/activity/activity.module.ts:19
destroyActivity
▸ destroyActivity(activity
): Promise
<Activity
>
Definitely terminate any work on the provider
Parameters
Name | Type |
---|---|
activity | Activity |
Returns
Promise
<Activity
>
The activity that was permanently terminated
Defined in
src/activity/activity.module.ts:26
refreshActivity
▸ refreshActivity(staleActivity
): Promise
<Activity
>
Fetches the latest state of the activity. It's recommended to use this method before performing any actions on the activity to make sure it's in the correct state. If the fetched activity's state is different from the one you have, an event will be emitted.
Parameters
Name | Type |
---|---|
staleActivity | Activity |
Returns
Promise
<Activity
>
Defined in
src/activity/activity.module.ts:33
findActivityById
▸ findActivityById(activityId
): Promise
<Activity
>
Fetches the activity by its ID from yagna. If the activity doesn't exist, an error will be thrown.
Parameters
Name | Type |
---|---|
activityId | string |
Returns
Promise
<Activity
>
Defined in
src/activity/activity.module.ts:38
createExeUnit
▸ createExeUnit(activity
, options?
): Promise
<ExeUnit
>
Create a exe-unit "within" the activity so that you can perform commands on the rented resources
Parameters
Name | Type |
---|---|
activity | Activity |
options? | ExeUnitOptions |
Returns
Promise
<ExeUnit
>
An ExeUnit that's fully commissioned and the user can execute their commands
Defined in
src/activity/activity.module.ts:45
createScriptExecutor
▸ createScriptExecutor(activity
, options?
): ExeScriptExecutor
Factory method for creating a script executor for the activity
Parameters
Name | Type |
---|---|
activity | Activity |
options? | ExecutionOptions |
Returns
Defined in
src/activity/activity.module.ts:50
executeScript
▸ executeScript(activity
, script
): Promise
<string
>
Execute a script on the activity.
Parameters
Name | Type |
---|---|
activity | Activity |
script | ExeScriptRequest |
Returns
Promise
<string
>
Defined in
src/activity/activity.module.ts:55
getBatchResults
▸ getBatchResults(activity
, batchId
, commandIndex?
, timeout?
): Promise
<Result
<any
>[]>
Fetch the results of a batch execution.
Parameters
Name | Type |
---|---|
activity | Activity |
batchId | string |
commandIndex? | number |
timeout? | number |
Returns
Promise
<Result
<any
>[]>
Defined in
src/activity/activity.module.ts:60
observeStreamingBatchEvents
▸ observeStreamingBatchEvents(activity
, batchId
, commandIndex?
): Observable
<StreamingBatchEvent
>
Create an observable that will emit events from the streaming batch.
Parameters
Name | Type |
---|---|
activity | Activity |
batchId | string |
commandIndex? | number |
Returns
Observable
<StreamingBatchEvent
>
Defined in
Was this helpful?