The Persistent Query Controller (the controller, for short) is listed as iris_controller in monit, and runs on the controller pod in Kubernetes. It is the service responsible for managing Persistent Queries. For instance, when it is time to start a scheduled Persistent Query, it is the controller that starts the PQ and monitors its state. The Query Monitor (Web) and Query Config (Java Swing) panels obtain information about Persistent Queries in the system from the controller using the PersistentQueryControllerClient for Legacy or the PersistentQueryControllerClient for Core+.
For management of persistent queries from Core+ Python workers, you can use the standard Core+ client. When executed in the context of a worker, authentication is automatic.
Each PersistentQueryInfo object represents a PQ's current state, and includes methods to get additional details about it:
getState retrieves a PersistentQueryState, which provides the details about the running PQ, such as workerHost and workerPort.
getConfig retrieves a PersistentQueryConfiguration, which provides the details about the PQ, such as owner, worker settings, etc.
For Core+ workers:
In Python, pq.config returns a PersistentQueryConfigMessage, which provides details about the PQ such as owner, worker settings, and scheduling. In Groovy/Java, PQ.getConfig returns the same type.
Appendix A - Constant values for Persistent Query configuration types and type-specific fields
Note
Among the classes listed below, only io.deephaven.enterprise.util.IngesterPersistentQueryConstants is available to Core+ workers. The other classes listed here are available to Legacy workers directly, or through jpy.get_type. For Core+ workers, use the values documented here when setting configuration type or type-specific fields when creating or updating a Persistent Query.
import io.deephaven.enterprise.dnd.ControllerClientFactory;client = ControllerClientFactory.makeControllerClientFactory().getSubscribed();for (PQ in client.getDataCopy().values()) { println (PQ.getConfig().getName());}
from deephaven_enterprise.client.session_manager import SessionManagersm = SessionManager()for serial, pq in sm.controller_client.map().items(): print(pq.config.name)
import io.deephaven.enterprise.dnd.ControllerClientFactoryimport io.deephaven.proto.controller.PersistentQueryConfigMessageclient = ControllerClientFactory.makeControllerClientFactory().getSubscribed()// Retrieve an existing query by namepq = client.getDataCopy().values().find { it.getConfig().getName() == "My PQ" }// Modify the configurationexistingConfig = pq.getConfig()modifiedConfig = existingConfig.toBuilder() .setHeapSizeGb(8.0) .build()// Submit the modified configuration to the controllerclient.modifyQuery(modifiedConfig)
from deephaven_enterprise.client.session_manager import SessionManagerfrom deephaven_enterprise.proto.persistent_query_pb2 import PersistentQueryConfigMessagesm = SessionManager()client = sm.controller_client# Retrieve an existing query by namepq = next((p for p in client.map().values() if p.config.name == "My PQ"), None)# Modify the configurationmodified_config = PersistentQueryConfigMessage()modified_config.CopyFrom(pq.config)modified_config.heapSizeGb = 8.0# Submit the modified configuration to the controller (restarts the query if running)client.modify_query(modified_config, True)