Persistent Query API

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+.

Persistent query services and objects

The PersistentQueryControllerClient provides a method (getDataCopy()) that returns a Map of persistent query serials and PersistentQueryInfo objects.

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.

import io.deephaven.enterprise.dnd.ControllerClientFactory;

client = ControllerClientFactory.makeControllerClientFactory().getSubscribed();
for (PQ in client.getDataCopy().values()) {
    println (PQ.getConfig().getName());
}

Each PersistentQueryInfo object represent 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 Legacy Workers

Legacy workers use the getData() method, as shown.

import com.illumon.iris.controller.PersistentQueryControllerClient;

client = PersistentQueryControllerClient.getControllerClient("Console Script",log, true);
for (PQ in client.getData().values()) {
    println (PQ.getConfig().getName());
Level = jpy.get_type("com.fishlib.io.log.LogLevel").INFO
Logger = jpy.get_type("com.fishlib.io.logger.NullLoggerImpl")
pqc = jpy.get_type("com.illumon.iris.controller.PersistentQueryControllerClient")

client = pqc.getControllerClient("Console Script", Logger(Level), True)
PQs = client.getData().values().toArray()
for PQ in PQs:
    print(PQ.getConfig().getName())

For Core+ workers:

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 SessionManager

sm = SessionManager()

for serial, pq in sm.controller_client.map().items():
    print(pq.config.name)

Each PersistentQueryInfo object represent 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.

Appendix A - Constant values for Persistent Query configuration types and type-specific fields

Note

Among the classes listed below, only io.deephaven.shadow.enterprise.com.illumon.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.

com.illumon.iris.pqimport.BinaryImportPersistentQuery

Modifier and TypeConstant FieldValue
public static final StringCONFIGURATION_TYPE"BinaryImport"
public static final StringTYPE_SPECIFIC_FIELDS_SOURCE_DIRECTORY"SourceDirectory"
public static final StringTYPE_SPECIFIC_FIELDS_SOURCE_FILE"SourceFile"
public static final StringTYPE_SPECIFIC_FIELDS_SOURCE_GLOB"SourceGlob"

com.illumon.iris.pqimport.CsvImportPersistentQuery

Modifier and TypeConstant FieldValue
public static final StringCONFIGURATION_TYPE"CsvImport"
public static final StringCONSTANT"Constant"
public static final StringDELIMITER"Delimiter"
public static final StringFILEFORMAT"Fileformat"
public static final StringNO_HEADER"NoHeader"
public static final StringSKIP_FOOTER_LINES"SkipFooterLines"
public static final StringSKIPLINES"Skiplines"
public static final StringSOURCE_DIRECTORY"SourceDirectory"
public static final StringSOURCE_FILE"SourceFile"
public static final StringSOURCE_GLOB"SourceGlob"
public static final StringTRIM"Trim"

com.illumon.iris.pqimport.DownsampleImportPersistentQuery

Modifier and TypeConstant FieldValue
public static final StringAGGREGATE_COLUMNS"AggregateColumns"
public static final StringAGGREGATE_TYPES"AggregateTypes"
public static final StringALL_BINS"AllBins"
public static final StringCALENDAR"Calendar"
public static final StringCONFIGURATION_TYPE"DownsampleImport"
public static final StringKEY_COLUMNS"KeyColumns"
public static final StringMAINTAIN_STATE_COLUMNS"MaintainStateColumns"
public static final StringNUM_THREADS"NumThreads"
public static final StringPERIOD"Period"
public static final StringSOURCE_NAMESPACE"SourceNamespace"
public static final StringSOURCE_TABLE"SourceTable"
public static final StringTIME_BIN_MODE"TimeBinMode"
public static final StringTIMESTAMP_COLUMN"TimestampColumn"

com.illumon.iris.pqimport.ImportPersistentQuery

Modifier and TypeConstant FieldValue
public static final StringAPPEND"Append"
public static final StringIMPORT_SOURCE"ImportSource"
public static final StringINTRADAY_PARTITION_COLUMN"IntradayPartitionColumn"
public static final StringOUTPUT_MODE_APPEND"Append"
public static final StringOUTPUT_MODE_REPLACE"Replace"
public static final StringOUTPUT_MODE_SAFE"Safe"
public static final StringSTRICT"Strict"
public static final StringTYPE_SPECIFIC_FIELDS_OUTPUT_MODE"OutputMode"

com.illumon.iris.pqimport.JdbcImportPersistentQuery

Modifier and TypeConstant FieldValue
public static final StringCATALOG"catalog"
public static final StringCONFIGURATION_TYPE"JdbcImport"
public static final StringDRIVER"driver"
public static final StringPASSWORD"password"
public static final StringQUERY"query"
public static final StringURI"uri"
public static final StringUSER"user"

com.illumon.iris.pqimport.MergeImportPersistentQuery

Modifier and TypeConstant FieldValue
public static final StringPARTITION_SUBSTITUTION"PartitionSubstitution"
public static final StringSUBSTITUTION_DATE_FORMAT"SubstitutionDateFormat"

com.illumon.iris.pqimport.MergePersistentQuery

Modifier and TypeConstant FieldValue
public static final StringALLOW_EMPTY_INPUT"AllowEmptyInput"
public static final StringFORCE_OPTION"Force"
public static final StringLOW_HEAP_USAGE"LowHeapUsage"
public static final StringSORT_COLUMN_FORMULA"SortColumnFormula"
public static final StringTHREAD_POOL_SIZE"ThreadPoolSize"
public static final StringTYPE_SPECIFIC_FIELD_CODEC"Codec"
public static final StringTYPE_SPECIFIC_FIELD_FORMAT"Format"

com.illumon.iris.pqimport.ValidatePersistentQuery

Modifier and TypeConstant FieldValue
public static final StringDELETE_INTRADAY_DATA"DeleteIntradayData"
public static final StringTEST_TYPE"TestType"
public static final StringVALIDATOR_CLASS"ValidatorClass"

com.illumon.iris.pqimport.XmlImportPersistentQuery

Modifier and TypeConstant FieldValue
public static final StringCONFIGURATION_TYPE"XmlImport"
public static final StringCONSTANT"Constant"
public static final StringDELIMITER"Delimiter"
public static final StringELEMENT_TYPE"ElementType"
public static final StringMAX_DEPTH_ELEMENT"MaxDepth"
public static final StringSOURCE_DIRECTORY"SourceDirectory"
public static final StringSOURCE_FILE"SourceFile"
public static final StringSOURCE_GLOB"SourceGlob"
public static final StringSTART_DEPTH_ELEMENT"StartDepth"
public static final StringSTART_INDEX_ELEMENT"StartIndex"
public static final StringSUBSTITUTION_DATE_FORMAT"SubstitutionDateFormat"
public static final StringUSE_ATTRIBUTE_VALUES"AttributeValues"
public static final StringUSE_ELEMENT_VALUES"ElementValues"
public static final StringUSE_NAMED_VALUES"NamedValues"

com.illumon.util.IngesterPersistentQueryConstants (also available from io.deephaven.shadow.enterprise.com.illumon.util.IngesterPersistentQueryConstants)

Modifier and TypeConstant FieldValue
public static final StringCONFIGURATION_TYPE_MERGE"Merge"
public static final StringCONFIGURATION_TYPE_VALIDATE"Validate"
public static final StringTYPE_SPECIFIC_FIELD_NAMESPACE"Namespace"
public static final StringTYPE_SPECIFIC_FIELD_TABLE"Table"
public static final StringTYPE_SPECIFIC_FIELD_PARTITION_FORMULA"PartitionFormula"

Appendix B - Restart users enum and constant values

io.deephaven.proto.controller.RestartUsersEnum (Core+)

Enumeration NameEnumeration Value
RU_UNSPECIFIED0
RU_ADMIN1
RU_ADMIN_AND_VIEWERS2
RU_RESERVED_13
RU_VIEWERS_WHEN_DOWN4

com.illumon.dataobjects.generated.DefaultPersistentQueryConfiguration (Legacy)

Modifier and TypeConstant FieldValue
public static final intRESTARTUSERS_ADMIN1
public static final intRESTARTUSERS_ADMINANDVIEWERS2
public static final intRESTARTUSERS_VIEWERSWHENDOWN4