On this page

# NodeManager

NodeManager

The manager for all the node operations.

## Constructor

### (private) new NodeManager(client, node, logger)

The NodeManager constructor.

Parameters:

Name | Type | Description
--- | --- | ---
`client` | ZxAIClient |
`node` | string |
`logger` | Logger |

Source
  - node.manager.js, line 21

## Classes

NodeManager

## Members

### (private) client :ZxAIClient

The network client reference.

Type:

- ZxAIClient

Source
  - node.manager.js, line 28

### (private) logger :Logger

The logger handler to be used for logging messages.

Type:

- Logger

Source
  - node.manager.js, line 36

### (private) node :string

The node this manager is attached to.

Type:

- string

Source
  - node.manager.js, line 44

### (private) pipelines :Array.<Pipeline>

The list of open Pipelines on this node.

Type:

- Array.<Pipeline>

Source
  - node.manager.js, line 52

### (private) pipelinesMarkedForClosing :Array.<string>

The list of Pipelines to be closed when commiting the pending changes.

Type:

- Array.<string>

Source
  - node.manager.js, line 60

## Methods

### (async, private) _getRunningPipelines() → {Promise.<Array.<Pipeline>>}

Returns the pipelines running on this node as they're reflected by the last received heartbeat.

Source
  - node.manager.js, line 793

Returns:

Type:
  Promise.<Array.<Pipeline>>

### (async) attachPluginInstance(pipelineOrId, instance) → {Promise.<NodeManager>}

Adds a new Plugin Instance to be deployed on the Pipeline.

Parameters:

Name | Type | Description
--- | --- | ---
`pipelineOrId` | Pipeline | string |
`instance` | PluginInstance |

Source
  - node.manager.js, line 500

Returns:

Type:
  Promise.<NodeManager>

### (async) closePipeline(pipelineOrId) → {Promise.<NodeManager>}

Closes the pipeline by queueing an Archive Config command for the NaeuralEdgeProtocol node.

Parameters:

Name | Type | Description
--- | --- | ---
`pipelineOrId` | Pipeline | string |

Source
  - node.manager.js, line 482

Returns:

Type:
  Promise.<NodeManager>

### (async) commit() → {Promise.<Array.<Object>>}

Commits the changes registered for the node.

Source
  - node.manager.js, line 681

Returns:

Type:
  Promise.<Array.<Object>>

### (async) createPipeline(dataSource, name) → {Promise.<Pipeline>}

Creates a pipeline on the managed node.

Parameters:

Name | Type | Default | Description
--- | --- | --- | ---
`dataSource` | Object |  |
`name` | string | null | null |

Source
  - node.manager.js, line 303

Returns:

Type:
  Promise.<Pipeline>

### createPluginInstance(signature, config, name) → {PluginInstance}

Method for creating a PluginInstance of a specific signature with the provided config. If no name is provided a generated name will be assigned.

Parameters:

Name | Type | Default | Description
--- | --- | --- | ---
`signature` | string |  |
`config` | Object |  |
`name` | string | null | null |

Source
  - node.manager.js, line 376

Returns:

Type:
  PluginInstance

### (async) getFullHeartbeatFromEdgeNode() → {Promise.<Object>}

Sends a request for a detailed heartbeat to the node.

Source
  - node.manager.js, line 288

Returns:

Type:
  Promise.<Object>

### (async) getHardwareStats() → {Promise.<Object>}

Sends a request for the node hardware stats history.

Source
  - node.manager.js, line 211

Returns:

Type:
  Promise.<Object>

### (async) getHeartbeatFromEdgeNode() → {Promise.<Object>}

Sends a heartbeat request to the node.

Source
  - node.manager.js, line 275

Returns:

Type:
  Promise.<Object>

### (async) getPipeline(pipelineId) → {Promise.<(Pipeline|null)>}

Returns the pipeline with id `pipelineId` if it exists on this node.

Parameters:

Name | Type | Description
--- | --- | ---
`pipelineId` | string |

Source
  - node.manager.js, line 346

Returns:

Type:
  Promise.<(Pipeline|null)>

### (async) getPipelines() → {Promise.<Array.<Pipeline>>}

Returns all the pipelines associated with a node.

Source
  - node.manager.js, line 359

Returns:

Type:
  Promise.<Array.<Pipeline>>

### (async) getPluginInstance(pipelineOrId, instanceId) → {Promise.<(PluginInstance|null)>}

Returns the Plugin Instance identified by `instanceId` from the instances running on this pipeline. If no instance is found, then `null` is returned.

Parameters:

Name | Type | Description
--- | --- | ---
`pipelineOrId` | Pipeline | string |
`instanceId` | string |

Source
  - node.manager.js, line 407

Returns:

Type:
  Promise.<(PluginInstance|null)>

### (async) getPluginInstances() → {Promise.<Array.<PluginInstance>>}

Returns the list of plugin instances running on this pipeline.

Source
  - node.manager.js, line 425

Returns:

Type:
  Promise.<Array.<PluginInstance>>

### (async) linkInstances(instances) → {Promise.<NodeManager>}

Links the instances provided as parameters.

Parameters:

Name | Type | Description
--- | --- | ---
`instances` | Array.<PluginInstance> |

Source
  - node.manager.js, line 576

Returns:

Type:
  Promise.<NodeManager>

### (async) prepareCustomCode(code, instanceName, pipeline) → {Promise.<NodeManager>}

Parameters:

Name | Type | Description
--- | --- | ---
`code` |  |
`instanceName` |  |
`pipeline` |  |

Source
  - node.manager.js, line 177

Returns:

Type:
  Promise.<NodeManager>

### removeInstanceTag(instance, tag) → {NodeManager}

Removes a tag from the plugin instance.

Parameters:

Name | Type | Description
--- | --- | ---
`instance` | PluginInstance |
`tag` | string |

Source
  - node.manager.js, line 652

Returns:

Type:
  NodeManager

### (async) removePluginInstance(pipelineOrId, instance) → {Promise.<NodeManager>}

Removes a running plugin instance from the pipeline instance list.

Parameters:

Name | Type | Description
--- | --- | ---
`pipelineOrId` | Pipeline | string |
`instance` | PluginInstance |

Source
  - node.manager.js, line 520

Returns:

Type:
  Promise.<NodeManager>

### (async) restartEdgeNode() → {Promise.<Object>}

Sends a request to restart the node.

Source
  - node.manager.js, line 249

Returns:

Type:
  Promise.<Object>

### setInstanceSchedule(instance, schedule, timezone) → {NodeManager}

Sets the working hours schedule for the instance. This method accepts either a detailed schedule for each day of the week or a single schedule for all days.

Parameters:

Name | Type | Default | Description
--- | --- | --- | ---
`instance` | PluginInstance |  |
`schedule` | Object | Array |  | The schedule to set. If an object, it should map days to time intervals. If an array, it applies the same schedule to all days.
`timezone` | string | UTC+0 |

Source
  - node.manager.js, line 669

Returns:

The instance of PluginInstance to allow method chaining.

Type:
  NodeManager

### setInstanceTags(instance, tags) → {NodeManager}

Sets the provided tags on the instance.

Parameters:

Name | Type | Description
--- | --- | ---
`instance` | PluginInstance |
`tags` | Object |

Source
  - node.manager.js, line 625

Returns:

Type:
  NodeManager

### (async) shutdownEdgeNode() → {Promise.<Object>}

Sends a request to stop the node.

Source
  - node.manager.js, line 262

Returns:

Type:
  Promise.<Object>

### tagInstance(instance, tag, value) → {NodeManager}

Sets the value for a specific tag on the plugin instance.

Parameters:

Name | Type | Description
--- | --- | ---
`instance` | PluginInstance |
`tag` | string |
`value` | string |

Source
  - node.manager.js, line 639

Returns:

Type:
  NodeManager

### updateInstance(instance, update) → {NodeManager}

Updates the config for a provided instance.

Parameters:

Name | Type | Description
--- | --- | ---
`instance` | PluginInstance |
`update` | Object |

Source
  - node.manager.js, line 612

Returns:

Type:
  NodeManager

### (async) updatePipelineConfig(pipelineOrId, update) → {Promise.<NodeManager>}

Updates the DataCaptureThread metadata for the specified pipeline.

Parameters:

Name | Type | Description
--- | --- | ---
`pipelineOrId` | Pipeline | string |
`update` | Object |

Source
  - node.manager.js, line 465

Returns:

Type:
  Promise.<NodeManager>

### (async) updatePipelineMetadata(pipelineOrId, metadata) → {Promise.<NodeManager>}

Updates the DataCaptureThread metadata for the specified pipeline.

Parameters:

Name | Type | Description
--- | --- | ---
`pipelineOrId` | Pipeline | string |
`metadata` | Object |

Source
  - node.manager.js, line 447

Returns:

Type:
  Promise.<NodeManager>

### (static) attachPluginInstanceToPipeline(pipeline, candidate, nowatch)

Static method that pushes a PluginInstance to a Pipeline. If the `nowatch` flag is set to true, this operation will not automatically append a watch on this instance in the next network request. This behavior is needed when attaching instances found on the received heartbeat, inside internal models, or when the watch is to be added manually, for supporting custom deployment mechanisms.

Parameters:

Name | Type | Default | Description
--- | --- | --- | ---
`pipeline` | Pipeline |  |
`candidate` | PluginInstance |  |
`nowatch` | boolean | false |

Source
  - node.manager.js, line 98

### (async, static) compilePipelineBatchUpdateInstances(pipeline) → {Promise.<Array.<ZxAIUpdateInstanceConfig>>}

Returns the change set list for all the plugin instances running on this pipeline.

Parameters:

Name | Type | Description
--- | --- | ---
`pipeline` | Pipeline |

Source
  - node.manager.js, line 155

Returns:

Type:
  Promise.<Array.<ZxAIUpdateInstanceConfig>>

### (static) compilePipelineUpdateConfig(pipeline)

Compiles the changeset for a given Pipeline.

Parameters:

Name | Type | Description
--- | --- | ---
`pipeline` | Pipeline |

Source
  - node.manager.js, line 124

### (static) getNodeManager(client, node, logger) → {NodeManager}

Returns an instance of a NodeManager for the requested `node`.

Parameters:

Name | Type | Description
--- | --- | ---
`client` | ZxAIClient |
`node` | string |
`logger` | Logger |

Source
  - node.manager.js, line 84

Returns:

Type:
  NodeManager

Type anything to view search result