Make more backtest parallele and run bundle health only on instance 1

This commit is contained in:
2025-11-13 12:22:23 +07:00
parent 27e2cf0a09
commit 155fb2b569
3 changed files with 56 additions and 36 deletions

View File

@@ -176,10 +176,7 @@ var host = hostBuilder
var workerId = Environment.GetEnvironmentVariable("WORKER_ID") ??
configuration["BacktestComputeWorker:WorkerId"] ??
$"{Environment.MachineName}-{taskSlot}";
services.Configure<BacktestComputeWorkerOptions>(options =>
{
options.WorkerId = workerId;
});
services.Configure<BacktestComputeWorkerOptions>(options => { options.WorkerId = workerId; });
// Configure GeneticComputeWorker options
services.Configure<GeneticComputeWorkerOptions>(
@@ -189,10 +186,7 @@ var host = hostBuilder
var geneticWorkerId = Environment.GetEnvironmentVariable("GENETIC_WORKER_ID") ??
configuration["GeneticComputeWorker:WorkerId"] ??
$"{Environment.MachineName}-genetic-{taskSlot}";
services.Configure<GeneticComputeWorkerOptions>(options =>
{
options.WorkerId = geneticWorkerId;
});
services.Configure<GeneticComputeWorkerOptions>(options => { options.WorkerId = geneticWorkerId; });
// Register the backtest compute worker if enabled
var isBacktestWorkerEnabled = configuration.GetValue<bool>("WorkerBacktestCompute", false);
@@ -210,7 +204,7 @@ var host = hostBuilder
// Register the bundle backtest health check worker if enabled
var isBundleHealthCheckEnabled = configuration.GetValue<bool>("WorkerBundleBacktestHealthCheck", false);
if (isBundleHealthCheckEnabled)
if (isBundleHealthCheckEnabled && taskSlot == "1")
{
services.AddHostedService<BundleBacktestHealthCheckWorker>();
}

View File

@@ -0,0 +1,26 @@
{
"WorkerBacktestCompute": true,
"BacktestComputeWorker": {
"MaxConcurrentPerUser": 8,
"MaxConcurrentPerInstance": 30,
"JobPollIntervalSeconds": 5,
"HeartbeatIntervalSeconds": 30,
"StaleJobTimeoutMinutes": 10
},
"WorkerGeneticCompute": true,
"GeneticComputeWorker": {
"MaxConcurrentGenetics": 1,
"JobPollIntervalSeconds": 5,
"HeartbeatIntervalSeconds": 30,
"StaleJobTimeoutMinutes": 10
},
"PostgreSql": {
"ConnectionString": "Host=kaigen-db.kaigen.managing.live;Port=5432;Database=managing;Username=postgres;Password=2ab5423dcca4aa2d"
},
"InfluxDb": {
"Url": "https://influx-db.kaigen.managing.live",
"Organization": "managing-org",
"Token": "ROvQoZ1Dg5jiKDFxB0saEGqHC3rsLkUNlPL6_AFbOcpNjMieIv8v58yA4v5tFU9sX9LLvXEToPvUrxqQEMaWDw=="
}
}

View File

@@ -1,8 +1,8 @@
{
"WorkerBacktestCompute": true,
"BacktestComputeWorker": {
"MaxConcurrentPerUser": 8,
"MaxConcurrentPerInstance": 30,
"MaxConcurrentPerUser": 15,
"MaxConcurrentPerInstance": 60,
"JobPollIntervalSeconds": 5,
"HeartbeatIntervalSeconds": 30,
"StaleJobTimeoutMinutes": 10