Esempio n. 1
0
 /// <summary>
 /// Store all jobs in a table so that we can list them.
 /// </summary>
 /// <param name="job"></param>
 public void JobRegistered(Job job)
 {
     _jobsWriter.Write("", job.Name, new Dictionary <string, EntityProperty>
     {
         { "Name", new EntityProperty(job.Name) }
     });
 }
Esempio n. 2
0
        public void JobRunning(Job job, DateTime startTime)
        {
            // Update instance.
            _jobInstancesWriter.Write(job.Name, job.RunId.ToString(), new Dictionary <string, EntityProperty>()
            {
                { "StartTime", new EntityProperty(startTime) },
                { "Status", new EntityProperty(JobStatus.Running) },
            });

            // Update job.
            _jobsWriter.Write("", job.Name, new Dictionary <string, EntityProperty>
            {
                { "Name", new EntityProperty(job.Name) },
                { "LastRunId", new EntityProperty(job.RunId) },
                { "LastRunStart", new EntityProperty(startTime) },
                { "LastRunStatus", new EntityProperty(JobStatus.Running) },
                { "LastRunErrorMessage", new EntityProperty(String.Empty) }
            });
        }
Esempio n. 3
0
        public void TaskProgress(Job job, JobTask task, Exception exception, string message, params object[] args)
        {
            var rowKey = String.Format("{0}-{1}", DateTime.MaxValue.Ticks - DateTime.UtcNow.Ticks, Guid.NewGuid());

            // Write event.
            _jobInstanceEventsWriter.Write(job.RunId.ToString(), rowKey, new Dictionary <string, EntityProperty>()
            {
                { "Task", new EntityProperty(task.GetType().Name) },
                { "Message", new EntityProperty(String.Format(message, args)) },
                { "ErrorMessage", new EntityProperty(exception != null ? exception.Message : null) },
                { "ErrorType", new EntityProperty(exception != null ? exception.GetType().ToString() : null) },
                { "ErrorStackTrace", new EntityProperty(exception != null ? exception.StackTrace : null) },
                { "ErrorObject", new EntityProperty(exception != null ? JsonConvert.SerializeObject(exception) : String.Empty) }
            });
        }