modality wait-until

Command: modality wait-until [query expression]

Repeatedly execute a query (opens new window) against some region of recorded execution until the query returns true. This command only accepts AGGREGATE queries with a single boolean result. For further details on writing queries, see the SpeQTr language reference. (opens new window) The query expression can be given directly or via a path to a file containing the query.

This command is primarily useful when used with data collected live from a running system. It allows you to write scripts which coordinate actions based on observed system behavior rather than simply having to guess that enough time has elapsed for the system to have done what you expect.

# Examples

$ modality wait-until '"Received measurement message" @ consumer AGGREGATE count() > 50'
No explicit workspace provided. Using the default workspace.
...
[Time passes, measurements are received]
...
Success

$ modality wait-until '"Received measurement message" @ consumer AGGREGATE count() > 50' --deadline 1s
No explicit workspace provided. Using the default workspace.
Timed out

# Options

[query expression] - The query to evaluate. You must either pass a query expression as an argument or use the --file option. For more information on writing query expressions see the reference (opens new window).

--color <always | never | auto> - Whether to color the output. Default is auto, which will autodetect the target output location and whether or not it is capable of handling color escape codes.

--deadline <deadline> - The maximum amount of time to wait for the query to produce results. Accepts durations like "10ms" or "1minute 2seconds 22ms".

--file <expression file path> - Path to a file containing a query expression. Mutually exclusive with a query provided directly as a command line argument.

-f, --format <text | json> - The printed output format, defaults to text.

--global - Show events from Modality's entire database. If this flag is not present events are limited to those visible from the current segment(s) of the current workspace. May not be used with --latest-segment, --segment, --segmentation-rule, or --whole-workspace.

--latest-segment - Limit data to the single most recent segment (i.e. the segment which has most recently received an event or timeline attribute update) rather than the current default segment. The latest segment is automatically updated as new data are received. May not be used with --global, --segment, --segmentation-rule, or --whole-workspace.

--segment <segment pattern>... - Limit data to the given segment(s) rather than the current default segment(s). Accepts one or more segment name patterns, which can include * or ? as wildcards in the style of glob. May not be used with --global, --latest-segment, or --whole-workspace.

--segmentation-rule <segmentation rule pattern>... - Limit data to segments produced by the given segmentation rule(s) rather than the current default segment(s). Accepts one or more segmentation rule name patterns, which can include * or ? as wildcards in the style of glob. May not be used with --global, --latest-segment, or --whole-workspace.

--timeline-filter <timeline filter> - A timeline filter expression to restrict the output to events from timelines that match the filter.

-v, --verbose - Print verbose debugging information.

--whole-workspace - Limit data to the workspace as a monolithic whole unit, ignoring the default segment(s). May not be used with --global, --latest-segment, --segment, or --segmentation-rule.

--with-lax-causality - Trust all wall clocks for this query. This means explicit communications between timelines are not necessary to indicate that one event followed another. Practically, this means that FOLLOWED BY operators can apply across timelines, simply checking the wall clock times reported in the events' event.timestamp attribute.

--with-timeline-attributes - Display all related timeline attributes for each event.

--workspace-name <workspace name> - Name of the workspace to display data for. If not specified the current default workspace (set with modality workspace use) will be used.