Add genetic backtest to worker
This commit is contained in:
@@ -4,14 +4,14 @@ using static Managing.Common.Enums;
|
||||
namespace Managing.Application.Abstractions.Repositories;
|
||||
|
||||
/// <summary>
|
||||
/// Repository interface for managing backtest jobs in the queue system
|
||||
/// Repository interface for managing jobs in the queue system
|
||||
/// </summary>
|
||||
public interface IBacktestJobRepository
|
||||
public interface IJobRepository
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a new backtest job
|
||||
/// Creates a new job
|
||||
/// </summary>
|
||||
Task<BacktestJob> CreateAsync(BacktestJob job);
|
||||
Task<Job> CreateAsync(Job job);
|
||||
|
||||
/// <summary>
|
||||
/// Claims the next available job using PostgreSQL advisory locks.
|
||||
@@ -19,33 +19,33 @@ public interface IBacktestJobRepository
|
||||
/// </summary>
|
||||
/// <param name="workerId">The ID of the worker claiming the job</param>
|
||||
/// <param name="jobType">Optional job type filter. If null, claims any job type.</param>
|
||||
Task<BacktestJob?> ClaimNextJobAsync(string workerId, JobType? jobType = null);
|
||||
Task<Job?> ClaimNextJobAsync(string workerId, JobType? jobType = null);
|
||||
|
||||
/// <summary>
|
||||
/// Updates an existing job
|
||||
/// </summary>
|
||||
Task UpdateAsync(BacktestJob job);
|
||||
Task UpdateAsync(Job job);
|
||||
|
||||
/// <summary>
|
||||
/// Gets all jobs for a specific bundle request
|
||||
/// </summary>
|
||||
Task<IEnumerable<BacktestJob>> GetByBundleRequestIdAsync(Guid bundleRequestId);
|
||||
Task<IEnumerable<Job>> GetByBundleRequestIdAsync(Guid bundleRequestId);
|
||||
|
||||
/// <summary>
|
||||
/// Gets all jobs for a specific user
|
||||
/// </summary>
|
||||
Task<IEnumerable<BacktestJob>> GetByUserIdAsync(int userId);
|
||||
Task<IEnumerable<Job>> GetByUserIdAsync(int userId);
|
||||
|
||||
/// <summary>
|
||||
/// Gets a job by its ID
|
||||
/// </summary>
|
||||
Task<BacktestJob?> GetByIdAsync(Guid jobId);
|
||||
Task<Job?> GetByIdAsync(Guid jobId);
|
||||
|
||||
/// <summary>
|
||||
/// Gets stale jobs (jobs that are Running but haven't sent a heartbeat in the specified timeout)
|
||||
/// </summary>
|
||||
/// <param name="timeoutMinutes">Number of minutes since last heartbeat to consider stale</param>
|
||||
Task<IEnumerable<BacktestJob>> GetStaleJobsAsync(int timeoutMinutes = 5);
|
||||
Task<IEnumerable<Job>> GetStaleJobsAsync(int timeoutMinutes = 5);
|
||||
|
||||
/// <summary>
|
||||
/// Resets stale jobs back to Pending status
|
||||
@@ -55,12 +55,12 @@ public interface IBacktestJobRepository
|
||||
/// <summary>
|
||||
/// Gets all running jobs assigned to a specific worker
|
||||
/// </summary>
|
||||
Task<IEnumerable<BacktestJob>> GetRunningJobsByWorkerIdAsync(string workerId);
|
||||
Task<IEnumerable<Job>> GetRunningJobsByWorkerIdAsync(string workerId);
|
||||
|
||||
/// <summary>
|
||||
/// Gets all jobs for a specific genetic request ID
|
||||
/// </summary>
|
||||
Task<IEnumerable<BacktestJob>> GetByGeneticRequestIdAsync(string geneticRequestId);
|
||||
Task<IEnumerable<Job>> GetByGeneticRequestIdAsync(string geneticRequestId);
|
||||
|
||||
/// <summary>
|
||||
/// Gets paginated jobs with optional filters and sorting
|
||||
@@ -75,12 +75,12 @@ public interface IBacktestJobRepository
|
||||
/// <param name="workerId">Optional worker ID filter</param>
|
||||
/// <param name="bundleRequestId">Optional bundle request ID filter</param>
|
||||
/// <returns>Tuple of jobs and total count</returns>
|
||||
Task<(IEnumerable<BacktestJob> Jobs, int TotalCount)> GetPaginatedAsync(
|
||||
Task<(IEnumerable<Job> Jobs, int TotalCount)> GetPaginatedAsync(
|
||||
int page,
|
||||
int pageSize,
|
||||
string sortBy = "CreatedAt",
|
||||
string sortOrder = "desc",
|
||||
BacktestJobStatus? status = null,
|
||||
JobStatus? status = null,
|
||||
JobType? jobType = null,
|
||||
int? userId = null,
|
||||
string? workerId = null,
|
||||
@@ -109,7 +109,7 @@ public class JobSummary
|
||||
/// </summary>
|
||||
public class JobStatusCount
|
||||
{
|
||||
public BacktestJobStatus Status { get; set; }
|
||||
public JobStatus Status { get; set; }
|
||||
public int Count { get; set; }
|
||||
}
|
||||
|
||||
@@ -127,7 +127,7 @@ public class JobTypeCount
|
||||
/// </summary>
|
||||
public class JobStatusTypeCount
|
||||
{
|
||||
public BacktestJobStatus Status { get; set; }
|
||||
public JobStatus Status { get; set; }
|
||||
public JobType JobType { get; set; }
|
||||
public int Count { get; set; }
|
||||
}
|
||||
Reference in New Issue
Block a user