deephaven_enterprise.client.generate_scheduling

class GenerateScheduling[source]

Bases: object

GenerateScheduling 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’

  • restart_daily (bool) – if True, then the query should be restarted every day at the defined start_time

  • restart_error_count (int) – the number of times a failing query will attempt to be restarted within its run window

  • restart_error_delay_minutes (int) – the delay in minutes between attempting to restart a failed query

Return type:

List[str]

Returns:

a scheduling definition array that can be passed to the controller when adding or updating a persistent query

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]

Generate a scheduler array for a persistent query that has daily 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’

  • business_days (bool) – if changed to True, only run on business days

  • calendar (str) – if business_days is True, the business calendar to use

  • days (List[bool]) – a list of bool values representing the days to run the persistent query, from Monday through Sunday

  • overnight (bool) – if True, the query runs overnight

  • repeat_enabled (bool) – for batch-style queries, if True, the persistent query will be restarted at the repeat_interval interval

  • repeat_interval (int) – if repeat_enabled is True, the interval in minutes between restarts

  • skip_if_unsuccessful (bool) – for repeating queries, skip if the previous run failed when this is True

  • stop_time_disabled (bool) – if True, the persistent query does not need a stop time (for example, non-repeating batch queries)

  • restart_error_count (int) – the number of times a failing query will attempt to be restarted within its run window

  • restart_error_delay_minutes (int) – the delay in minutes between attempting to restart a failed query

  • 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

Return type:

List[str]

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]

Generate 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’

  • dependent_query_serials (Optional[List[int]]) – a list of serials on which the query is dependent

  • run_on_failure (bool) – if True, run when dependencies fail (rather than succeed)

  • restart_on_condition (bool) – if True, restart when conditions are met even if the query is running at the time

  • run_on_any_dependency_met (bool) – if True, run when any dependency is met, otherwise all dependencies must be met

  • use_minimum_start_time (bool) – if True, delay start of query after dependencies are met until the specified start_time

  • run_each_time (bool) – if True, run every time dependencies are met, otherwise run once each day

  • deadline_start (str) – the start of the time at which the query should respond to dependency changes, in HH:MM:SS format

  • deadline_end (str) – the end of the time at which the query should respond to dependency changes, in HH:MM:SS format

  • overnight (bool) – if True, the query runs overnight

  • repeat_enabled (bool) – for batch-style queries, if True, the persistent query will be restarted at the repeat_interval interval

  • repeat_interval (int) – if repeat_enabled is True, the interval in minutes between restarts

  • skip_if_unsuccessful (bool) – for repeating queries, skip if the previous run failed when this is True

  • stop_time_disabled (bool) – if True, the persistent query does not need a stop time (for example, non-repeating batch queries)

  • restart_error_count (int) – the number of times a failing query will attempt to be restarted within its run window

  • restart_error_delay_minutes (int) – the delay in minutes between attempting to restart a failed query

  • 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

Return type:

List[str]

Returns:

a scheduling definition array that can be passed to the controller when adding or updating a persistent query

static generate_disabled_scheduler()[source]

Generates a scheduler array for a persistent query with scheduling disabled.

Return type:

List[str]

Returns:

a scheduling definition array that can be passed to the controller when adding or updating a persistent query

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]

Generate a scheduler array for a persistent query that has monthly 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’

  • business_days (bool) – if changed to True, only run on business days

  • calendar (str) – if business_days is True, the business calendar to use

  • first_business_day (bool) – if True, then run the query on the first business day of the month

  • last_business_day (bool) – if True, then run the query on the last business day of the month

  • months (List[bool]) – a List of the months on which the persistent query will be started, starting with January

  • days (Optional[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

  • overnight (bool) – if True, the query runs overnight

  • repeat_enabled (bool) – for batch-style queries, if True, the persistent query will be restarted at the repeat_interval interval

  • repeat_interval (int) – if repeat_enabled is True, the interval in minutes between restarts

  • skip_if_unsuccessful (bool) – for repeating queries, skip if the previous run failed when this is True

  • stop_time_disabled (bool) – if True, the persistent query does not need a stop time (for example, non-repeating batch queries)

  • restart_error_count (int) – the number of times a failing query will attempt to be restarted within its run window

  • restart_error_delay_minutes (int) – the delay in minutes between attempting to restart a failed query

  • 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

Return type:

List[str]

Returns:

a scheduling definition array that can be passed to the controller when adding or updating a persistent query

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]

Generate 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’

  • repeat_enabled (bool) – for batch-style queries, if True, the persistent query will be restarted at the repeat_interval interval

  • repeat_interval (int) – if repeat_enabled is True, the interval in minutes between restarts

  • skip_if_unsuccessful (bool) – for repeating queries, skip if the previous run failed when this is True

  • restart_error_count (int) – the number of times a failing query will attempt to be restarted within its run window

  • restart_error_delay_minutes (int) – the delay in minutes between attempting to restart a failed query

  • 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

Return type:

List[str]

Returns:

a scheduling definition array that can be passed to the controller when adding or updating a persistent query

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

  • restart_error_count (int) – the number of times a failing query will attempt to be restarted within its run window

  • restart_error_delay_minutes (int) – the delay in minutes between attempting to restart a failed query

  • auto_delete (bool) – if True, automatically delete the PQ after it’s completed

  • expiration_time_minutes (int) – the time in minutes after which the temporary query will automatically be deleted (defaults to 1 day)

  • dependent_query_serial (Optional[int]) – a single optional query on which the temporary query is dependent

Return type:

List[str]

Returns:

a scheduling definition array that can be passed to the controller when adding or updating a persistent query