Community forum

Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
View
Go to last post Go to first unread
Offline Ken Gould  
#1 Posted : Thursday, April 26, 2018 11:28:22 PM(UTC)
Ken Gould

Rank: Paid support

Joined: 7/19/2017(UTC)
Posts: 8
United States
Location: Maine, Portland

I am trying to get a list of each job execution to monitor execution time over 1-2 weeks and when I call the GetJobHistory method from the Log object I am not getting any results.

I am using the sample client provided. I can connect to the server and the job names etc. all come through. However none of the jobs are coming back with any history. I know the jobs have executed within the 55 hours I am specifying.

Here is the code:

string str;
if (s != null)
{
List<JobClass> allJobs;
allJobs = s.Jobs.GetAll();
AddToLog($"Log from {DateTime.Now.AddHours(-55)} to {DateTime.Now}");
foreach(JobClass j in allJobs)
{
if(j.Stats.Active == true)
{
List<LogJobHistoryClass> j_list = s.Log.GetJobHistory(j.Id, DateTime.Now.AddHours(-55), DateTime.Now, false, true);
if (j_list != null && j_list.Count > 0)
{
foreach (LogJobHistoryClass jhc in j_list)
{
if (jhc.ExitCode != 0)
{
// do something
str = $"Job: {s.Jobs.Get(jhc.JobId).Name} |{jhc.Started}|{jhc.ExecutionTime} | {jhc.ExitCodeResult}";
Console.WriteLine(str);
AddToLog(str) ;
}
}
}
else
{
Console.WriteLine($"Job no History {j.Name} {j.Stats.DateLastExecution}");
AddToLog($"Job no History {j.Name} {j.Stats.DateLastExecution}");
}

}

}
}

Edited by moderator Tuesday, July 24, 2018 10:52:15 AM(UTC)  | Reason: Not specified

Offline Support  
#2 Posted : Friday, April 27, 2018 7:17:10 PM(UTC)
Support

Rank: Official support

Joined: 2/23/2008(UTC)
Posts: 11,167

Thanks: 868 times
Was thanked: 443 time(s) in 421 post(s)
How long time does it take in the Client?
Henrik
Support
http://www.visualcron.com
Please like VisualCron on facebook!
Offline Ken Gould  
#3 Posted : Friday, April 27, 2018 7:20:48 PM(UTC)
Ken Gould

Rank: Paid support

Joined: 7/19/2017(UTC)
Posts: 8
United States
Location: Maine, Portland

I did see it timeout (~30 seconds) a couple of times when in debug at the GetJobHistory call and my development computer, but when I run it on a box that VisualCron is installed on it came back empty very quickly (< 10 seconds)
Offline wam  
#4 Posted : Friday, July 13, 2018 11:18:33 PM(UTC)
wam

Rank: Paid support

Joined: 9/12/2012(UTC)
Posts: 31

Thanks: 2 times
Was thanked: 1 time(s) in 1 post(s)
I have the same issue.

This worked FINE on 8.2.8.

It appears to be broken now on 8.3.5.

I believe this broke at some point between 8.3.5 early beta and 8.3.5 final release.

Henrik,

The same driver program I wrote for you for our memory leak issue has an ExportToCsv command which tries to export all job history and task history. Neither of these are working now. Hope that helps as it is 100% reproducible on both our dev and prod servers.
Offline wam  
#5 Posted : Friday, July 13, 2018 11:39:43 PM(UTC)
wam

Rank: Paid support

Joined: 9/12/2012(UTC)
Posts: 31

Thanks: 2 times
Was thanked: 1 time(s) in 1 post(s)
The API appears to be broke. Attached is a screenshot showing there are 48,363 history rows in dev.

VisualCronSettingsLogDatabaseSettungsTab.png

If helpful, I notice that this is what is returned in Visual Studio debugger when I dump in the Immediate Window the server.Log.DBSettings object:
Code:

server.Log.DBSettings
{VisualCron.LogDBSettingsClass}
    LogAuditDateEnd: {1/1/0001 12:00:00 AM}
    LogAuditDateStart: {1/1/0001 12:00:00 AM}
    LogAuditKeepForXDays: true
    LogAuditKeepForXDaysCount: 14
    LogAuditKeepMaximumRows: true
    LogAuditMaximumRowCount: 2000
    LogGeneralDateEnd: {1/1/0001 12:00:00 AM}
    LogGeneralDateStart: {1/1/0001 12:00:00 AM}
    LogGeneralKeepForXDays: true
    LogGeneralKeepForXDaysCount: 14
    LogGeneralKeepMaximumRows: false
    LogGeneralMaximumRowCount: 50000
    LogJobDateEnd: {1/1/0001 12:00:00 AM}
    LogJobDateStart: {1/1/0001 12:00:00 AM}
    LogJobKeepForXDays: true
    LogJobKeepForXDaysCount: 14
    LogJobKeepMaximumRows: false
    LogJobMaximumRowCount: 10000
    LogTaskDateEnd: {1/1/0001 12:00:00 AM}
    LogTaskDateStart: {1/1/0001 12:00:00 AM}
    LogTaskKeepForXDays: true
    LogTaskKeepForXDaysCount: 14
    LogTaskKeepMaximumRows: false
    LogTaskMaximumRowCount: 10000
    LogToDB: true


I even tried to force the settings to see if somehow the settings being DateTime.MinValue and KeepMaximumRows = false were causing problems, but still I get zero rows back:

Code:

           var settings = server.Settings;
            settings.LogDB.LogTaskDateEnd = DateTime.MaxValue;
            settings.LogDB.LogJobDateEnd = DateTime.MaxValue;
            settings.LogDB.LogAuditDateEnd = DateTime.MaxValue;
            settings.LogDB.LogJobKeepMaximumRows = true;
            settings.LogDB.LogTaskKeepMaximumRows = true;
            settings.LogDB.LogAuditKeepMaximumRows = true;
            server.UpdateServerSettings(settings);
Offline Support  
#6 Posted : Monday, July 16, 2018 10:49:34 AM(UTC)
Support

Rank: Official support

Joined: 2/23/2008(UTC)
Posts: 11,167

Thanks: 868 times
Was thanked: 443 time(s) in 421 post(s)
Originally Posted by: wam Go to Quoted Post
The API appears to be broke. Attached is a screenshot showing there are 48,363 history rows in dev.


The screenshot shows 48,363 of General log. It is not related to Job log or Audit log. In the screenshot you have very few of the others. I suggest keeping General log to a mininum and focus on Job, Task and Audit log as General log you always have on file.
Henrik
Support
http://www.visualcron.com
Please like VisualCron on facebook!
Offline wam  
#7 Posted : Wednesday, July 18, 2018 9:38:50 PM(UTC)
wam

Rank: Paid support

Joined: 9/12/2012(UTC)
Posts: 31

Thanks: 2 times
Was thanked: 1 time(s) in 1 post(s)
Hi Henrik,

All of the logs are empty from the API... I understand I was referring to the General log in the screenshot, but when i dump any of the logs, its all zero rows.

This definitely worked at some point. We were on 8.2.8 without issues. On 8.3.5 it is broke.

Code:

        private List<JobHistory> SelectJobHistory(Server server, bool failedOnly)
        {
            var jobs = GetAllJobs(server).Select(j => new
            {
                JobId = j.Id,
                JobName = j.Name
            });
            var jobLogsToWrite = new List<JobHistory>();

            foreach (var job in jobs)
            {
                var jobLog = server.Log.GetJobHistory(
                    job.JobId,
                    DateTime.Today.AddDays(-7),
                    DateTime.Today,
                    failedOnly)
                    .Select(jh => new JobHistory
                    {
                        JobId = job.JobId,
                        JobName = job.JobName,
                        ExecutionId = jh.ExecutionId,
                        ExecutionTime = jh.ExecutionTime,
                        ExitCode = jh.ExitCode,
                        ExitCodeResult = jh.ExitCodeResult.ToString(),
                        Started = jh.Started,
                    }).ToList();

                jobLogsToWrite.AddRange(jobLog);
            }

            return jobLogsToWrite;
        }

        private List<JobClass> GetAllJobs(Server server)
        {
            return server.Jobs.GetAll()
                .OrderBy(x => x.Group)
                .ThenBy(x => x.Name)
                .ToList();
        }
Offline wam  
#8 Posted : Thursday, July 19, 2018 12:25:13 AM(UTC)
wam

Rank: Paid support

Joined: 9/12/2012(UTC)
Posts: 31

Thanks: 2 times
Was thanked: 1 time(s) in 1 post(s)
Hmm... it is working now.

I suspect there is some kind of bug in how VIsualCron loads the job log...

Maybe when I first ran Log.GetJobHistory, no jobs had ran.

Either way, it now works after we restarted the test server. NO IDEA WHY.

I do think there is a bug here.
Offline Support  
#9 Posted : Tuesday, July 24, 2018 10:52:02 AM(UTC)
Support

Rank: Official support

Joined: 2/23/2008(UTC)
Posts: 11,167

Thanks: 868 times
Was thanked: 443 time(s) in 421 post(s)
Originally Posted by: wam Go to Quoted Post
Hmm... it is working now.

I suspect there is some kind of bug in how VIsualCron loads the job log...

Maybe when I first ran Log.GetJobHistory, no jobs had ran.

Either way, it now works after we restarted the test server. NO IDEA WHY.

I do think there is a bug here.


Ok, please keep us updated if you can reproduce this.
Henrik
Support
http://www.visualcron.com
Please like VisualCron on facebook!
Users browsing this topic
Guest
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Scroll to Top