internal static NodeTransitionProgress CreateFromNative(NativeClient.IFabricNodeTransitionProgressResult nativeResult) { if (nativeResult == null) { return(null); } var progress = NodeTransitionProgress.FromNative(nativeResult.get_Progress()); GC.KeepAlive(nativeResult); return(progress); }
/// <summary> /// Serializes the object to JSON. /// </summary> /// <param name="writer">The <see cref="T: Newtonsoft.Json.JsonWriter" /> to write to.</param> /// <param name="obj">The object to serialize to JSON.</param> internal static void Serialize(JsonWriter writer, NodeTransitionProgress obj) { // Required properties are always serialized, optional properties are serialized when not null. writer.WriteStartObject(); writer.WriteProperty(obj.State, "State", OperationStateConverter.Serialize); if (obj.NodeTransitionResult != null) { writer.WriteProperty(obj.NodeTransitionResult, "NodeTransitionResult", NodeTransitionResultConverter.Serialize); } writer.WriteEndObject(); }
public async Task <NodeTransitionProgress> GetNodeTransitionProgressAsync( Guid operationId, TimeSpan timeout, CancellationToken cancellationToken) { this.ThrowIfNotReady(); NodeTransitionProgress progress = null; try { TestabilityTrace.TraceSource.WriteInfo(TraceType, "GetNodeTransitionProgressAsync got operation id {0}", operationId); ActionStateBase actionState = await this.MessageProcessor.ProcessGetProgressAsync(operationId, timeout, cancellationToken); StepStateNames stateName = actionState.StateProgress.Peek(); TestCommandProgressState state = FaultAnalysisServiceUtility.ConvertState(actionState, TraceType); TestabilityTrace.TraceSource.WriteInfo(TraceType, "{0} - GetNodeTransitionProgressAsync reading nodecommandstate", operationId); NodeCommandState nodeState = actionState as NodeCommandState; TestabilityTrace.TraceSource.WriteInfo(TraceType, "{0} NodeCommandState is null={1}", operationId, nodeState == null); TestabilityTrace.TraceSource.WriteInfo(TraceType, "{0} - GetNodeTransitionProgressAsync node name={1}, node instance id={2}", operationId, nodeState.Info.NodeName, nodeState.Info.InputNodeInstanceId); NodeResult nodeResult = new NodeResult(nodeState.Info.NodeName, nodeState.Info.InputNodeInstanceId); NodeCommandResult result = new NodeCommandResult(nodeResult, actionState.ErrorCausingRollback); progress = new NodeTransitionProgress(state, result); } catch (Exception e) { TestabilityTrace.TraceSource.WriteWarning(TraceType, "{0} - Caught {1}", operationId, e.ToString()); FaultAnalysisServiceUtility.ThrowTransientExceptionIfRetryable(e); throw; } return(progress); }