Esempio n. 1
0
        public virtual void OnTaskFinished(SnTaskResult result)
        {
            // the task was executed successfully without an error message
            if (result.Successful && result.Error == null)
            {
                return;
            }

            try
            {
                if (result.Error != null)
                {
                    // log the error message and details for admins
                    SnLog.WriteError("Task execution error, see the details below.",
                                     EventId.TaskManagement.General,
                                     properties: new Dictionary <string, object>
                    {
                        { "TaskType", result.Task.Type },
                        { "TaskData", result.Task.TaskData },
                        { "ErrorCode", result.Error.ErrorCode },
                        { "ErrorType", result.Error.ErrorType },
                        { "Message", result.Error.Message },
                        { "Details", result.Error.Details },
                        { "CallingContext", result.Error.CallingContext }
                    });
                }
            }
            catch (Exception ex)
            {
                SnLog.WriteException(ex);
            }
        }
Esempio n. 2
0
 internal static void OnTaskFinished(SnTaskResult taskResult)
 {
     Debug.WriteLine("#TaskManager> TaskManagerBase.OnTaskFinished fired.");
     if (_instance.TaskFinished != null)
     {
         _instance.TaskFinished(_instance, new TaskFinishedEventArgs {
             TaskResult = taskResult
         });
     }
 }
Esempio n. 3
0
 /// <summary>
 /// Built-in helper method for logging task execution results. Call this from every custom task finalizer.
 /// </summary>
 /// <param name="result"></param>
 public static void OnTaskFinished(SnTaskResult result)
 {
     Instance.OnTaskFinished(result);
 }
Esempio n. 4
0
 public static void OnTaskFinished(SnTaskResult result)
 {
     SnTaskManager.OnTaskFinished(result);
 }
Esempio n. 5
0
 public static void OnTaskFinished(SnTaskResult result)
 {
     Instance.OnTaskFinishedAsync(result, CancellationToken.None).GetAwaiter().GetResult();
 }
Esempio n. 6
0
 public void Finalize(SnTaskResult result)
 {
     Debug.WriteLine("#TaskManager> DefaultTaskFinalizer.Finalize called.");
 }
Esempio n. 7
0
 public void TaskFinished(SnTaskResult taskResult)
 {
     Debug.WriteLine(String.Format("#TaskManagerHub> TaskFinished received. Agent: {0}, taskId: {1}, code: {2}, exception: {3}", taskResult.AgentName, taskResult.Task.Id, taskResult.ResultCode, taskResult.Exception == null ? "" : taskResult.Exception.Message));
     DistributedTaskManager.OnTaskFinished(taskResult);
 }