private void UpdateQueueIdForPhase(DeployPhase phase, IEnumerable <Mapping> mappings) { var mapping = mappings.FirstOrDefault(a => a.SourceId == phase.DeploymentInput.QueueId.ToString()); if (mapping is not null) { phase.DeploymentInput.QueueId = int.Parse(mapping.TargetId); } else { phase.DeploymentInput.QueueId = 0; } }
/// <summary> /// Initializes a new instance of the TabDashboardViewModel class. /// </summary> public TabResourceViewModel(IStressDataProvider provider) { //receive message from tab 1, append to provider. Messenger.Default.Register <RequirementMessage>( this, "AppendRequirementParam", data => AppendToProvider(data) ); //receive message from data provider, show log Messenger.Default.Register <string>( this, "RunningLog", msg => ShowLog(msg) ); //receive message from data provider, update phase and status Messenger.Default.Register <DeployStatusUpdateMessage>( this, "DeployStatus", message => SetDeployStatus(message) ); //receive batch job id from data provider(middle) Messenger.Default.Register <string>( this, "BatchJobId", AppendBatchJobId ); //init ui controls _selectedJobIdIndex = -1; UseExistingJobId = false; CreateNewJobId = true; _lableVisibilities = new Visibility[5] { Visibility.Hidden, Visibility.Hidden, Visibility.Hidden, Visibility.Hidden, Visibility.Hidden }; _batchJobs = new ObservableCollection <string>(); _specDeviceCount = _specDuration = _specMsgFreq = "Not Specified"; _currentDeployPhase = DeployPhase.DeployStarted; _currentPhaseStatus = PhaseStatus.Succeeded; _dataProvider = provider; _canStartCreate = false; LoadConfig(); }
/// <summary> /// Initializes a new instance of the TabDashboardViewModel class. /// </summary> public TabResourceViewModel(IStressDataProvider provider) { Messenger.Default.Register <RequirementMessage>( this, "AppendRequirementParam", data => AppendToProvider(data) ); Messenger.Default.Register <IStressDataProvider>( this, "StartTest", data => ProcessRunConfigValue(data) ); Messenger.Default.Register <string>( this, "RunningLog", msg => ShowLog(msg) ); Messenger.Default.Register <DeployStatusUpdateMessage>( this, "DeployStatus", message => SetDeployStatus(message) ); Messenger.Default.Register <string>( this, "BatchJobId", AppendBatchJobId ); _lableVisibilities = new Visibility[5] { Visibility.Hidden, Visibility.Hidden, Visibility.Hidden, Visibility.Hidden, Visibility.Hidden }; _specDeviceCount = _specDuration = _specMsgFreq = "Not Specified"; _currentDeployPhase = DeployPhase.DeployStarted; _currentPhaseStatus = PhaseStatus.Succeeded; _dataProvider = provider; _canStartTest = false; }
private static string GetMessage(DeployPhase phase, IServiceAction action) { return($"Deployment failed during {phase} phase while executing {action.GetType().FullName}"); }
private static string GetMessage(DeployPhase phase) { return($"Deployment failed during {phase} phase"); }
/// <summary> /// Creates a new instance of the <see cref="ActionInvocationException" /> exception for the given deployment phase /// caused by the given exception being thrown from the specific action. /// </summary> /// <param name="phase">The executing phase that resulted in an error.</param> /// <param name="action">The specific action that threw an exception.</param> /// <param name="ex">The exception that occurred during execution.</param> public ActionInvocationException(DeployPhase phase, IServiceAction action, Exception ex) : this(GetMessage(phase, action), ex) { FailedAction = action; Phase = phase; }
/// <summary> /// Creates a new instance of the <see cref="ActionInvocationException" /> exception for the given deployment phase /// caused by the given exception. /// </summary> /// <param name="phase">The executing phase that resulted in an error.</param> /// <param name="ex">The exception that occurred during execution.</param> public ActionInvocationException(DeployPhase phase, Exception ex) : this(GetMessage(phase), ex) { Phase = phase; }
/// <summary> /// Creates a new instance of the <see cref="ActionInvocationException" /> exception for the given deployment phase and /// executing action. /// </summary> /// <param name="phase">The executing phase that resulted in an error.</param> /// <param name="action">The specific action that threw an exception.</param> public ActionInvocationException(DeployPhase phase, IServiceAction action) : this(phase) { FailedAction = action; }
/// <summary> /// Creates a new instance of an <see cref="ActionInvocationException" /> for the given deployment phase. /// </summary> /// <param name="phase">The executing phase that resulted in an error.</param> public ActionInvocationException(DeployPhase phase) { Phase = phase; }
private void RunActions(List <Action <ICakeContext, IServiceInstance> > actions, DeployPhase phase, IServiceInstance instance) { foreach (var action in actions) { _context.Log.Information($"Running {phase} action ({actions.IndexOf(action) + 1} of {actions.Count})"); try { action.Invoke(_context, instance); } catch (Exception ex) { throw new ActionInvocationException(phase, ex); } } }