本文整理汇总了C#中JobStatus类的典型用法代码示例。如果您正苦于以下问题:C# JobStatus类的具体用法?C# JobStatus怎么用?C# JobStatus使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JobStatus类属于命名空间,在下文中一共展示了JobStatus类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateSelectCommand
/// <summary>
/// Creates a select command.
/// </summary>
/// <param name="connection">The connection to create the command with.</param>
/// <param name="status">The job status to filter results on.</param>
/// <param name="count">The maximum number of results to select.</param>
/// <param name="before">The queued-after date to filter on.</param>
/// <returns>A select command.</returns>
protected override DbCommand CreateSelectCommand(DbConnection connection, JobStatus status, int count, DateTime before)
{
const string SqlStart = "SELECT{0} * FROM {1} WHERE {2} = {3} AND {4} < {5} ORDER BY {4};";
DbCommand command = connection.CreateCommand();
command.CommandType = CommandType.Text;
command.Parameters.Add(this.ParameterWithValue(this.ParameterName("Status"), status.ToString()));
command.Parameters.Add(this.ParameterWithValue(this.ParameterName("Before"), before));
string countString = String.Empty;
if (count > 0)
{
countString = String.Format(CultureInfo.InvariantCulture, " TOP ({0})", this.ParameterName("Count"));
command.Parameters.Add(this.ParameterWithValue(this.ParameterName("Count"), count));
}
command.CommandText = String.Format(
CultureInfo.InvariantCulture,
SqlStart,
countString,
this.TableName,
this.ColumnName("Status"),
this.ParameterName("Status"),
this.ColumnName("QueueDate"),
this.ParameterName("Before"));
return command;
}
示例2: Abort
public virtual void Abort()
{
if (!m_Thread.IsAlive)
return;
m_Thread.Abort();
Status = JobStatus.NotStarted;
}
示例3: PrepareNextActionOverride
protected override GameAction PrepareNextActionOverride(out JobStatus progress)
{
if (this.m_group == null)
return PrepareNextActionOverrideHerdless(out progress);
else
return PrepareNextActionOverrideHerd(out progress);
}
示例4: EndTree
Job EndTree(Job job, JobStatus endStatus)
{
// If this is the root, mutate to completed status.
if (job.ParentId == null)
return _jobMutator.Mutate<EndTransition>(job, status: JobStatus.Completed);
job = _jobMutator.Mutate<EndTransition>(job, PendingEndStatus[endStatus]);
/*
* First, load the parent, find the await record for this job and
* update its status to end status.
*/
// ReSharper disable once PossibleInvalidOperationException
var parent = _jobRepository.Load(job.ParentId.Value);
var @await = parent.Continuation.Find(job);
@await.Status = endStatus;
/*
* After we set the await's status, invoke ContinuationDispatcher to
* ensure any pending await for parent is dispatched.
* If ContinuationDispatcher returns any awaits, that means parent job is not
* ready for completion.
*/
var pendingAwaits = _continuationDispatcher.Dispatch(parent);
if (!pendingAwaits.Any())
EndTree(parent, JobStatus.Completed);
return _jobMutator.Mutate<EndTransition>(job, endStatus);
}
示例5: Start
public virtual void Start()
{
if (m_Thread.IsAlive)
return;
m_Thread.Start();
Status = JobStatus.Started;
}
示例6: PrepareNextActionOverrideHerd
GameAction PrepareNextActionOverrideHerd(out JobStatus progress)
{
var center = m_group.GetCenter();
var centerVector = center - this.Worker.Location;
centerVector = new IntVector3(centerVector.X, centerVector.Y, 0);
var r = this.Worker.World.Random;
int moveStrength = m_group.GroupSize + 1;
var l = centerVector.Length;
if (l < moveStrength && r.Next(4) < 2)
{
progress = JobStatus.Ok;
return new WaitAction(r.Next(4) + 1);
}
var moveVector = new IntVector3(r.Next(-moveStrength, moveStrength + 1), r.Next(-moveStrength, moveStrength + 1), 0);
var v = centerVector + moveVector;
var dir = v.ToDirection();
if (dir == Direction.None)
{
progress = JobStatus.Ok;
return new WaitAction(r.Next(4) + 1);
}
var action = DoMove(dir);
progress = JobStatus.Ok;
return action;
}
示例7: LoadBy
public IEnumerable<Job> LoadBy(JobStatus status)
{
using (var persistenceStore = _persistenceProvider.CreateStore())
{
return persistenceStore.LoadBy(status);
}
}
示例8: Change
public Job Change(Job job, JobStatus newStatus, Activity activity = null)
{
switch (newStatus)
{
case JobStatus.Ready:
return CheckStatusAndInvoke(job, new[] {JobStatus.Created},
() => _jobMutator.Mutate<StatusChanger>(job, status: newStatus));
case JobStatus.Running:
return CheckStatusAndInvoke(job, RunnableStatuses, () => _runningTransition.Transit(job));
case JobStatus.Completed:
return CheckStatusAndInvoke(job, CompletableStatus,
() => _endTransition.Transit(job, JobStatus.Completed));
case JobStatus.Failed:
return CheckStatusAndInvoke(job, FallibleStatuses, () => _failedTransition.Transit(job));
case JobStatus.WaitingForChildren:
return CheckStatusAndInvoke(job, AwaitableStatus,
() => _waitingForChildrenTransition.Transit(job, activity));
case JobStatus.Poisoned:
return CheckStatusAndInvoke(job, PoisonableStatus,
() => _endTransition.Transit(job, JobStatus.Poisoned));
case JobStatus.Cancelling:
return _jobMutator.Mutate<StatusChanger>(job, status: newStatus);
case JobStatus.Cancelled:
return _endTransition.Transit(job, JobStatus.Cancelled);
}
return job;
}
示例9: OnStateChanged
protected override void OnStateChanged(JobStatus status)
{
if (status == JobStatus.Ok)
return;
// else Abort, Done or Fail
}
示例10: Run
public void Run ()
{
Status = JobStatus.Running;
if (Execute ())
Status = JobStatus.Finished;
else
Status = JobStatus.Failed;
}
示例11: JobCompletedEventArgs
/// <summary>
/// Initializes a new instance of the <see cref="JobCompletedEventArgs"/> class.
/// </summary>
/// <param name="jobName">Name of the job.</param>
/// <param name="action">The action.</param>
/// <param name="jobId">The job id.</param>
/// <param name="started">The time the job run started.</param>
/// <param name="finished">The time the job run ended.</param>
/// <param name="result">The result of the job run.</param>
/// <param name="status">The status of the job run.</param>
public JobCompletedEventArgs(string jobName, JobAction action, string jobId, DateTime started, DateTime finished, string result, JobStatus status)
: base(jobName, action, jobId)
{
Started = started;
Finished = finished;
Result = result;
Status = status;
}
示例12: PublishJobEntry
public PublishJobEntry(Handle jobHandle, string jobName, string category, JobStatus jobStatus, User jobOwner)
{
JobHandle = jobHandle.ToString();
Name = jobName;
Status = jobStatus;
Owner = jobOwner;
Category = category;
}
示例13: HpcJobSubmission
internal HpcJobSubmission(HpcLinqContext context)
{
this.m_context = context;
this.m_status = JobStatus.NotSubmitted;
//@@TODO[P0] pass the runtime to the DryadJobSubmission so that it can use the scheduler instance.
//@@TODO: Merge DryadJobSubmission into Ms.Hpc.Linq. Until then make sure Context is not disposed before DryadJobSubmission.
this.m_job = new DryadJobSubmission(m_context.GetIScheduler());
}
示例14: PrepareNextActionOverride
protected override GameAction PrepareNextActionOverride(out JobStatus progress)
{
var dir = m_fleeVector.ToDirection();
var action = DoMove(dir);
progress = JobStatus.Ok;
return action;
}
示例15: JobContext
/// <summary>
/// Initializes a new instance of the <see cref="T:System.MarshalByRefObject" /> class.
/// </summary>
public JobContext(string name, string description, DateTime lastRunTime, JobStatus lastStatus, IDictionary<string, object> arguments, Action<string> updateStatus, IDependencyResolver resolver)
{
UpdateStatusAction = updateStatus;
Name = name;
Description = description;
LastRunTime = lastRunTime;
LastStatus = lastStatus;
Arguments = arguments;
}