Job Report for failing jobs - VisualCron - Forum

Community forum

RMassey
2015-08-17T10:38:27Z
I'd like to create a job report of failing jobs. I can use the Job Report task to create a CSV output of all jobs, but I'm not sure how to parse it in a subsequent task to only get failing jobs. Is it possible? If not, could the Job Report task be enhanced by adding filters for the various columns?

Thanks!
Support
2015-08-18T07:50:15Z
Yes, you need to parse the Job report or call the Web API and parse that. No filter yet in those.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
ErikC
2015-08-18T08:04:27Z
Hi,

I tried to solve this for you.
1st I created a Job Report task which writes a csv file. Only the Job name and Job result as columns.
The next task was a file write task. This task should write only the failed jobs in a new file.

I created a loop on the file write task using the for each {FILE(Content|report.csv)} as the input and using column 1 (the result) with a semicolumn as seperator.
The value of the File Write task is the current line in the loop: {LOOP(CurrentValueXLine)}

If you run the job now, the second file created from task 2 has the same data as the 1st file.
We now have to have a condition when to write to the 2nd file.

Create a condition that checks the {LOOP(CurrentValueXLine)} with the string value "Failed". Use the variale condition and set it to 'continue' on a match and 'next' when there is no match. Add this condition to the 2nd task and you're file write task only writes the failed jobs to a file.

Above is how it should word. I, however, did not get this to work. The condition gave me NoMatch all the time. I used 7.6.3 for this to check.
??Support??


Regards,
Erik
Uses Visualcron since 2006.
Support
2015-08-18T08:58:08Z
Originally Posted by: ErikC 

Hi,

I tried to solve this for you.
1st I created a Job Report task which writes a csv file. Only the Job name and Job result as columns.
The next task was a file write task. This task should write only the failed jobs in a new file.

I created a loop on the file write task using the for each {FILE(Content|report.csv)} as the input and using column 1 (the result) with a semicolumn as seperator.
The value of the File Write task is the current line in the loop: {LOOP(CurrentValueXLine)}

If you run the job now, the second file created from task 2 has the same data as the 1st file.
We now have to have a condition when to write to the 2nd file.

Create a condition that checks the {LOOP(CurrentValueXLine)} with the string value "Failed". Use the variale condition and set it to 'continue' on a match and 'next' when there is no match. Add this condition to the 2nd task and you're file write task only writes the failed jobs to a file.

Above is how it should word. I, however, did not get this to work. The condition gave me NoMatch all the time. I used 7.6.3 for this to check.
??Support??


Regards,
Erik



Did you check for Contains or Equal (as the line contains many other things).

Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
ErikC
2015-08-18T09:27:41Z
Originally Posted by: Support 

Originally Posted by: ErikC 

Hi,

I tried to solve this for you.
1st I created a Job Report task which writes a csv file. Only the Job name and Job result as columns.
The next task was a file write task. This task should write only the failed jobs in a new file.

I created a loop on the file write task using the for each {FILE(Content|report.csv)} as the input and using column 1 (the result) with a semicolumn as seperator.
The value of the File Write task is the current line in the loop: {LOOP(CurrentValueXLine)}

If you run the job now, the second file created from task 2 has the same data as the 1st file.
We now have to have a condition when to write to the 2nd file.

Create a condition that checks the {LOOP(CurrentValueXLine)} with the string value "Failed". Use the variale condition and set it to 'continue' on a match and 'next' when there is no match. Add this condition to the 2nd task and you're file write task only writes the failed jobs to a file.

Above is how it should word. I, however, did not get this to work. The condition gave me NoMatch all the time. I used 7.6.3 for this to check.
??Support??


Regards,
Erik



Did you check for Contains or Equal (as the line contains many other things).

Yes I did.
1st I used the check on the column and uses the is equal condition. That did not work. If I used the column in the file write and disabled the condition, the column info was there (Success/Not Set/Failed/etc).
2nd I used the whole line (CurrentValueXLine) and I used the contain option in the variable check. This also didn't gave me a match. And yes, there are failed jobs in my list, so there must me a match. I checked the case and they are the same.

Matching isn't working. Could it be something to do with the {file|content...)} meganism instead of using task output for looping?

Regards,
Erik


Uses Visualcron since 2006.
Support
2015-08-18T11:30:17Z
Originally Posted by: ErikC 

Originally Posted by: Support 

Originally Posted by: ErikC 

Hi,

I tried to solve this for you.
1st I created a Job Report task which writes a csv file. Only the Job name and Job result as columns.
The next task was a file write task. This task should write only the failed jobs in a new file.

I created a loop on the file write task using the for each {FILE(Content|report.csv)} as the input and using column 1 (the result) with a semicolumn as seperator.
The value of the File Write task is the current line in the loop: {LOOP(CurrentValueXLine)}

If you run the job now, the second file created from task 2 has the same data as the 1st file.
We now have to have a condition when to write to the 2nd file.

Create a condition that checks the {LOOP(CurrentValueXLine)} with the string value "Failed". Use the variale condition and set it to 'continue' on a match and 'next' when there is no match. Add this condition to the 2nd task and you're file write task only writes the failed jobs to a file.

Above is how it should word. I, however, did not get this to work. The condition gave me NoMatch all the time. I used 7.6.3 for this to check.
??Support??


Regards,
Erik



Did you check for Contains or Equal (as the line contains many other things).

Yes I did.
1st I used the check on the column and uses the is equal condition. That did not work. If I used the column in the file write and disabled the condition, the column info was there (Success/Not Set/Failed/etc).
2nd I used the whole line (CurrentValueXLine) and I used the contain option in the variable check. This also didn't gave me a match. And yes, there are failed jobs in my list, so there must me a match. I checked the case and they are the same.

Matching isn't working. Could it be something to do with the {file|content...)} meganism instead of using task output for looping?

Regards,
Erik



To avoid any confusion maybe it would be best if you could export the Task and send it to support@visualcron.com so we can reproduce it. Thanks
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
RMassey
2015-08-18T11:33:40Z
Thank you, ErikC! I was able to use your solution after a little bit of modification. It never would have occurred to me to write the job list to a file and read it with a loop. This is the first looped task I've created.

Instead of using a condition for the Write File task, I used this as the value:

{LOGIC(If|String|{STRING(GetColumn|1|4|;|{LOOP(CurrentValueXLine)})}|==|Failed|{LOOP(CurrentValueXLine)}
|)}

I'm using column 4 because my job report contains Job Name, Status, Next Run, Result, Status, Last Execution, Exec. Time, and Exit Code.

The line break after "CurrentValueXLine)}" is deliberate because I changed the Line break parameter to "NoLineBreak". The final file only contains failed jobs.

Thanks again!
Scroll to Top