Skip to content

Commit

Permalink
Merge pull request #3996 from Ginger-Automation/BugFix/AccountReportC…
Browse files Browse the repository at this point in the history
…leanUpError

Account Report CleanUp Activity fix
  • Loading branch information
Maheshkale447 authored Nov 13, 2024
2 parents 16ea756 + 49aa80d commit 570e01d
Showing 1 changed file with 57 additions and 41 deletions.
98 changes: 57 additions & 41 deletions Ginger/GingerCoreNET/Run/GingerExecutionEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2071,6 +2071,8 @@ private void ExecuteCleanUpActivities()
{
foreach (CleanUpActivity cleanUpActivity in cleanUpActivities)
{
CurrentBusinessFlow.CurrentActivity = cleanUpActivity;

RunActivity(cleanUpActivity);
}
}
Expand Down Expand Up @@ -2465,69 +2467,69 @@ private void RunActionWithTimeOutControl(Act act, GingerRunner.eActionExecutorTy
switch (ActExecutorType)
{
case GingerRunner.eActionExecutorType.RunOnDriver:
{
if (currentAgent == null)
{
if (currentAgent == null)
if (string.IsNullOrEmpty(act.Error))
{
if (string.IsNullOrEmpty(act.Error))
{
act.Error = "No Agent was found for the " + GingerDicser.GetTermResValue(eTermResKey.Activity) + " Application.";
}

act.Status = Amdocs.Ginger.CoreNET.Execution.eRunStatus.Failed;
act.Error = "No Agent was found for the " + GingerDicser.GetTermResValue(eTermResKey.Activity) + " Application.";
}
else

act.Status = Amdocs.Ginger.CoreNET.Execution.eRunStatus.Failed;
}
else
{
if (((Agent)CurrentBusinessFlow.CurrentActivity.CurrentAgent).AgentType == Agent.eAgentType.Driver)
{
if (((Agent)CurrentBusinessFlow.CurrentActivity.CurrentAgent).AgentType == Agent.eAgentType.Driver)
if (((AgentOperations)currentAgent.AgentOperations).Status != Agent.eStatus.Running)
{
if (((AgentOperations)currentAgent.AgentOperations).Status != Agent.eStatus.Running)
if (string.IsNullOrEmpty(act.Error))
{
if (string.IsNullOrEmpty(act.Error))
if (((AgentOperations)currentAgent.AgentOperations).Driver != null && !string.IsNullOrEmpty(((AgentOperations)currentAgent.AgentOperations).Driver.ErrorMessageFromDriver))
{
if (((AgentOperations)currentAgent.AgentOperations).Driver != null && !string.IsNullOrEmpty(((AgentOperations)currentAgent.AgentOperations).Driver.ErrorMessageFromDriver))
{
act.Error = ((AgentOperations)currentAgent.AgentOperations).Driver.ErrorMessageFromDriver;
}
else
{
act.Error = $"Agent failed to start for the {GingerDicser.GetTermResValue(eTermResKey.Activity)} Application. Current Agent Status {((AgentOperations)currentAgent.AgentOperations).Status}";
}
act.Error = ((AgentOperations)currentAgent.AgentOperations).Driver.ErrorMessageFromDriver;
}

act.Status = Amdocs.Ginger.CoreNET.Execution.eRunStatus.Failed;
}
else
{
using (IFeatureTracker rodFeatureTracker = Reporter.StartFeatureTracking(FeatureId.ActionExecution))
else
{
rodFeatureTracker.Metadata.Add("Type", act.GetType().Name);
rodFeatureTracker.Metadata.Add("ExecutorType", GingerRunner.eActionExecutorType.RunOnDriver.ToString());
rodFeatureTracker.Metadata.Add("IsSharedRepositoryInstance", act.IsSharedRepositoryInstance.ToString());
((AgentOperations)((Agent)CurrentBusinessFlow.CurrentActivity.CurrentAgent).AgentOperations).RunAction(act);
act.Error = $"Agent failed to start for the {GingerDicser.GetTermResValue(eTermResKey.Activity)} Application. Current Agent Status {((AgentOperations)currentAgent.AgentOperations).Status}";
}
}

act.Status = Amdocs.Ginger.CoreNET.Execution.eRunStatus.Failed;
}
else
{

if (act is IActPluginExecution PluginAction)
using (IFeatureTracker rodFeatureTracker = Reporter.StartFeatureTracking(FeatureId.ActionExecution))
{

Agent PluginAgent = (Agent)CurrentBusinessFlow.CurrentActivity.CurrentAgent;
ExecuteOnPlugin.ExecutePlugInActionOnAgent(PluginAgent, PluginAction);
rodFeatureTracker.Metadata.Add("Type", act.GetType().Name);
rodFeatureTracker.Metadata.Add("ExecutorType", GingerRunner.eActionExecutorType.RunOnDriver.ToString());
rodFeatureTracker.Metadata.Add("IsSharedRepositoryInstance", act.IsSharedRepositoryInstance.ToString());
((AgentOperations)((Agent)CurrentBusinessFlow.CurrentActivity.CurrentAgent).AgentOperations).RunAction(act);
}
}
}
else
{

else
{
act.Error = "Current Plugin Agent does not support execution for " + act.ActionDescription;
act.Status = Amdocs.Ginger.CoreNET.Execution.eRunStatus.Failed;
if (act is IActPluginExecution PluginAction)
{

}
Agent PluginAgent = (Agent)CurrentBusinessFlow.CurrentActivity.CurrentAgent;
ExecuteOnPlugin.ExecutePlugInActionOnAgent(PluginAgent, PluginAction);
}

else
{
act.Error = "Current Plugin Agent does not support execution for " + act.ActionDescription;
act.Status = Amdocs.Ginger.CoreNET.Execution.eRunStatus.Failed;

}
}

}
}

break;
break;

case GingerRunner.eActionExecutorType.RunWithoutDriver:
using (IFeatureTracker rwdFeatureTracker = Reporter.StartFeatureTracking(FeatureId.ActionExecution))
Expand Down Expand Up @@ -4415,6 +4417,20 @@ public void RunBusinessFlow(BusinessFlow businessFlow, bool standaloneExecution

while (ExecutingActivity != null)
{
if (ExecutingActivity is CleanUpActivity)
{
if (!CurrentBusinessFlow.Activities.IsLastItem())
{
GotoNextActivity();
ExecutingActivity = (Activity)CurrentBusinessFlow.Activities.CurrentItem;
continue;
}
else
{
ExecutingActivity = null;
break;
}
}
ExecutingActivity.Status = eRunStatus.Running;
GiveUserFeedback();
SetMappedValuesToActivityVariables(ExecutingActivity, previouslyExecutedActivities.ToArray());
Expand All @@ -4438,7 +4454,7 @@ public void RunBusinessFlow(BusinessFlow businessFlow, bool standaloneExecution
{
//CurrentBusinessFlow.Elapsed = st.ElapsedMilliseconds;
CurrentBusinessFlow.RunStatus = Amdocs.Ginger.CoreNET.Execution.eRunStatus.Failed;
if (!(CurrentBusinessFlow.Activities.IsLastItem()))
if (!CurrentBusinessFlow.Activities.IsLastItem())
{
GotoNextActivity();
SetNextActivitiesBlockedStatus();
Expand Down

0 comments on commit 570e01d

Please sign in to comment.