Class: ActivityModuleImpl
activity/activity.module.ActivityModuleImpl
Implements
Table of contents
Constructors
Properties
Methods
- createScriptExecutor
- executeScript
- getBatchResults
- observeStreamingBatchEvents
- createActivity
- destroyActivity
- refreshActivity
- findActivityById
- createExeUnit
Constructors
constructor
• new ActivityModuleImpl(services
): ActivityModuleImpl
Parameters
Name | Type |
---|---|
services | GolemServices |
Returns
Defined in
src/activity/activity.module.ts:115
Properties
events
• Readonly
events: EventEmitter
<ActivityEvents
, any
>
Implementation of
Defined in
src/activity/activity.module.ts:109
Methods
createScriptExecutor
▸ createScriptExecutor(activity
, options?
): ExeScriptExecutor
Factory method for creating a script executor for the activity
Parameters
Name | Type |
---|---|
activity | Activity |
options? | ExecutionOptions |
Returns
Implementation of
ActivityModule.createScriptExecutor
Defined in
src/activity/activity.module.ts:119
executeScript
▸ executeScript(activity
, script
): Promise
<string
>
Execute a script on the activity.
Parameters
Name | Type |
---|---|
activity | Activity |
script | ExeScriptRequest |
Returns
Promise
<string
>
Implementation of
Defined in
src/activity/activity.module.ts:123
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
>[]>
Implementation of
ActivityModule.getBatchResults
Defined in
src/activity/activity.module.ts:156
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
>
Implementation of
ActivityModule.observeStreamingBatchEvents
Defined in
src/activity/activity.module.ts:186
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
Implementation of
Defined in
src/activity/activity.module.ts:217
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
Implementation of
ActivityModule.destroyActivity
Defined in
src/activity/activity.module.ts:237
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
>
Implementation of
ActivityModule.refreshActivity
Defined in
src/activity/activity.module.ts:258
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
>
Implementation of
ActivityModule.findActivityById
Defined in
src/activity/activity.module.ts:287
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