Scheduler.Job.HistoryWithLogs

Type

Read/write

Author

Availability

Data provider

Read

Finbourne

Provided with LUSID

The Scheduler.Job.HistoryWithLogs provider enables you to write a Luminesce SQL query that retrieves job run history, including console output logs, from Scheduler.

Note: The LUSID user running the query must have sufficient access control permissions to both use the provider and read Scheduler job run history data. This should automatically be the case if you are the domain owner.

See also: Scheduler.Job, Scheduler.Job.History

Basic usage

select * from Scheduler.Job.HistoryWithLogs where <filter-expression>;

Query parameters

Scheduler.Job.HistoryWithLogs has parameters that enable you to filter or refine a query.

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.Job.HistoryWithLogs' and FieldType = 'Parameter';

Data fields

By default, Scheduler.Job.HistoryWithLogs 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.Job.HistoryWithLogs' and FieldType = 'Column';

Note: Fields marked 'main' are returned by queries that include a caret character, for example select ^ from Scheduler.Job.HistoryWithLogs.

Examples

Note: For more example Luminesce SQL queries, visit our Github repo.

Example 1: Retrieve console output logs for a particular job

select Logs from Scheduler.Job.HistoryWithLogs where JobScope = 'transactions' and JobCode = 'upsert-transactions'

Example 2: Retrieve console output logs for a specific job run

select * from Scheduler.Job.HistoryWithLogs where RunId = 'f77b5b02-7f03-417d-a46c-5b3a0ee094f2'

Example 3: Retrieve failure message and output logs for failed runs

select RunId, Message, Logs from Scheduler.Job.HistoryWithLogs where JobStatus = 'Failure' limit 20

Example 4: Retrieve logs for all failed jobs in a job scope

In this example, Scheduler.Job.HistoryWithLogs is joined with Scheduler.Job to retrieve all console output logs for failed jobs within a particular scope.

select *
from Scheduler.Job.HistoryWithLogs h
join Scheduler.Job j
  on h.JobScope = j.JobScope
  and h.JobCode = j.JobCode
where h.JobStatus = 'Failure'
and j.JobScope = 'transactions'