TaskPropertyIds Class

Defines identifiers that uniquely identify the properties of a task.


Namespace: Microsoft.Hpc.Scheduler.Properties
Assembly: Microsoft.Hpc.Scheduler.Properties (in Microsoft.Hpc.Scheduler.Properties.dll)

'Usage
Dim instance As TaskPropertyIds

[SerializableAttribute] 
public class TaskPropertyIds
/** @attribute SerializableAttribute() */ 
public class TaskPropertyIds
SerializableAttribute 
public class TaskPropertyIds

The following example shows how to use the property identifiers with a rowset enumerator to retrieve all the properties for a specific task in a job. For an alternative way of accessing the property value, see TaskPropertyIds.Error.


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Hpc.Scheduler;
using Microsoft.Hpc.Scheduler.Properties;

namespace AccessTaskPropertyIds
{
    class Program
    {
        static void Main(string[] args)
        {
            IScheduler scheduler = new Scheduler();
            ISchedulerJob job = null;
            ITaskId taskId = null;
            ISchedulerRowEnumerator rows = null;
            IPropertyIdCollection properties = new PropertyIdCollection();
            IFilterCollection filters = scheduler.CreateFilterCollection();
            StoreProperty property = null;

            // Change the following line to specify the head node for your
            // HPC cluster.
            string headNodeName = "MyHeadNode";

            // Change the following line to specify the identifier of a job 
            // for your HPC cluster that is consistent with the filters 
            // specified later in the code (in other words, a job that has 
            // a parametric sweep task with at least three subtasks as the
            // first task in the job).
            int jobId = 124;

            scheduler.Connect(headNodeName);

            properties.Add(TaskPropertyIds.AllocatedCores);
            properties.Add(TaskPropertyIds.AllocatedNodes);
            properties.Add(TaskPropertyIds.AllocatedSockets);
            properties.Add(TaskPropertyIds.AutoRequeueCount);
            properties.Add(TaskPropertyIds.ChangeTime);
            properties.Add(TaskPropertyIds.Closed);
            properties.Add(TaskPropertyIds.CommandLine);
            properties.Add(TaskPropertyIds.CreateTime);
            properties.Add(TaskPropertyIds.CurrentCoreCount);
            properties.Add(TaskPropertyIds.CurrentNodeCount);
            properties.Add(TaskPropertyIds.CurrentSocketCount);
            properties.Add(TaskPropertyIds.DependsOn);
            properties.Add(TaskPropertyIds.EndTime);
            properties.Add(TaskPropertyIds.EndValue);
            properties.Add(TaskPropertyIds.ErrorCode);
            properties.Add(TaskPropertyIds.ErrorMessage);
            properties.Add(TaskPropertyIds.ErrorParams);
            properties.Add(TaskPropertyIds.ExitCode);
            properties.Add(TaskPropertyIds.FailureReason);
            properties.Add(TaskPropertyIds.GroupId);
            properties.Add(TaskPropertyIds.HasCustomProperties);
            properties.Add(TaskPropertyIds.HasRuntime);
            properties.Add(TaskPropertyIds.Id);
            properties.Add(TaskPropertyIds.IncrementValue);
            properties.Add(TaskPropertyIds.InstanceId);
            properties.Add(TaskPropertyIds.InstanceValue);
            properties.Add(TaskPropertyIds.IsExclusive);
            properties.Add(TaskPropertyIds.IsParametric);
            properties.Add(TaskPropertyIds.IsRerunnable);
            properties.Add(TaskPropertyIds.MaxCores);
            properties.Add(TaskPropertyIds.MaxSockets);
            properties.Add(TaskPropertyIds.MemoryUsed);
            properties.Add(TaskPropertyIds.MinCores);
            properties.Add(TaskPropertyIds.MinNodes);
            properties.Add(TaskPropertyIds.MinSockets);
            properties.Add(TaskPropertyIds.Name);
            properties.Add(TaskPropertyIds.JobTaskId);
            properties.Add(TaskPropertyIds.Output);
            properties.Add(TaskPropertyIds.ParentJobId);
            properties.Add(TaskPropertyIds.ParentJobState);
            properties.Add(TaskPropertyIds.PendingReason);
            properties.Add(TaskPropertyIds.PreviousState);
            properties.Add(TaskPropertyIds.ProcessIds);
            properties.Add(TaskPropertyIds.RequestCancel);
            properties.Add(TaskPropertyIds.RequeueCount);
            properties.Add(TaskPropertyIds.RequiredNodes);
            properties.Add(TaskPropertyIds.RuntimeSeconds);
            properties.Add(TaskPropertyIds.StartTime);
            properties.Add(TaskPropertyIds.StartValue);
            properties.Add(TaskPropertyIds.State);
            properties.Add(TaskPropertyIds.StdErrFilePath);
            properties.Add(TaskPropertyIds.StdInFilePath);
            properties.Add(TaskPropertyIds.StdOutFilePath);
            properties.Add(TaskPropertyIds.SubmitTime);
            properties.Add(TaskPropertyIds.TaskId);
            properties.Add(TaskPropertyIds.TaskOwner);
            properties.Add(TaskPropertyIds.Timestamp);
            properties.Add(TaskPropertyIds.TotalCpuTime);
            properties.Add(TaskPropertyIds.TotalKernelTime);
            properties.Add(TaskPropertyIds.TotalNodeCount);
            properties.Add(TaskPropertyIds.TotalCoreCount);
            properties.Add(TaskPropertyIds.TotalSocketCount);
            properties.Add(TaskPropertyIds.TotalUserTime);
            properties.Add(TaskPropertyIds.UnitType);
            properties.Add(TaskPropertyIds.UserBlob);
            properties.Add(TaskPropertyIds.WorkDirectory);

            // The following lines of code are specific to 
            // Windows HPC Server 2008 R2. To use this example with 
            // Windows HPC Server 2008, remove the lines between here and 
            // the next comment, or place the lines within comments.
            properties.Add(TaskPropertyIds.AllocatedCoreIds);
            properties.Add(TaskPropertyIds.FailedNodeId);
            properties.Add(TaskPropertyIds.IsServiceConcluded);
            properties.Add(TaskPropertyIds.TotalSubTaskNumber);
            properties.Add(TaskPropertyIds.Type);
            // End of code specific to Windows HPC Server 2008 R2.

            // If you do not specify a filter, you will receive all tasks
            // in the job. This example retrieves the third instance of
            // the first task from the job (the task is a parametric task).
            // You cannot use TaskId to filter for a specific task. 
            filters.Add(FilterOperator.Equal, TaskPropertyIds.JobTaskId, 1);
            filters.Add(FilterOperator.Equal, TaskPropertyIds.InstanceId, 3);

            job = scheduler.OpenJob(jobId);

            using (rows = job.OpenTaskEnumerator(properties, filters, null, true))
            {
                PropertyRow row = rows.GetRows(1).Rows[0];

                taskId = (ITaskId)row[TaskPropertyIds.TaskId].Value;
                Console.WriteLine("TaskId: id({0}), instance({1}), job({2})",
                    taskId.JobTaskId, taskId.InstanceId, taskId.ParentJobId);

                // Key is the node name; value is the number of cores on the node allocated to the task.
                Console.WriteLine("AllocatedCores: ");
                foreach (KeyValuePair<string, int> node in (List<KeyValuePair<string, int>>)row[TaskPropertyIds.AllocatedCores].Value)
                        Console.Write("{0}({1})", node.Key, node.Value);
                Console.WriteLine();

                // Key is the node name; value is always 1.
                Console.WriteLine("AllocatedNodes: ");
                foreach (KeyValuePair<string, int> node in (List<KeyValuePair<string, int>>)row[TaskPropertyIds.AllocatedNodes].Value)
                    Console.Write(node.Key + " ");
                Console.WriteLine();

                // Key is the node name; value is the number of sockets on the node allocated to the task.
                Console.WriteLine("AllocatedSockets: ");
                foreach (KeyValuePair<string, int> node in (List<KeyValuePair<string, int>>)row[TaskPropertyIds.AllocatedSockets].Value)
                    Console.Write("{0}({1})", node.Key, node.Value);
                Console.WriteLine();

                property = row[TaskPropertyIds.AutoRequeueCount];
                Console.WriteLine("AutoRequeueCount: {0}", (null != property) ? property.Value : "");

                property = row[TaskPropertyIds.ChangeTime];
                Console.WriteLine("ChangeTime: {0}", (null != property) ? property.Value : "");

                property = row[TaskPropertyIds.Closed];
                Console.WriteLine("Closed: {0}", (null != property) ? property.Value : "");

                property = row[TaskPropertyIds.CommandLine];
                Console.WriteLine("CommandLine: {0}", (null != property) ? property.Value : "");

                property = row[TaskPropertyIds.CreateTime];
                Console.WriteLine("CreateTime: {0}", (null != property) ? property.Value : "");

                property = row[TaskPropertyIds.CurrentCoreCount];
                Console.WriteLine("CurrentCoreCount: {0}", (null != property) ? property.Value : "");

                property = row[TaskPropertyIds.CurrentNodeCount];
                Console.WriteLine("CurrentNodeCount: {0}", (null != property) ? property.Value : "");

                property = row[TaskPropertyIds.CurrentSocketCount];
                Console.WriteLine("CurrentSocketCount: {0}", (null != property) ? property.Value : "");

                property = row[TaskPropertyIds.DependsOn];
                Console.WriteLine("DependsOn: {0}", (null != property) ? property.Value : "");

                property = row[TaskPropertyIds.EndTime];
                Console.WriteLine("EndTime: {0}", (null != property) ? property.Value : "");

                property = row[TaskPropertyIds.EndValue];
                Console.WriteLine("EndValue: {0}", (null != property) ? property.Value : "");

                property = row[TaskPropertyIds.ErrorCode];
                Console.WriteLine("ErrorCode: {0}", (null != property) ? property.Value : "");

                property = row[TaskPropertyIds.ErrorMessage];
                Console.WriteLine("ErrorMessage: {0}", (null != property) ? property.Value : "");

                property = row[TaskPropertyIds.ErrorParams];
                Console.WriteLine("ErrorParams: {0}", (null != property) ? property.Value : "");

                property = row[TaskPropertyIds.ExitCode];
                Console.WriteLine("ExitCode: {0}", (null != property) ? property.Value : "");

                property = row[TaskPropertyIds.FailureReason];
                Console.WriteLine("FailureReason: {0}", (null != property) ? property.Value : "");

                property = row[TaskPropertyIds.GroupId];
                Console.WriteLine("GroupId: {0}", (null != property) ? property.Value : "");

                property = row[TaskPropertyIds.HasCustomProperties];
                Console.WriteLine("HasCustomProperties: {0}", (null != property) ? property.Value : "");

                property = row[TaskPropertyIds.HasRuntime];
                Console.WriteLine("HasRuntime: {0}", (null != property) ? property.Value : "");

                property = row[TaskPropertyIds.Id];
                Console.WriteLine("Id: {0}", (null != property) ? property.Value : "");

                property = row[TaskPropertyIds.IncrementValue];
                Console.WriteLine("IncrementValue: {0}", (null != property) ? property.Value : "");

                property = row[TaskPropertyIds.InstanceId];
                Console.WriteLine("InstanceId: {0}", (null != property) ? property.Value : "");

                property = row[TaskPropertyIds.InstanceValue];
                Console.WriteLine("InstanceValue: {0}", (null != property) ? property.Value : "");

                property = row[TaskPropertyIds.IsExclusive];
                Console.WriteLine("IsExclusive: {0}", (null != property) ? property.Value : "");

                property = row[TaskPropertyIds.IsParametric];
                Console.WriteLine("IsParametric: {0}", (null != property) ? property.Value : "");

                property = row[TaskPropertyIds.IsRerunnable];
                Console.WriteLine("IsRerunnable: {0}", (null != property) ? property.Value : "");

                property = row[TaskPropertyIds.MaxCores];
                Console.WriteLine("MaxCores: {0}", (null != property) ? property.Value : "");

                property = row[TaskPropertyIds.MaxNodes];
                Console.WriteLine("MaxNodes: {0}", (null != property) ? property.Value : "");

                property = row[TaskPropertyIds.MaxSockets];
                Console.WriteLine("MaxSockets: {0}", (null != property) ? property.Value : "");

                property = row[TaskPropertyIds.MemoryUsed];
                Console.WriteLine("MemoryUsed: {0}", (null != property) ? property.Value : "");

                property = row[TaskPropertyIds.MinCores];
                Console.WriteLine("MinCores: {0}", (null != property) ? property.Value : "");

                property = row[TaskPropertyIds.MinNodes];
                Console.WriteLine("MinNodes: {0}", (null != property) ? property.Value : "");

                property = row[TaskPropertyIds.MinSockets];
                Console.WriteLine("MinSockets: {0}", (null != property) ? property.Value : "");

                property = row[TaskPropertyIds.Name];
                Console.WriteLine("Name: {0}", (null != property) ? property.Value : "");

                property = row[TaskPropertyIds.JobTaskId];
                Console.WriteLine("JobTaskId: {0}", (null != property) ? property.Value : "");

                property = row[TaskPropertyIds.Output];
                Console.WriteLine("Output: {0}", (null != property) ? property.Value : "");

                property = row[TaskPropertyIds.ParentJobId];
                Console.WriteLine("ParentJobId: {0}", (null != property) ? property.Value : "");

                property = row[TaskPropertyIds.ParentJobState];
                Console.WriteLine("ParentJobState: {0}", (null != property) ? property.Value : "");

                property = row[TaskPropertyIds.PendingReason];
                Console.WriteLine("PendingReason: {0}", (null != property) ? property.Value : "");

                property = row[TaskPropertyIds.PreviousState];
                Console.WriteLine("PreviousState: {0}", (null != property) ? property.Value : "");

                Console.WriteLine("ProcessIds: ");
                foreach (KeyValuePair<string, string> id in (Dictionary<string, string>)row[TaskPropertyIds.ProcessIds].Value)
                    Console.Write("{0}({1})", id.Key, id.Value);
                Console.WriteLine();

                property = row[TaskPropertyIds.RequestCancel];
                Console.WriteLine("RequestCancel: {0}", (null != property) ? property.Value : "");

                property = row[TaskPropertyIds.RequeueCount];
                Console.WriteLine("RequeueCount: {0}", (null != property) ? property.Value : "");

                property = row[TaskPropertyIds.RequiredNodes];
                Console.WriteLine("RequiredNodes: {0}", (null != property) ? property.Value : "");

                property = row[TaskPropertyIds.RuntimeSeconds];
                Console.WriteLine("RuntimeSeconds: {0}", (null != property) ? property.Value : "");

                property = row[TaskPropertyIds.StartTime];
                Console.WriteLine("StartTime: {0}", (null != property) ? property.Value : "");

                property = row[TaskPropertyIds.StartValue];
                Console.WriteLine("StartValue: {0}", (null != property) ? property.Value : "");

                property = row[TaskPropertyIds.State];
                Console.WriteLine("State: {0}", (null != property) ? property.Value : "");

                property = row[TaskPropertyIds.StdErrFilePath];
                Console.WriteLine("StdErrFilePath: {0}", (null != property) ? property.Value : "");

                property = row[TaskPropertyIds.StdInFilePath];
                Console.WriteLine("StdInFilePath: {0}", (null != property) ? property.Value : "");

                property = row[TaskPropertyIds.StdOutFilePath];
                Console.WriteLine("StdOutFilePath: {0}", (null != property) ? property.Value : "");

                property = row[TaskPropertyIds.SubmitTime];
                Console.WriteLine("SubmitTime: {0}", (null != property) ? property.Value : "");

                property = row[TaskPropertyIds.TaskOwner];
                Console.WriteLine("TaskOwner " + (string)row[TaskPropertyIds.TaskOwner].Value);

                property = row[TaskPropertyIds.TotalCpuTime];
                Console.WriteLine("TotalCpuTime: {0}", (null != property) ? property.Value : "");

                property = row[TaskPropertyIds.TotalKernelTime];
                Console.WriteLine("TotalKernelTime: {0}", (null != property) ? property.Value : "");

                property = row[TaskPropertyIds.TotalNodeCount];
                Console.WriteLine("TotalNodeCount: {0}", (null != property) ? property.Value : "");

                property = row[TaskPropertyIds.TotalCoreCount];
                Console.WriteLine("TotalCoreCount: {0}", (null != property) ? property.Value : "");

                property = row[TaskPropertyIds.TotalSocketCount];
                Console.WriteLine("TotalSocketCount: {0}", (null != property) ? property.Value : "");

                property = row[TaskPropertyIds.TotalUserTime];
                Console.WriteLine("TotalUserTime: {0}", (null != property) ? property.Value : "");

                property = row[TaskPropertyIds.UnitType];
                Console.WriteLine("UnitType: {0}", (null != property) ? property.Value : "");

                property = row[TaskPropertyIds.UserBlob];
                Console.WriteLine("UserBlob: {0}", (null != property) ? property.Value : "");

                property = row[TaskPropertyIds.WorkDirectory];
                Console.WriteLine("WorkDirectory: {0}", (null != property) ? property.Value : "");

                // The following lines of code are specific to 
                // Windows HPC Server 2008 R2. To use this example with 
                // Windows HPC Server 2008, remove the lines between here and 
                // the comment that ends this section, or place the lines 
                // within comments.

                // Key is the node name; Value is the identifier to the core 
                // on the node that is allocated to the task.
                Console.WriteLine("AllocatedCoreIds: ");
                foreach (KeyValuePair<string, string> node in (Dictionary<string, string>)row[TaskPropertyIds.AllocatedCoreIds].Value)
                        Console.Write("{0}({1})", node.Key, node.Value);
                Console.WriteLine();

                property = row[TaskPropertyIds.FailedNodeId];
                Console.WriteLine("FailedNodeId: {0}", (null != property) ? property.Value : "");

                property = row[TaskPropertyIds.IsServiceConcluded];
                Console.WriteLine("IsServiceConcluded: {0}", (null != property) ? property.Value : "");

                property = row[TaskPropertyIds.TotalSubTaskNumber];
                Console.WriteLine("TotalSubTaskNumber: {0}", (null != property) ? property.Value : "");

                property = row[TaskPropertyIds.Type];
                Console.WriteLine("Type: {0}", (null != property) ? property.Value : "");

                // End of code specific to Windows HPC Server 2008 R2.

            }
        }
    }
}

Use these identifiers when creating filters, specifying sort orders, and using rowsets to retrieve specific properties from the database.


System.Object
  Microsoft.Hpc.Scheduler.Properties.TaskPropertyIds

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Development Platforms

Windows XP, Windows Vista, Windows 7, Windows 8, Windows Server 2003, Windows Server 2008, Windows Server 2008 R2, Windows Server 2012

Target Platforms

Windows XP, Windows Vista, Windows 7, Windows 8, Windows Server 2003, Windows Server 2003 R2, Windows Server 2008, Windows Server 2008 R2, Windows Server 2012, with HPC Pack Client Utilities




Build Date:

2013-04-22

Community Additions

ADD
Show: