Adds start and finished times to deployment json.

This commit is contained in:
benbierens 2023-10-16 11:19:57 +02:00
parent 8f37b4cf38
commit 8e4d43b73b
No known key found for this signature in database
GPG Key ID: FE44815D96D0A1AA
3 changed files with 41 additions and 7 deletions

View File

@ -116,6 +116,7 @@ namespace CodexPlugin
var log = tools.GetLog();
var file = log.CreateSubfile();
log.Log($"Container {Container.Name} has crashed. Downloading crash log to '{file.FullFilename}'...");
file.Write($"Container Crash Log for {Container.Name}.");
using var reader = new StreamReader(crashLog);
var line = reader.ReadLine();

View File

@ -21,9 +21,10 @@ namespace CodexPlugin
public class DeploymentMetadata
{
public DeploymentMetadata(string kubeNamespace, int numberOfCodexNodes, int numberOfValidators, int storageQuotaMB, CodexLogLevel codexLogLevel, int initialTestTokens, int minPrice, int maxCollateral, int maxDuration, int blockTTL, int blockMI, int blockMN)
public DeploymentMetadata(DateTime startUtc, DateTime finishedUtc, string kubeNamespace, int numberOfCodexNodes, int numberOfValidators, int storageQuotaMB, CodexLogLevel codexLogLevel, int initialTestTokens, int minPrice, int maxCollateral, int maxDuration, int blockTTL, int blockMI, int blockMN)
{
DeployDateTimeUtc = DateTime.UtcNow;
StartUtc = startUtc;
FinishedUtc = finishedUtc;
KubeNamespace = kubeNamespace;
NumberOfCodexNodes = numberOfCodexNodes;
NumberOfValidators = numberOfValidators;
@ -38,7 +39,8 @@ namespace CodexPlugin
BlockMN = blockMN;
}
public DateTime DeployDateTimeUtc { get; }
public DateTime StartUtc { get; }
public DateTime FinishedUtc { get; }
public string KubeNamespace { get; }
public int NumberOfCodexNodes { get; }
public int NumberOfValidators { get; }

View File

@ -51,6 +51,7 @@ namespace CodexNetDeployer
localCodexBuilder.Build();
Log("Initializing...");
var startUtc = DateTime.UtcNow;
var ci = entryPoint.CreateInterface();
Log("Deploying Geth instance...");
@ -78,7 +79,7 @@ namespace CodexNetDeployer
CheckContainerRestarts(startResults);
var codexContainers = startResults.Select(s => s.CodexNode.Container).ToArray();
return new CodexDeployment(codexContainers, gethDeployment, metricsService, CreateMetadata());
return new CodexDeployment(codexContainers, gethDeployment, metricsService, CreateMetadata(startUtc));
}
private EntryPoint CreateEntryPoint(ILog log)
@ -87,11 +88,11 @@ namespace CodexNetDeployer
var configuration = new KubernetesWorkflow.Configuration(
kubeConfig,
operationTimeout: TimeSpan.FromSeconds(300),
operationTimeout: TimeSpan.FromMinutes(10),
retryDelay: TimeSpan.FromSeconds(10),
kubernetesNamespace: config.KubeNamespace);
var result = new EntryPoint(log, configuration, string.Empty);
var result = new EntryPoint(log, configuration, string.Empty, new FastHttpTimeSet());
configuration.Hooks = new K8sHook(config.TestsTypePodLabel, result.GetPluginMetadata());
return result;
@ -147,9 +148,11 @@ namespace CodexNetDeployer
}
}
private DeploymentMetadata CreateMetadata()
private DeploymentMetadata CreateMetadata(DateTime startUtc)
{
return new DeploymentMetadata(
startUtc: startUtc,
finishedUtc: DateTime.UtcNow,
kubeNamespace: config.KubeNamespace,
numberOfCodexNodes: config.NumberOfCodexNodes!.Value,
numberOfValidators: config.NumberOfValidators!.Value,
@ -169,4 +172,32 @@ namespace CodexNetDeployer
Console.WriteLine(msg);
}
}
public class FastHttpTimeSet : ITimeSet
{
public TimeSpan HttpCallRetryDelay()
{
return TimeSpan.FromSeconds(2);
}
public TimeSpan HttpCallRetryTime()
{
return TimeSpan.FromSeconds(2);
}
public TimeSpan HttpCallTimeout()
{
return TimeSpan.FromSeconds(10);
}
public TimeSpan K8sOperationTimeout()
{
return TimeSpan.FromMinutes(10);
}
public TimeSpan WaitForK8sServiceDelay()
{
return TimeSpan.FromSeconds(30);
}
}
}