public void UpdatePlanActionStatus(ActionUpdateItem item)
    {
        try
        {
            Plan plan = GetPlanStatus(item.PlanUniqueName, item.PlanInstanceId);
            bool ok   = DalUtilities.FindActionAndReplace(plan.Actions, item.ActionItem);
            if (ok)
            {
                SerializeYamlFile(UtilitiesPathCombine(_histPath, $"{plan.UniqueName}_{plan.InstanceId}{_histExt}"),
                                  plan, serializeAsJson: _histAsJson, formatJson: _histAsFormattedJson, emitDefaultValues: true);
            }
            else
            {
                throw new Exception($"Could not find Plan.InstanceId = [{item.PlanInstanceId}], Action:{item.ActionItem.Name}.ParentInstanceId = [{item.ActionItem.ParentInstanceId}] in Plan outfile.");
            }
        }
        catch (Exception ex)
        {
            ActionItemSingletonProcessor.Instance.Exceptions.Enqueue(ex);

            if (item.RetryAttempts++ < 5)
            {
                ActionItemSingletonProcessor.Instance.Queue.Enqueue(item);
            }
            else
            {
                ActionItemSingletonProcessor.Instance.Fatal.Enqueue(ex);
            }
        }
    }
예제 #2
0
    public void UpdatePlanActionStatus(ActionUpdateItem item)
    {
        try
        {
            Plan plan = GetPlanStatus(item.PlanUniqueName, item.PlanInstanceId);
            bool ok   = DalUtilities.FindActionAndReplace(plan.Actions, item.ActionItem);
            if (ok)
            {
                YamlHelpers.SerializeFile(Synapse.Services.Controller.Dal.Utilities.PathCombine(_histPath, $"{plan.UniqueName}_{plan.InstanceId}.yaml"), plan, emitDefaultValues: true);
            }
            else
            {
                throw new Exception($"Could not find Plan.InstanceId = [{item.PlanInstanceId}], Action:{item.ActionItem.Name}.ParentInstanceId = [{item.ActionItem.ParentInstanceId}] in Plan outfile.");
            }
        }
        catch (Exception ex)
        {
            ActionItemSingletonProcessor.Instance.Exceptions.Enqueue(ex);

            if (item.RetryAttempts++ < 5)
            {
                ActionItemSingletonProcessor.Instance.Queue.Enqueue(item);
            }
            else
            {
                ActionItemSingletonProcessor.Instance.Fatal.Enqueue(ex);
            }
        }
    }