本文整理汇总了C#中IDependency.GetBreadthFirstEnumerator方法的典型用法代码示例。如果您正苦于以下问题:C# IDependency.GetBreadthFirstEnumerator方法的具体用法?C# IDependency.GetBreadthFirstEnumerator怎么用?C# IDependency.GetBreadthFirstEnumerator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDependency
的用法示例。
在下文中一共展示了IDependency.GetBreadthFirstEnumerator方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetDependencyEnumerator
private IEnumerator<IDependency<IModule>> GetDependencyEnumerator(JobExeWrapper jobWrapper, IDependency<IModule> dep, IEnumerator<IDependency<IModule>> iEnumerator)
{
switch (jobWrapper.Job.DependencyTraversalMode)
{
case "Breadth-first":
iEnumerator = dep.GetBreadthFirstEnumerator();
break;
case "Depth-first":
iEnumerator = dep.GetDepthFirstEnumerator();
break;
}
return iEnumerator;
}
示例2: ResetDependentOutputs
private void ResetDependentOutputs(JobExeWrapper jobWrapper, IDependency<IModule> dep)
{
#region pick enumeration type
IEnumerator<IDependency<IModule>> iEnumerator =
dep.GetBreadthFirstEnumerator(); //default mode
iEnumerator = GetDependencyEnumerator(jobWrapper, dep, iEnumerator);
#endregion
//execution
log.InfoFormat("Resetting dependent outputs on {0}/{1}.", jobWrapper.Job.JobName, dep.Name);
iEnumerator = GetDependencyEnumerator(jobWrapper, dep, iEnumerator);
while (iEnumerator.MoveNext())
{
IDependency<IModule> d = iEnumerator.Current;
d.Module.ResetOutput();
}
}
示例3: ProcessJobFromRoot
private ErrorCode ProcessJobFromRoot(JobExeWrapper jobWrapper, DateTime jobkey, IDependency<IModule> dep)
{
ErrorCode retval = ErrorCode.SUCCESS;
if (killJobs.Contains(jobWrapper.Job.JobName))
killJobs.Remove(jobWrapper.Job.JobName);
// pick enumeration type
IEnumerator<IDependency<IModule>> iEnumerator =
dep.GetBreadthFirstEnumerator(); //default mode
//execution
log.InfoFormat(jobWrapper.Job.KeyCode, "Beginning executing job {0} in {1} mode.", jobWrapper.Job.JobName, jobWrapper.Mode.ToString());
ArrayList trackWaitState = new ArrayList();
iEnumerator = GetDependencyEnumerator(jobWrapper, dep, iEnumerator);
while (iEnumerator.MoveNext())
{
IDependency<IModule> d = iEnumerator.Current;
if (d.Name.Equals(jobWrapper.Job.JobName))
continue;
if (!jobWrapper.States.ContainsKey(d.Name))
jobWrapper.States[d.Name] = State.CurrentStateEnum.PendingInitialization;
}
iEnumerator = GetDependencyEnumerator(jobWrapper, dep, iEnumerator);
while (iEnumerator.MoveNext() && retval.Equals(ErrorCode.ABORT_JOB) == false)
{
IDependency<IModule> d = iEnumerator.Current;
if (killJobs.Contains(jobWrapper.Job.JobName))
{
killJobs.Remove(jobWrapper.Job.JobName);
ReenableJob(jobWrapper, trackWaitState, d);
log.WarnFormat(jobWrapper.Job.KeyCode, "Killing job {0} ", jobWrapper.Job.JobName);
Thread.CurrentThread.Abort();
break;
}
if (d.Name.Equals(jobWrapper.Job.JobName))
continue;
if ((jobWrapper.Mode.Equals(State.ExecutionModeEnum.Initialization) &&
!jobWrapper.States[d.Name].Equals(State.CurrentStateEnum.InitializationSuccessful)) ||
(jobWrapper.Mode.Equals(State.ExecutionModeEnum.Execution) &&
!jobWrapper.States[d.Name].Equals(State.CurrentStateEnum.ExecutionSuccessful) &&
!jobWrapper.Job.Limiter.ifWaitingForFirstTrigger))
{
bool ifAllParentsAreReady = true;
foreach (IDependency<IModule> dParent in d.Parents)
{
if (!dParent.Name.Equals(jobWrapper.Job.JobName))
{
if (jobWrapper.Mode == State.ExecutionModeEnum.Initialization)
{
if (!jobWrapper.States[dParent.Name].Equals(State.CurrentStateEnum.WaitState) &&
!jobWrapper.States[dParent.Name].Equals(State.CurrentStateEnum.InitializationSuccessful))
{
ifAllParentsAreReady = false;
break;
}
}
else if (jobWrapper.Mode == State.ExecutionModeEnum.Execution)
{
if (!jobWrapper.States[dParent.Name].Equals(State.CurrentStateEnum.WaitState) &&
!jobWrapper.States[dParent.Name].Equals(State.CurrentStateEnum.ExecutionSuccessful))
{
ifAllParentsAreReady = false;
break;
}
}
}
}
if (ifAllParentsAreReady)
{
int result = ProcessDependency(jobWrapper, jobkey, d);
if (result == -99)
retval = ErrorCode.ABORT_JOB;
else if (result != 0)
retval = ErrorCode.MODULE_FAILED;
if (retval.Equals(ErrorCode.ABORT_JOB) == false)
ReenableJob(jobWrapper, trackWaitState, d);
log.InfoFormat("Processed {0}", d.ToString());
}
}
}
foreach (string job in trackWaitState)
{
if (jobWrapper.States.ContainsKey(job))
jobWrapper.States[job] = State.CurrentStateEnum.WaitState;
}
//.........这里部分代码省略.........
示例4: ProcessJobFromRoot
private ErrorCode ProcessJobFromRoot(JobExeWrapper jobWrapper, Job job, IDependency<IModule> dep)
{
ErrorCode returnCode = ErrorCode.SUCCESS;
if (killJobs.Contains(job.JobName))
killJobs.Remove(job.JobName);
// pick enumeration type
IEnumerator<IDependency<IModule>> iEnumerator =
dep.GetBreadthFirstEnumerator(); //default mode
//execution
log.InfoFormat(job.KeyHash, "Beginning executing job {0} in {1} mode.", job.JobName, jobWrapper.DependencyState.ToString());
ArrayList trackWaitState = new ArrayList();
job.StartStats();
iEnumerator = GetDependencyEnumerator(jobWrapper, dep, iEnumerator);
while (iEnumerator.MoveNext())
{
IDependency<IModule> d = iEnumerator.Current;
if (d.Name.Equals(job.JobName))
continue;
if (!jobWrapper.DependencyStates.ContainsKey(d.Name))
jobWrapper.DependencyStates[d.Name] = StateEnums.ExecutionState.PendingInitialization;
}
iEnumerator = GetDependencyEnumerator(jobWrapper, dep, iEnumerator);
while (iEnumerator.MoveNext() && returnCode.Equals(ErrorCode.ABORT_JOB) == false)
{
IDependency<IModule> d = iEnumerator.Current;
if (killJobs.Contains(job.JobName))
{
killJobs.Remove(job.JobName);
ReenableJob(jobWrapper, trackWaitState, d);
log.WarnFormat(job.KeyHash, "Killing job {0} ", job.JobName);
Thread.CurrentThread.Abort();
break;
}
if (d.Name.Equals(job.JobName))
continue;
if ((jobWrapper.DependencyState.Equals(StateEnums.ExecutionMode.Initialization) &&
!jobWrapper.DependencyStates[d.Name].Equals(StateEnums.ExecutionState.InitializationSuccessful)) ||
(jobWrapper.DependencyState.Equals(StateEnums.ExecutionMode.Execution) &&
!jobWrapper.DependencyStates[d.Name].Equals(StateEnums.ExecutionState.ExecutionSuccessful) &&
!jobWrapper.Job.Limiter.ifWaitingForFirstTrigger))
{
bool ifAllParentsAreReady = true;
foreach (IDependency<IModule> dParent in d.Parents)
{
if (!dParent.Name.Equals(jobWrapper.Job.JobName))
{
if (jobWrapper.DependencyState == StateEnums.ExecutionMode.Initialization)
{
if (!jobWrapper.DependencyStates[dParent.Name].Equals(StateEnums.ExecutionState.WaitState) &&
!jobWrapper.DependencyStates[dParent.Name].Equals(StateEnums.ExecutionState.InitializationSuccessful))
{
ifAllParentsAreReady = false;
break;
}
}
else if (jobWrapper.DependencyState == StateEnums.ExecutionMode.Execution)
{
if (!jobWrapper.DependencyStates[dParent.Name].Equals(StateEnums.ExecutionState.WaitState) &&
!jobWrapper.DependencyStates[dParent.Name].Equals(StateEnums.ExecutionState.ExecutionSuccessful))
{
ifAllParentsAreReady = false;
break;
}
}
}
}
if (ifAllParentsAreReady)
{
#region Status Update
if (jobWrapper.DependencyState.Equals(StateEnums.ExecutionMode.Initialization))
job.JobState.CurrentStatusCollection[d.Name].Status = StateEnums.Status.Initializing;
else
{
job.JobState.CurrentStatusCollection[d.Name].Status = StateEnums.Status.Running;
//Required for UpdateStatus (Dashboard)
job.JobState.CurrentStatusCollection[d.Name].StartTime = DateTime.Now;
}
OnStatusEvent(job);
#endregion
//Begin dependency/module processing...
StateEnums.Status result = ProcessDependency(jobWrapper, job, d);
#region Status Update
switch (result)
{
//.........这里部分代码省略.........