Type | Read/write | Author | Availability |
Read | Finbourne | Provided with LUSID |
The Scheduler.Schedule.Run
provider enables you to write a Luminesce SQL query that kicks off a run of a schedule in Scheduler.
Note: The LUSID user running the query must have sufficient access control permissions to both use the provider and run schedules in Scheduler. This should automatically be the case if you are the domain owner.
See also: Scheduler.Schedule, Scheduler.Job.Run
Basic usage
select * from Scheduler.Schedule.Run
where Scope = <scope>
and Code = <code>;
Query parameters
Scheduler.Schedule.Run
has parameters that enable you to filter or refine a query.
Note: The
Scope
andCode
parameters are mandatory.
To list available parameters, their data types, default values, and an explanation for each, run the following query using a suitable tool:
select FieldName, DataType, ParamDefaultValue, Description from Sys.Field where TableName = 'Scheduler.Schedule.Run' and FieldType = 'Parameter';
Data fields
By default, Scheduler.Schedule.Run
returns a table of data populated with particular fields (columns). You can return a subset of these fields.
To list fields available to return, their data types, whether fields are considered 'main', and an explanation for each, run the following query using a suitable tool:
select FieldName, DataType, IsMain, IsPrimaryKey, SampleValues, Description from Sys.Field where TableName = 'Scheduler.Schedule.Run' and FieldType = 'Column';
Note: Fields marked 'main' are returned by queries that start
select ^ from Scheduler.Schedule.Run
.
Examples
Note: For more example Luminesce SQL queries, visit our Github repo.
Example 1: Run a schedule
select * from Scheduler.Schedule.Run where Scope = 'transactions' and Code = 'upsert-transactions-schedule'
Example 2: Wait for a schedule to complete before retrieving run history information
In this example, the WaitForCompletion
parameter is passed into the query to make it wait for the specified number of seconds before returning a result. A table of data is returned as soon as the schedule completes, or if the job does not complete within the specified time, the current status of the schedule is returned. The Scheduler.Job.HistoryWithLogs provider is then queried using the run ID to return any console output logs.
@@runId = select RunId from Scheduler.Schedule.Run where Scope = 'transactions' and Code = 'upsert-transactions-schedule' and WaitForCompletion = 60;
select * from Scheduler.Job.HistoryWithLogs where RunId = @@runId;