/// <summary> /// An event handler called when a PlanetLab command finished successfully. /// </summary> /// <param name="sender">The sender object.</param> /// <param name="e">The event arguments.</param> private void OnCommandFinishedSuccess(object sender, PlManagerCommandEventArgs e) { this.Invoke(() => { // If the number of failed subcommand is zero. if (0 == e.Failed) { // Log an event. this.controlLog.Add(this.config.Log.Add( LogEventLevel.Verbose, LogEventType.Success, ControlSliceRun.logSource.FormatWith(this.slice.Id), "The PlanetLab node {0} ({1}) succeeded running the PlanetLab command \'{2}\' with parameter set {3}. {4} subcommands succeeded.", new object[] { e.Node.Id, e.Node.Hostname, e.Command.Command, e.Set, e.Success })); } else { // Log an event. this.controlLog.Add(this.config.Log.Add( LogEventLevel.Verbose, LogEventType.SuccessWarning, ControlSliceRun.logSource.FormatWith(this.slice.Id), "The PlanetLab node {0} ({1}) succeeded running the PlanetLab command \'{2}\' with parameter set {3}. {4} subcommands succeeded and {5} subcommands failed.", new object[] { e.Node.Id, e.Node.Hostname, e.Command.Command, e.Set, e.Success, e.Failed })); } // Find the progress item corresponding to this node. ProgressItem item = this.managerProgressItems.FirstOrDefault((ProgressItem it) => { return object.ReferenceEquals(it.Tag, e.Node); }); // If the item is not null, increment the progress. if (null != item) { item.Progress.Change(0 == e.Failed ? 0 : 1); } }); }
/// <summary> /// An event handler called when a PlanetLab command has started. /// </summary> /// <param name="sender">The sender object.</param> /// <param name="e">The event arguments.</param> private void OnCommandStarted(object sender, PlManagerCommandEventArgs e) { this.Invoke(() => { // Log an event. this.controlLog.Add(this.config.Log.Add( LogEventLevel.Verbose, LogEventType.Information, ControlSliceRun.logSource.FormatWith(this.slice.Id), "The PlanetLab node {0} ({1}) started running the PlanetLab command \'{2}\' with parameter set {3}.", new object[] { e.Node.Id, e.Node.Hostname, e.Command.Command, e.Set })); }); }
/// <summary> /// An event handler called when a PlanetLab command finished with failure. /// </summary> /// <param name="sender">The sender object.</param> /// <param name="e">The event arguments.</param> private void OnCommandFinishedFail(object sender, PlManagerCommandEventArgs e) { this.Invoke(() => { // Log an event. this.controlLog.Add(this.config.Log.Add( LogEventLevel.Important, LogEventType.Error, ControlSliceRun.logSource.FormatWith(this.slice.Id), "The PlanetLab node {0} ({1}) failed running the PlanetLab command \'{2}\' with parameter set {3}. {4}", new object[] { e.Node.Id, e.Node.Hostname, e.Command.Command, e.Exception }, e.Exception)); // Find the progress item corresponding to this node. ProgressItem item = this.managerProgressItems.FirstOrDefault((ProgressItem it) => { return object.ReferenceEquals(it.Tag, e.Node); }); // If the item is not null, increment the progress. if (null != item) { item.Progress.Change(2); } }); }