Gets or sets the custom working directory of the task environment.
Namespace: AGI.Parallel.Infrastructure
Assembly: AGI.Parallel.Infrastructure (in AGI.Parallel.Infrastructure.dll) Version: 1.2.0.275 (1.2.0.275)

Syntax

C#
public string WorkingDirectory { get; set; }
Visual Basic
Public Property WorkingDirectory As String
        Get
        Set

Field Value

The working directory.

Examples

  Copy imageCopy
using System;
using System.IO;
using AGI.Parallel.Client;
using AGI.Parallel.Infrastructure;

namespace CodeSamples
{
    class Program
    {
        static void Main(string[] args)
        {
            using (IJobScheduler scheduler = new ClusterJobScheduler("localhost"))
            {
                scheduler.Connect();
                Job job = scheduler.CreateJob();
                job.AddTask(new ReturnsWorkingDirectory());

                // Use the Windows variables to specify specific directories.
                job.TaskEnvironment.WorkingDirectory = "%TEMP%";

                job.Submit();
                job.WaitUntilDone();

                Console.WriteLine("Working Directory: " + job.Tasks[0].Result);
            }

            /*
             * The output of the application should resemble:
             * Working Directory: C:\Users\jdoe\AppData\Local\Temp
             */
        }

        [Serializable]
        class ReturnsWorkingDirectory : Task
        {
            public override void Execute()
            {
                this.Result = Directory.GetCurrentDirectory();
            }
        }
    }
}

See Also