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.
To connect to a remote process, click Remote Scratchpad from the Tools menu.
This will open a new scratchpad and launch the 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
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.
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.
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.
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...
The connection manager lists the configured connections to remote processes.
|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.|
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.
|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
|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.
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 and an error will appear for all subsequent remote editor operations.
Connection not open to [local] demo.rte - open the connection and try again
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.
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.
Once connected, right click on the script editor and select Run Script. This will evaluate the entire remote script in the remote process.
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.
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 data limits
If capture output is used to bring data from the remote process to the local process,
note that there is currently no limit on the size of the resulting data being captured and sent
back to the local process. The entire result of an expression evaluation will be returned.
This could be an issue when inspecting large tables on a remote process. If not using capture
output, only a sample of the data will be returned based on the console size settings (
Once setup, all expressions evaluated using the remote connection will store their result in the local process using the variable of that name.
This can be useful for pulling data to the local process to use tools like the Visual Inspector to inspect the result data further.