/// <summary> /// Begin a task with the specified name. /// </summary> /// <param name="name">The name of the task to begin.</param> /// <returns>The new task.</returns> public CloudTask BeginTask(String name) { CloudTask result = new CloudTask(this); result.Init(name); return result; }
/// <summary> /// Perform an update. /// </summary> public void Update() { long now = Environment.TickCount; long elapsed = (long)TimeSpan.FromTicks(now - lastUpdate).TotalSeconds; if (task == null) { this.task = this.cloud.BeginTask(train.GetType().Name); } this.iteration++; if (elapsed > 10) { this.lastUpdate = now; StringBuilder status = new StringBuilder(); status.Append("Iteration #"); status.Append(Format.FormatInteger(this.iteration)); status.Append(" - Error: "); status.Append(Format.FormatPercent(train.Error)); this.task.SetStatus(status.ToString()); } }
/// <summary> /// Report that we are finished. /// </summary> public void Finish() { StringBuilder status = new StringBuilder(); status.Append("Done at iteration #"); status.Append(Format.FormatInteger(this.iteration)); status.Append(" - Error: "); status.Append(Format.FormatPercent(train.Error)); this.task.Stop(status.ToString()); this.task = null; }