40 lines
1.2 KiB
C#
40 lines
1.2 KiB
C#
namespace QuantEngine.Web.Services;
|
|
|
|
using System;
|
|
|
|
public sealed record SchedulerJobDefinition(
|
|
string JobId,
|
|
string Cron,
|
|
string Description,
|
|
bool IsRecurring);
|
|
|
|
public sealed record SchedulerServiceOptions
|
|
{
|
|
public List<SchedulerJobDefinition> JobDefinitions { get; init; } = new()
|
|
{
|
|
new SchedulerJobDefinition("daily-collection", "0 9 * * *", "Daily data collection", true),
|
|
new SchedulerJobDefinition("hourly-price-update", "0 9,11,13,15 * * 1-5", "Hourly price update", true),
|
|
new SchedulerJobDefinition("weekly-report", "0 17 * * 5", "Weekly report generation", true),
|
|
new SchedulerJobDefinition("monthly-optimization", "0 2 1 * *", "Monthly optimization", true),
|
|
};
|
|
}
|
|
|
|
public sealed record SchedulerJobExecutionAudit(
|
|
string JobId,
|
|
string RunId,
|
|
string State,
|
|
string? Reason,
|
|
DateTimeOffset StartedAt,
|
|
DateTimeOffset? FinishedAt,
|
|
string? ResourceKey);
|
|
|
|
public static class SchedulerStates
|
|
{
|
|
public const string Pending = "PENDING";
|
|
public const string Running = "RUNNING";
|
|
public const string Succeeded = "SUCCEEDED";
|
|
public const string Failed = "FAILED";
|
|
public const string Retrying = "RETRYING";
|
|
public const string Blocked = "BLOCKED";
|
|
}
|