Пример #1
0
 public bool ProcessDomain(RFGraphProcessorDomain domain)
 {
     try
     {
         ProcessorStatus = new RFGraphProcessorStatus();
         Log.SetValueDate(domain.ValueDate);
         Process(domain as D);
     }
     catch (RFLogicException ex)
     {
         // partial results will NOT be saved
         ProcessorStatus.SetError(ex.Message);
     }
     catch
     {
         throw;
     }
     return(_externalWorkDone);
 }
Пример #2
0
 protected void UpdateResult(RFGraphProcessorStatus status, RFProcessingResult result)
 {
     if (status != null && result != null)
     {
         if (status.CalculationOK)
         {
             var date = InstanceParams != null && GraphInstance.ValueDate.HasValue ? GraphInstance.ValueDate.Value.ToString() : "n/a";
             if (!result.WorkDone)
             {
                 Context.SystemLog.Info(this, "Run process {0} but no outputs have changed.", String.Format("{0} [{1}]", ProcessName, date));
             }
         }
         else
         {
             var date = InstanceParams != null && GraphInstance.ValueDate.HasValue ? GraphInstance.ValueDate.Value.ToString() : "n/a";
             result.AddMessage(status.Message);
             result.IsError = true;
         }
     }
 }
Пример #3
0
 protected void LogGraphStat(RFGraphProcessorStatus status)
 {
     try
     {
         var statsKey      = RFGraphStatsKey.Create(KeyDomain, Config.GraphName, GraphInstance);
         var statsDocument = Context.LoadEntry(statsKey) as RFDocument;
         if (statsDocument == null)
         {
             statsDocument = RFDocument.Create(statsKey,
                                               new RFGraphStats
             {
                 GraphInstance = GraphInstance,
                 GraphName     = Config.GraphName,
                 Stats         = new Dictionary <string, RFGraphStat>()
             });
         }
         var stat = new RFGraphStat
         {
             ProcessName   = Config.Name,
             LastRun       = status?.Updated ?? DateTimeOffset.MinValue,
             CalculationOK = status?.CalculationOK ?? false,
             Message       = status?.Message ?? "n/a"
         };
         var statsItem = statsDocument.GetContent <RFGraphStats>();
         if (!statsItem.Stats.ContainsKey(Config.Name))
         {
             statsItem.Stats.Add(Config.Name, stat);
         }
         else
         {
             statsItem.Stats[Config.Name] = stat;
         }
         statsDocument.UpdateTime = DateTimeOffset.Now;
         Context.SaveEntry(statsDocument, false, true); // don't keep versions
     }
     catch (Exception ex)
     {
         Context.SystemLog.Exception(this, ex, "Error saving graph stats for process {0}", Config.Name);
     }
 }