Skip to content

ExperimentAttemptResult

NexusLabs.Foundry.Evaluation

NexusLabs.Foundry.Evaluation.Experiments

ExperimentAttemptResult Class

Describes one operational execution attempt.

public sealed record ExperimentAttemptResult : System.IEquatable<NexusLabs.Foundry.Evaluation.Experiments.ExperimentAttemptResult>

Inheritance System.Object 🡒 ExperimentAttemptResult

Implements System.IEquatable<ExperimentAttemptResult>

Properties

ExperimentAttemptResult.AttemptNumber Property

Gets the one-based attempt number.

public int AttemptNumber { get; }

Property Value

System.Int32

ExperimentAttemptResult.DelayBeforeNextAttempt Property

Gets the scheduled delay before the next attempt, or null when no retry followed this attempt.

public System.Nullable<System.TimeSpan> DelayBeforeNextAttempt { get; }

Property Value

System.Nullable<System.TimeSpan>

ExperimentAttemptResult.Duration Property

Gets the elapsed attempt duration.

public System.TimeSpan Duration { get; }

Property Value

System.TimeSpan

ExperimentAttemptResult.Failure Property

Gets the structured failure, when present.

public NexusLabs.Foundry.Evaluation.Experiments.ExperimentFailure? Failure { get; }

Property Value

ExperimentFailure

ExperimentAttemptResult.StartedAt Property

Gets the UTC attempt start time.

public System.DateTimeOffset StartedAt { get; }

Property Value

System.DateTimeOffset

ExperimentAttemptResult.Status Property

Gets the terminal attempt status.

public NexusLabs.Foundry.Evaluation.Experiments.ExperimentAttemptStatus Status { get; }

Property Value

ExperimentAttemptStatus

Methods

ExperimentAttemptResult.RetryScheduled(int, ExperimentAttemptStatus, DateTimeOffset, TimeSpan, ExperimentFailure, TimeSpan) Method

Creates an unsuccessful attempt that scheduled another attempt, recording its failure as retryable and capturing the retry delay.

public static NexusLabs.Foundry.Evaluation.Experiments.ExperimentAttemptResult RetryScheduled(int attemptNumber, NexusLabs.Foundry.Evaluation.Experiments.ExperimentAttemptStatus status, System.DateTimeOffset startedAt, System.TimeSpan duration, NexusLabs.Foundry.Evaluation.Experiments.ExperimentFailure failure, System.TimeSpan delayBeforeNextAttempt);

Parameters

attemptNumber System.Int32

The one-based attempt number.

status ExperimentAttemptStatus

The terminal non-success status.

startedAt System.DateTimeOffset

The UTC attempt start time.

duration System.TimeSpan

The elapsed attempt duration.

failure ExperimentFailure

The structured failure that ended the attempt.

delayBeforeNextAttempt System.TimeSpan

The delay before the scheduled retry becomes ready.

Returns

ExperimentAttemptResult
An unsuccessful attempt result whose failure is a retryable copy of failure. The caller-supplied instance is not modified.

Exceptions

System.ArgumentOutOfRangeException
attemptNumber is not positive, duration is negative, status is not a defined enumeration value, or delayBeforeNextAttempt is negative, infinite, or greater than the maximum representable experiment retry delay.

System.ArgumentException
startedAt does not use a UTC (zero) offset, or status is Succeeded.

System.ArgumentNullException
failure is null.

ExperimentAttemptResult.Succeeded(int, DateTimeOffset, TimeSpan) Method

Creates a successful attempt that carries no failure and no scheduled retry delay.

public static NexusLabs.Foundry.Evaluation.Experiments.ExperimentAttemptResult Succeeded(int attemptNumber, System.DateTimeOffset startedAt, System.TimeSpan duration);

Parameters

attemptNumber System.Int32

The one-based attempt number.

startedAt System.DateTimeOffset

The UTC attempt start time.

duration System.TimeSpan

The elapsed attempt duration.

Returns

ExperimentAttemptResult
A successful attempt result.

Exceptions

System.ArgumentOutOfRangeException
attemptNumber is not positive, or duration is negative.

System.ArgumentException
startedAt does not use a UTC (zero) offset.

ExperimentAttemptResult.Unsuccessful(int, ExperimentAttemptStatus, DateTimeOffset, TimeSpan, ExperimentFailure) Method

Creates a terminal unsuccessful attempt whose failure is recorded as non-retryable.

public static NexusLabs.Foundry.Evaluation.Experiments.ExperimentAttemptResult Unsuccessful(int attemptNumber, NexusLabs.Foundry.Evaluation.Experiments.ExperimentAttemptStatus status, System.DateTimeOffset startedAt, System.TimeSpan duration, NexusLabs.Foundry.Evaluation.Experiments.ExperimentFailure failure);

Parameters

attemptNumber System.Int32

The one-based attempt number.

status ExperimentAttemptStatus

The terminal non-success status.

startedAt System.DateTimeOffset

The UTC attempt start time.

duration System.TimeSpan

The elapsed attempt duration.

failure ExperimentFailure

The structured failure that ended the attempt.

Returns

ExperimentAttemptResult
An unsuccessful attempt result whose failure is a non-retryable copy of failure. The caller-supplied instance is not modified.

Exceptions

System.ArgumentOutOfRangeException
attemptNumber is not positive, duration is negative, or status is not a defined enumeration value.

System.ArgumentException
startedAt does not use a UTC (zero) offset, or status is Succeeded.

System.ArgumentNullException
failure is null.