Add genetic backtest to worker
This commit is contained in:
@@ -5,16 +5,16 @@ using static Managing.Common.Enums;
|
||||
namespace Managing.Domain.Backtests;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a single backtest job in the queue system.
|
||||
/// Can be a standalone backtest or part of a bundle backtest request.
|
||||
/// Represents a single job in the queue system.
|
||||
/// Can be a standalone backtest, genetic algorithm, or part of a bundle backtest request.
|
||||
/// </summary>
|
||||
public class BacktestJob
|
||||
public class Job
|
||||
{
|
||||
public BacktestJob()
|
||||
public Job()
|
||||
{
|
||||
Id = Guid.NewGuid();
|
||||
CreatedAt = DateTime.UtcNow;
|
||||
Status = BacktestJobStatus.Pending;
|
||||
Status = JobStatus.Pending;
|
||||
ProgressPercentage = 0;
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ public class BacktestJob
|
||||
/// Current status of the job
|
||||
/// </summary>
|
||||
[Required]
|
||||
public BacktestJobStatus Status { get; set; }
|
||||
public JobStatus Status { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Priority of the job (higher = more important)
|
||||
@@ -122,12 +122,37 @@ public class BacktestJob
|
||||
/// Optional genetic request ID if this is a genetic backtest job
|
||||
/// </summary>
|
||||
public string? GeneticRequestId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Number of times this job has been retried
|
||||
/// </summary>
|
||||
public int RetryCount { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Maximum number of retry attempts allowed
|
||||
/// </summary>
|
||||
public int MaxRetries { get; set; } = 3;
|
||||
|
||||
/// <summary>
|
||||
/// When the job should be retried next (for exponential backoff)
|
||||
/// </summary>
|
||||
public DateTime? RetryAfter { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether the failure is retryable (transient vs permanent)
|
||||
/// </summary>
|
||||
public bool IsRetryable { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// Failure category for better error handling
|
||||
/// </summary>
|
||||
public FailureCategory? FailureCategory { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Status of a backtest job
|
||||
/// Status of a job
|
||||
/// </summary>
|
||||
public enum BacktestJobStatus
|
||||
public enum JobStatus
|
||||
{
|
||||
/// <summary>
|
||||
/// Job is pending and waiting to be claimed by a worker
|
||||
@@ -155,3 +180,34 @@ public enum BacktestJobStatus
|
||||
Cancelled
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Category of failure for better error handling and retry logic
|
||||
/// </summary>
|
||||
public enum FailureCategory
|
||||
{
|
||||
/// <summary>
|
||||
/// Transient failures: network issues, timeouts, temporary service unavailability
|
||||
/// </summary>
|
||||
Transient,
|
||||
|
||||
/// <summary>
|
||||
/// Data errors: missing candles, invalid data format
|
||||
/// </summary>
|
||||
DataError,
|
||||
|
||||
/// <summary>
|
||||
/// System errors: out of memory, database errors, infrastructure issues
|
||||
/// </summary>
|
||||
SystemError,
|
||||
|
||||
/// <summary>
|
||||
/// User errors: invalid input, configuration errors
|
||||
/// </summary>
|
||||
UserError,
|
||||
|
||||
/// <summary>
|
||||
/// Unknown or unclassified errors
|
||||
/// </summary>
|
||||
Unknown
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user