BookmarkSubscribeRSS Feed
rgreen33
Pyrite | Level 9

In SAS 9.4, I had all of my load jobs setup with code at the end to check the status...and email my admins when a load job failed.  Now that we have moved to SAS Viya, I am not seeing a good way to do this with jobs that are running via the scheduler in Environment Manager.  I have jobs that are loading data from Oracle and SQL Sever into CAS.  The status of the job is showing success.  However, if I did into the log files, I am seeing that occasionally, I have jobs that fail.  How can I capture these failures and send alerts that the failures occurred.  Has anyone come up with a solution for this?  I'm thinking that I may have to parse the individual log files...but how?

 

Thanks, 

Ricky

6 REPLIES 6
MarkBodt_NZ
Obsidian | Level 7

At a number of sites I've loaded data into CAS using Proc CASutil from a SAS 9.4 DI server. I've found that from time to time there are errors on the CAS side. While these appear in the SAS log they don't seem to throw an error condition at the SAS 9 side of things.

 

To work around this, I did exactly what you suggest "I'm thinking that I may have to parse the individual log files...but how?"

 

How? Well that's not too hard:

  • Build a filename with a timestamp. This will become the log filename
  • At the start of your job, assign the filename to a fileref
  • Next use proc printto to redirect your log to the log file
  • Do your processing
  • At the completion of the processing, redirect the log back i.e. proc printto log=log;
  • Parse the log...along the lines of:

 

*parse temp log;
data parselog;

infile CASLog eof = Done;
input;

put 'CAS Processing Log:' _Infile_ ;

 

 

if scan(left(_Infile_),1,':')='ERROR'
then do;

*error processing;
put "xxxxxxxxxxxxxxxxxxxxxxxx";



end;

run;

 

You could implement something similar in Viya:

1) build and test your job code in SAS StudioV, incorporate the log processing / error processing - you might want to code in an email step to alert you if you detect an error in the log.

2) create a job to call the code

3) schedule in Environment Manager

 

Mark

 

rgreen33
Pyrite | Level 9

@MarkBodt_NZ ,

 

Thank you for your reply.  All of my data loads straight from SQL Server or Oracle...no transformations needed.  Thus, I have everything setup as basic load jobs in the Viya scheduler (just copied and modified the sample load jobs provided by SAS).  When each of the jobs run, a log file is generated and is available via the Viya Environment Manager Schedule Monitoring interface.  From there, I can down the log files individually and look at them.  Unfortunately, the log file can contain and error from Oracle or SQL Server...but the status of the job in the Monitor is "Successful".  Thus, I need to capture the errors in these log files.  However, I do not know how to programmatically access these log files.  I understand the Studio jobs, as that is how I was loading my data in SAS 9.4...before moving to Viya.  Is there a way in SAS studio to reference (and scan) the log files that appear in the Viya Environment Manager Schedule Monitoring interface?

 

Thanks,

Ricky

Patrick
Opal | Level 21

@rgreen33 

Someone here in the forums might be able to give you further guidance but from what you describe I'd also suggest that you raise this with SAS Tech Support. 

From the looks of it error conditions from a  DB don't get passed to Viya - or Viya is "ignoring" them. Any log parsing is imho just a work around and what you (and likely all of us) would want is for such error conditions to also get captured and show up on the Viya side as actual job execution error conditions.

SASKiwi
PROC Star

@rgreen33  - Would be useful to know what SAS Viya version this applies to as well, given the rapid development schedule of the product.

SASKiwi
PROC Star

@rgreen33  - Have you tracked this issue to SAS Tech Support? To me this appears to be a Viya deficiency. Having to build extra workarounds as the Viya scheduler does not detect all job errors is not a great solution.  

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

Discussion stats
  • 6 replies
  • 1813 views
  • 0 likes
  • 4 in conversation