/// <summary>
        /// Kill a job.
        /// </summary>
        /// <param name="job">The job object.</param>
        /// <returns>Indicates whether the job is killed successfully.</returns>
        public override bool Kill(TtsHpcJob job)
        {
            if (!(job is TtsHpcTaskJob))
            {
                throw new HpcException("The internal job type is not compatitable with the farm object.");
            }

            try
            {
                if (null == this.containerJob)
                {
                    return true;
                }
                else
                {
                    var statesFinish = JobState.Finishing |
                        JobState.Finished |
                        JobState.Failed;
                    this.containerJob.Refresh();
                    if (statesFinish.HasFlag(this.containerJob.State))
                    {
                        return true;
                    }
                }

                var hpcJob = job as TtsHpcTaskJob;
                this.containerJob.CancelTask(hpcJob.TaskId);
                return true;
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception.ToString());
                return false;
            }
        }
        /// <summary>
        /// Submit a job to the farm.
        /// </summary>
        /// <param name="job">The job object.</param>
        /// <returns>Indicates whether the job is submitted successfully.</returns>
        public override bool Submit(TtsHpcJob job)
        {
            if (!(job is TtsHpcTaskJob))
            {
                throw new HpcException("The internal job type is not compatible with the farm object.");
            }

            try
            {
                if (this.containerJob == null)
                {
                    this.IsExclusive = job.UseWholeMachine;
                    this.CreateJob();
                }
                else
                {
                    var statesFinish = JobState.Finishing |
                        JobState.Finished |
                        JobState.Failed;
                    this.containerJob.Refresh();
                    if (statesFinish.HasFlag(this.containerJob.State))
                    {
                        this.IsExclusive = job.UseWholeMachine;
                        this.CreateJob();
                    }
                }

                var hpcJob = job as TtsHpcTaskJob;
                this.containerJob.Priority = (JobPriority)hpcJob.Priority;
                var task = this.containerJob.CreateTask();
                task.IsParametric = true;
                task.Name = hpcJob.Name;
                task.IsRerunnable = true;
                task.StartValue = hpcJob.StartValue;
                task.EndValue = hpcJob.EndValue;
                task.IncrementValue = hpcJob.IncrementalValue;
                task.CommandLine = hpcJob.Command;
                task.IsExclusive = hpcJob.UseWholeMachine;
                if (hpcJob.LogFile != null)
                {
                    task.StdOutFilePath = hpcJob.LogFile;
                    task.StdErrFilePath = hpcJob.LogFile;
                }

                if (this.jobCreating)
                {
                    this.containerJob.AddTask(task);
                    this.scheduler.SubmitJob(this.containerJob, this.UserName, null);
                    task.Refresh();
                    this.jobCreating = false;
                }
                else
                {
                    this.containerJob.SubmitTask(task);
                }

                hpcJob.InitializeFrom(task);
                return true;
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception.ToString());
                return false;
            }
        }
 /// <summary>
 /// The abstract method of kill job.
 /// </summary>
 /// <param name="job">The job to kill.</param>
 /// <returns>Bool.</returns>
 public abstract bool Kill(TtsHpcJob job);
 /// <summary>
 /// Sync the job with a IHpcJob object.
 /// </summary>
 /// <param name="job">The job object.</param>
 public virtual void SyncFrom(TtsHpcJob job)
 {
     this.Id = job.Id;
     this.State = job.State;
     this.Priority = job.Priority;
     this.Machine = job.Machine;
     this.CpuTime = job.CpuTime;
 }
 /// <summary>
 /// The abstract method of submit job.
 /// </summary>
 /// <param name="job">The job to submit.</param>
 /// <returns>Bool.</returns>
 public abstract bool Submit(TtsHpcJob job);