deephaven_enterprise.client.generate_scheduling¶
This module contains helper methods to generate scheduling arrays for use in persistent queries.
- class GenerateScheduling[source]¶
Bases:
objectThis class contains helper methods to generate scheduling arrays for use in persistent queries.
- static generate_continuous_scheduler(start_time, time_zone='America/New_York', restart_daily=False, restart_error_count=0, restart_error_delay_minutes=0)[source]¶
Generate a scheduler array for a Persistent Query that has continuous scheduling.
- Parameters:
start_time (str) – the query’s restart time in HH:MM:SS format
time_zone (str) – the time zone, such as ‘America/New_York’ or ‘Europe/London’, defaults to ‘America/New_York’
restart_daily (bool) – if True, then the query should be restarted every day at the defined start_time, defaults to False
restart_error_count (int) – the number of times a failing query will attempt to be restarted within its run window, defaults to 0
restart_error_delay_minutes (int) – the delay in minutes between attempting to restart a failed query, defaults to 0
- Return type:
- Returns:
a scheduling definition array that can be passed to the controller when adding or updating a Persistent Query
- Raises:
- static generate_daily_scheduler(start_time, stop_time, time_zone='America/New_York', business_days=False, calendar='USNYSE', days=[True, True, True, True, True, True, True], overnight=False, repeat_enabled=False, repeat_interval=0, skip_if_unsuccessful=False, stop_time_disabled=False, restart_error_count=0, restart_error_delay_minutes=0, restart_when_running='Yes')[source]¶
Generates a scheduler array for a Persistent Query that has daily scheduling.
- Parameters:
start_time (str) – the Persistent Query’s starting time in HH:MM:SS format
stop_time (str) – the Persistent Query’s stop time in HH:MM:SS format
time_zone (str) – the time zone, such as ‘America/New_York’ or ‘Europe/London’, defaults to ‘America/New_York’
business_days (bool) – if changed to True, only run on business days. Defaults to False.
calendar (str) – if business_days is True, the business calendar to use. Defaults to ‘USNYSE’.
days (list[bool]) – a list of bool values representing the days to run the Persistent Query, from Monday through Sunday. Defaults to [True, True, True, True, True, True, True].
overnight (bool) – if True, the Persistent Query runs overnight. Defaults to False.
repeat_enabled (bool) – for batch-style queries, if True, the Persistent Query will be restarted at the repeat_interval interval. Defaults to False.
repeat_interval (int) – if repeat_enabled is True, the interval in minutes between restarts. Defaults to 0.
skip_if_unsuccessful (bool) – for repeating queries, skip if the previous run failed when this is True. Defaults to False.
stop_time_disabled (bool) – if True, the Persistent Query does not need a stop time (for example, non-repeating batch queries). Defaults to False.
restart_error_count (int) – the number of times a failing Persistent Query will attempt to be restarted within its run window. Defaults to 0.
restart_error_delay_minutes (int) – the delay in minutes between attempting to restart a failed Persistent Query. Defaults to 0.
restart_when_running (str) – if ‘Yes’ then the Persistent Query will be restarted when running at its start time, if ‘No’ it will be left running. Defaults to ‘Yes’.
- Return type:
- Returns:
a scheduling definition array that can be passed to the controller when adding or updating a Persistent Query
- static generate_dependent_scheduler(start_time, stop_time, time_zone='America/New_York', dependent_query_serials=None, run_on_failure=False, restart_on_condition=False, run_on_any_dependency_met=False, use_minimum_start_time=False, run_each_time=False, deadline_start='00:00:00', deadline_end='23:59:59', overnight=False, repeat_enabled=False, repeat_interval=0, skip_if_unsuccessful=False, stop_time_disabled=False, restart_error_count=0, restart_error_delay_minutes=0, restart_when_running='Yes')[source]¶
Generates a scheduler array for a Persistent Query that has dependent scheduling.
- Parameters:
start_time (str) – the query’s starting time in HH:MM:SS format
stop_time (str) – the query’s stop time in HH:MM:SS format
time_zone (str) – the time zone, such as ‘America/New_York’ or ‘Europe/London’, defaults to
'America/New_York'
dependent_query_serials (list[int]) – the serials of the dependent Persistent Query
run_on_failure (bool) – if True, run when dependencies fail (rather than succeed), defaults to False
restart_on_condition (bool) – if True, restart when conditions are met even if the query is running at the time, defaults to False
run_on_any_dependency_met (bool) – if True, run when any dependency is met, otherwise all dependencies must be met, defaults to False
use_minimum_start_time (bool) – if True, delay start of query after dependencies are met until the specified start_time, defaults to False
run_each_time (bool) – if True, run every time dependencies are met, otherwise run once each day, defaults to False
deadline_start (str) – the start of the time at which the query should respond to dependency changes, in HH:MM:SS format, defaults to “00:00:00”
deadline_end (str) – the end of the time at which the query should respond to dependency changes, in HH:MM:SS format, defaults to “23:59:59”
overnight (bool) – if True, the query runs overnight, defaults to False
repeat_enabled (bool) – for batch-style queries, if True, the Persistent Query will be restarted at the repeat_interval interval, defaults to False
repeat_interval (int) – if repeat_enabled is True, the interval in minutes between restarts, defaults to 0
skip_if_unsuccessful (bool) – for repeating queries, skip if the previous run failed when this is True, defaults to False
stop_time_disabled (bool) – if True, the Persistent Query does not need a stop time (for example, non-repeating batch queries), defaults to False
restart_error_count (int) – the number of times a failing query will attempt to be restarted within its run window, defaults to 0
restart_error_delay_minutes (int) – the delay in minutes between attempting to restart a failed query, defaults to 0
restart_when_running (str) – if ‘Yes’ then the query will be restarted when running at its start time, if ‘No’ it will be left running, defaults to ‘Yes’
- Return type:
- Returns:
a scheduling definition array that can be passed to the controller when adding or updating a Persistent Query
- Raises:
- static generate_disabled_scheduler()[source]¶
Generates a scheduler array for a Persistent Query with scheduling disabled.
- static generate_monthly_scheduler(start_time, stop_time, time_zone='America/New_York', business_days=False, calendar='USNYSE', first_business_day=False, last_business_day=False, months=[True, True, True, True, True, True, True, True, True, True, True, True], days=None, overnight=False, repeat_enabled=False, repeat_interval=0, skip_if_unsuccessful=False, stop_time_disabled=False, restart_error_count=0, restart_error_delay_minutes=0, restart_when_running='Yes')[source]¶
Generates a scheduler array for a Persistent Query that has monthly scheduling.
- Parameters:
start_time (str) – the Persistent Query’s starting time in HH:MM:SS format
stop_time (str) – the Persistent Query’s stop time in HH:MM:SS format
time_zone (str) – the time zone, such as ‘America/New_York’ or ‘Europe/London’, defaults to ‘America/New_York’
business_days (bool) – if changed to True, only run on business days. Defaults to False.
calendar (str) – if business_days is True, the business calendar to use. Defaults to ‘USNYSE’.
first_business_day (bool) – if True, then run the Persistent Query on the first business day of the month. Defaults to False.
last_business_day (bool) – if True, then run the Persistent Query on the last business day of the month. Defaults to False.
months (list[bool]) – a list of the months on which the Persistent Query will be started, starting with January. Defaults to [True, True, True, True, True, True, True, True, True, True, True, True].
days (list[int]) – a list of specific days (from 1 to 31) to run the Persistent Query for each month, or None if this is not needed. Defaults to None.
overnight (bool) – if True, the Persistent Query runs overnight. Defaults to False.
repeat_enabled (bool) – for batch-style queries, if True, the Persistent Query will be restarted at the repeat_interval interval. Defaults to False.
repeat_interval (int) – if repeat_enabled is True, the interval in minutes between restarts. Defaults to 0.
skip_if_unsuccessful (bool) – for repeating queries, skip if the previous run failed when this is True. Defaults to False.
stop_time_disabled (bool) – if True, the Persistent Query does not need a stop time (for example, non-repeating batch queries). Defaults to False.
restart_error_count (int) – the number of times a failing query will attempt to be restarted within its run window. Defaults to 0.
restart_error_delay_minutes (int) – the delay in minutes between attempting to restart a failed query. Defaults to 0.
restart_when_running (str) – if ‘Yes’ then the query will be restarted when running at its start time, if ‘No’ it will be left running. Defaults to ‘Yes’.
- Return type:
- Returns:
a scheduling definition array that can be passed to the controller when adding or updating a Persistent Query
- Raises:
- static generate_range_scheduler(start_time, stop_time, start_date, end_date, time_zone='America/New_York', repeat_enabled=False, repeat_interval=0, skip_if_unsuccessful=False, restart_error_count=0, restart_error_delay_minutes=0, restart_when_running='Yes')[source]¶
Generates a scheduler array for a Persistent Query that has range scheduling.
- Parameters:
start_time (str) – the query’s starting time in HH:MM:SS format, or None if no start date/time will be used
stop_time (str) – the query’s stop time in HH:MM:SS format, or None if no stop date/time will be used
start_date (str) – the query’s start date in YYYY-MM-DD format, or None if no start date/time will be used
end_date (str) – the query’s end date in YYYY-MM-DD format, or None if no stop date/time will be used
time_zone (str) – the time zone, such as ‘America/New_York’ or ‘Europe/London’, defaults to ‘America/New_York’
repeat_enabled (bool) – for batch-style queries, if True, the Persistent Query will be restarted at the repeat_interval interval, defaults to False
repeat_interval (int) – if repeat_enabled is True, the interval in minutes between restarts, defaults to 0
skip_if_unsuccessful (bool) – for repeating queries, skip if the previous run failed when this is True, defaults to False
restart_error_count (int) – the number of times a failing query will attempt to be restarted within its run, window, defaults to 0
restart_error_delay_minutes (int) – the delay in minutes between attempting to restart a failed query, defaults to 0
restart_when_running (str) – if ‘Yes’ then the query will be restarted when running at its start time, if ‘No’ it will be left running, defaults to ‘Yes’
- Return type:
- Returns:
a scheduling definition array that can be passed to the controller when adding or updating a Persistent Query
- Raises:
- static generate_temporary_scheduler(queue_name='DefaultTemporaryQueue', restart_error_count=0, restart_error_delay_minutes=0, auto_delete=True, expiration_time_minutes=1440, dependent_query_serial=None)[source]¶
Generate a scheduler array for a Persistent Query that has temporary scheduling.
- Parameters:
queue_name (str) – the temporary queue name, defaults to ‘DefaultTemporaryQueue’
restart_error_count (int) – the number of times a failing query will attempt to be restarted within its run window, defaults to 0
restart_error_delay_minutes (int) – the delay in minutes between attempting to restart a failed query, defaults to 0
auto_delete (bool) – if True, automatically delete the Persistent Query after it’s completed, defaults to True
expiration_time_minutes (int) – the time in minutes after which the temporary query will automatically be deleted, defaults to 1440 (1 day)
dependent_query_serial (int) – a single optional query on which the temporary query is dependent, defaults to None
- Return type:
- Returns:
a scheduling definition array that can be passed to the controller when adding or updating a Persistent Query