Getting Started Embedded Scheduler

In order to develop applications that target the embedded job scheduler, you must perform these steps.

After you have setup your environment, consider completing the Programmer's Guide to learn how to submit and run your jobs.

Important note Important

A note about the help system and the code snippets. For simplicity and brevity, most of the code snippets in the help system use the ClusterJobScheduler as the job scheduler instead of having a separate snippet that targets the embedded job scheduler. You can easily replace the ClusterJobScheduler with EmbeddedJobScheduler. For most of the examples, that is all it takes to convert the example to use the embedded job scheduler.

Setting up your environment for the embedded job scheduler, consists of the following:

Setup Visual Studio project and add necessary assemblies

The only step necessary to use the Embedded Job Scheduler is to setup a Visual Studio project properly. Setting up the project for the Embedded Job Scheduler can be error prone, so look at the EmbeddedJobSchedulerTemplate example available in the SDK.

Step 1) In Visual Studio, create a new Visual C# or Visual Basic project. Make sure to target .NET 4.5 or greater.

Visual Studio Project Setup

Step 2) Add the three necessary references: AGI.Parallel.Client.dll, AGI.Parallel.EmbeddedClient.dll, AGI.Parallel.Infrastructure.dll

Embedded Add Required Assemblies

Step 3) Add a build step to copy the necessary files needed by the embedded job scheduler to the bin folder of the executable. There are a number of ways to do this. One way is to add the files by "Content". Another way is to add a post-build step that copies the files. Copy the following files: AGI.Parallel.Host.exe, AGI.Parallel.Host.exe.config, AGI.Parallel.Host_x86.exe, AGI.Parallel.Host_x86.exe.config, log4net.dll. Make sure to add the files to Visual Studio as "Add as link"

Embedded Add Host Files As Link

After the files have been added to the solution, right click on each file and click on Properties. In the file properties page, change the "Copy to Output Directory" option from Do not copy to Copy if newer

Embedded Add Host Copy If Newer
Verify tasks can run

The final step is to make sure the host executables are properly placed in the location the embedded job scheduler expects. Replace the contents of Program.cs with the contents below. Compile and run. If you can run the program without any exceptions, congratulations! Everything is setup for developing applications for the embedded scheduler. Follow the programmer's guide to start coding!

using System;
using AGI.Parallel.Client;
using AGI.Parallel.Infrastructure;

namespace CodeSamples
    class Program
        static void Main(string[] args)
            using (IJobScheduler scheduler = new EmbeddedJobScheduler())
                Job job = scheduler.CreateJob();
                job.AddTask(new TestTask());

                if (job.Tasks[0].TaskStatus == TaskStatus.Completed)
                    Console.WriteLine("Congratulations, you can start coding!");
                    Console.WriteLine("Something went wrong.");

        class TestTask : Task
            public override void Execute()
                Console.WriteLine("Hello from Task!");
See Also

Other Resources

STK Scalability 1.4 API for .NET