locked
Job.GetTaskList interface in JScript RRS feed

  • Question

  • Hello,

    I'm trying to write a jscript to get the list of failed tasks in the job. However I have some problems with calling GetTaskList method, my code is as simple as following:

    var strClusterName = "Myserver";
    
    var objComputeCluster = new ActiveXObject("Microsoft.HPC.Scheduler.Scheduler");
    objComputeCluster.Connect(strClusterName);
    
    var jobId = 2268;
    
    var objJob = objComputeCluster.OpenJob(jobId);
    
    var taskListCollection = objJob.GetTaskList(null, null, true);


    And I've got an error on the last line

     "Microsoft JScript runtime error: Invalid procedure call or argument".

    When I slightly change the code to explicitly add filter and sort collections like that:

    var strClusterName = "Myserver";
    
    var objComputeCluster = new ActiveXObject("Microsoft.HPC.Scheduler.Scheduler");
    objComputeCluster.Connect(strClusterName);
    
    var jobId = 2268;
    
    var objJob = objComputeCluster.OpenJob(jobId);
    
    var filterCollection = objComputeCluster.CreateFilterCollection();
    var sortCollection = objComputeCluster.CreateSortCollection();
    
    var taskListCollection = objJob.GetTaskList(filterCollection, sortCollection, true);
    WScript.Echo("Found " + taskListCollection.Count() + " tasks");


    I've got an error

    "Microsoft JScript runtime error: 'taskListCollection' is null or not an object"

    Please help me to solve that issue.


    Monday, October 28, 2013 10:25 AM