Community forum

Please note that VisualCron support is not actively monitoring this community forum. Please use our contact page for contacting the VisualCron support directly.


innominate
2016-04-13T14:21:13Z
Is there any way to get the Unique ID for a job run that was just started? I would like to start a job and output when each task in the job finishes.

The code below mostly works, but if the job is running twice I will see the ended events from the other runs. I only want to see the events from the run i just started. I think need something like the line that is currently commented out, but I'm not sure how to get the UniqueId.


var job = server.Jobs.Get(ConfigurationManager.AppSettings["JobId"]);
var r = server.Jobs.Run(job, true, true);
server.Processes.TaskProcessEnded += delegate (ref Server server1, VCTaskProcessClass pc)
{
    //if (pc.UniqueId == r.UniqueId)
    if (pc.JobId == job.Id)
    {
        var task = server.Jobs.Tasks.Get(pc.TaskId);
        Console.WriteLine("Task Ended " + task.Name);
    }
};
Sponsor
Forum information
Support
2016-04-14T12:36:53Z
The unique counter id is stored in: pc.JobPId
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
innominate
2016-04-25T15:40:28Z
That good for getting the id of the job that ended, but what about getting the id of the job that I started on line 3?
Support
2016-04-26T07:36:14Z
Originally Posted by: innominate 

That good for getting the id of the job that ended, but what about getting the id of the job that I started on line 3?



You want the same id but from the Run method?
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
innominate
2016-04-26T12:32:44Z
Correct. I only want to show progress messages of the process that was started when I called server.Jobs.Run. If someone else starts another process for the same job at the same time I dont want to see messages from that process.

Thanks
Support
2016-04-26T13:15:05Z
Ok, we added that in the result object for the next build. Will probably be released in a day or two.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Support
2016-04-26T18:09:25Z
Please try the dlls from this (you need to update server as well): http://www.visualcron.co....aspx?g=posts&t=6564 
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Scroll to Top