/// <summary> /// The on worker stopped. /// </summary> /// <param name="sender"> /// The sender. /// </param> /// <param name="args"> /// The eventArgs. /// </param> private void OnWorkerStopped(object sender, WorkerStoppedEventArgs args) { if (this.WorkerStopped != null) { this.WorkerStopped(sender, args); } }
/// <summary> /// The OnWorkerStopped handler. /// </summary> /// <param name="sender"> /// The sender. /// </param> /// <param name="args"> /// The args. /// </param> private void OnWorkerStopped(object sender, WorkerStoppedEventArgs args) { Trace.TraceInformation( "[Machine Name: {0}][DeploymentId: {1}][Role: {2}][Role Instance Id: {3}][Worker {4}] Stopped ({5:F6} seconds).", this.MachineName, this.DeploymentId, this.RoleInstanceName, this.RoleInstanceId, sender, args.Elapsed.TotalSeconds); }
/// <summary> /// The worker stop. /// </summary> /// <param name="role"> /// The role. /// </param> /// <returns> /// The <see cref="IDisposable"/>. /// </returns> public IDisposable WorkerStop(object role) { return(GetActivityTracker( () => { var args = new WorkerStoppingEventArgs(); this.OnWorkerStopping(role, args); }, t => { var args = new WorkerStoppedEventArgs { Elapsed = t }; this.OnWorkerStopped(role, args); })); }
private void OnWorkerStopped(object sender, WorkerStoppedEventArgs args) { try { this.workerEventWriter.Stopped( this.MachineName, this.DeploymentId, this.RoleInstanceName, this.RoleInstanceId, sender.ToString(), args.Elapsed.TotalSeconds.ToString(CultureInfo.InvariantCulture)); } catch (Exception ex) { Trace.TraceError(ex.ToString()); } }
private void Worker_Stopped(object sender, WorkerStoppedEventArgs workerStoppedEventArgs) { try { IPubSubResult result = PubSubClient.Publish(new PubSubMessage { Event = "task:onstopped", Channel = "panteon", Payload = new { TaskName = Name } }); Console.WriteLine(result.Body); } catch (Exception exception) { WorkerLogger.Error($"An error occurred while informing about [{Name}] stopping operation.", exception); } }
/// <summary> /// The worker stop. /// </summary> /// <param name="role"> /// The role. /// </param> /// <returns> /// The <see cref="IDisposable"/>. /// </returns> public IDisposable WorkerStop(object role) { return GetActivityTracker( () => { var args = new WorkerStoppingEventArgs(); this.OnWorkerStopping(role, args); }, t => { var args = new WorkerStoppedEventArgs { Elapsed = t }; this.OnWorkerStopped(role, args); }); }
/// <summary> /// The OnWorkerStopped handler. /// </summary> /// <param name="sender"> /// The sender. /// </param> /// <param name="args"> /// The args. /// </param> private void OnWorkerStopped(object sender, WorkerStoppedEventArgs args) { try { Debug.Print( "[Machine Name: {0}][DeploymentId: {1}][Role: {2}][Role Instance Id: {3}][Worker {4}] Stopped ({5:F6} seconds).", this.MachineName, this.DeploymentId, this.RoleInstanceName, this.RoleInstanceId, sender, args.Elapsed.TotalSeconds); } catch (ArgumentNullException ex) { Debug.Print(ex.ToString()); } catch (FormatException ex) { Debug.Print(ex.ToString()); } }
/// <summary> /// The OnWorkerStopped handler. /// </summary> /// <param name="sender"> /// The sender. /// </param> /// <param name="args"> /// The args. /// </param> private void OnWorkerStopped(object sender, WorkerStoppedEventArgs args) { this.NumberEventsFired++; }