Skip to content

Remote editors

Remote editors enable code execution on different kdb+ processes from a single Developer instance. Scratchpads and .q files can be connected to external kdb+ processes to evaluate single snippets of code or entire scripts.

Getting started

To connect to a remote process, click Remote Scratchpad from the Tools menu.

Remote scratchpad menu

This will open a new scratchpad and launch the Connection Manager.

Empty connection manager

Add a new connection to an existing kdb+ process by clicking New and entering the values. In this example, we are connecting to a process running on the same machine as Developer on port 8065. In this example, the remote process requires credentials to connect so the Password Protected field has been selected. Selecting a color can help identify that this Scratchpad is connected to this remote process.

New connection dialog

The connection has been created for the remote process but it has not yet been connected to. The connection can be opened by clicking the Connect button. In this case, we are going to also going to attach the connection to our remote Scratchpad, so we can just click Attach to open the connection and attach to it at the same time. Because we selected password protected, this will prompt for credentials to connect to the process.

Connect to process

Now that a connection to the remote process has been opened and attached to this editor, anything evaluated in the editor will be executed on the remote process.

Remote editor

Connection manager

The connection manager can be accessed by Connection Manager... from the File menu. It can also be accessed when attaching a remote connection to an editor using the context menu and selecting Remote > Attach...

Connection manager

The connection manager lists the configured connections to remote processes.

column description
Favorite connection indicator. Click the empty start ☆ to favorite a connection and use the Filter drop down to hide and show only favorites
Name User defined name for the connection. This name is displayed in the tab of any connected editors.
Connection The IPC connection string for the configured connection. See IPC handles for more information.
Active Indicates if the connection to the remote process is currently established or not.
Color The connection color is used to highlight the editor tab to indicate which connection is being used.

To search for a specific connection string or connection name, a search can be entered in the Search field. To filter the results by group, a filter can be filtered using the Filter drop down menu.

Connection filter

filter description
All Show all connections
Active Show only connections that are currently connected to a remote process
Favorite Show connections that have been starred ★
User Show connections that were manually created
Control (platform only) Show process instances, tasks and services from Control that can be connected to

Creating a connection

To create a new connection, click the New button. This will open the New Connection dialog. Enter the connection information in the fields provided and click Ok to create the connection. Once the connection information has been added, the remote process can be connected to by pressing the Connect button. The table below outlines each of the fields for creating a connection.

New connection dialog

field description
Name The name of the connection is used to identify which process an editor is being connected to. This name will be prepended to any editors that use this connection.
Host The host field is a combination of a protocol (Localhost, Hostname, TLS/SSL, Domain Sockets) and a location. For more information about these protocols, see IPC handles.
Port The port of the remote process to connect to. Check the remote process's port by running system "p" on the remote process. See listening port for more information.
Timeout The maximum time in milliseconds to wait for the connection handshake to the remote process.
Password Protected If the remote process uses authentication for connections, check the Password Protected box to be prompted for a username and password when connecting to the remote.
Capture Output A variable name to store the computation output of the remote process in the current local process. See remote results for more information.
Tab Color The tab color is used to highlight editors that are connected to this remote process

Connecting to a process

To connect to a remote process, select the connection in the connection list and click Connect. If the connection is password protected, a dialog to enter the username and password will be presented.

Connect to process

To close the connection, select the connection in the connection list and click Disconnect. If the remote closes the handle or the connection is dropped, the connection will automatically be disconnected. Subsequent operations in the remote editor will prompt to reconnect to the remote connection. Once reconnected to the process, the issued operation will be re-run.

Auto reconnect

Interacting with remote editors

Remote editors support executing arbitrary code on the remote connection. Code can be evaluated on the remote process with the same controls as a normal editor (display, execute, etc.). See Q menu commands for more information about execution options. Remote editors can also be used to inspect data values in the Visual Inspector, however this requires capture output to be enabled.

Running remote scripts

In addition to ad-hoc code execution, entire scripts can be run on the remote process. To run a script on a remote process, open the script from the workspace tree and attach the editor to a remote process.

Attach script

Once connected, right click on the script editor and select Run Script. This will evaluate the entire remote script in the remote process.

Run remote script

Remote results

Computations on the remote process are not directly accessible in the current process. To pull data from the remote process to the local process, use the Capture Output option for a connection. When this option is enabled and a variable name is provided, the result of code executed on the remote process will be stored in a variable of that name in the local process. To limit the amount of data that is transferred from the remote process to the local process, a data limit is associated with the output variable. Setting this value will reduce the number of records pulled from the remote process to the local process with a maximum of this value.

Capture output

The capture output variable is overwritten on each remote evaluation. To save the result of a computation for further use, it is recommended that the data is copied to a different variable.

Capture output

Once setup, all expressions evaluated using the remote connection will store their result in the local process using the variable of that name.

Remote result

This can be useful for pulling data to the local process to use tools like the Visual Inspector to inspect the result data further. If capture output is enabled, inspecting something in the remote process will store the value in the output variable and open the inspector on it.