DATA Step, Macro, Functions and more

Programmatically assess whether a LASR server is active

Reply
Contributor
Posts: 21

Programmatically assess whether a LASR server is active

Hello there,

 

I've written Base & Macro code to obtain from Metadata a list of LASR instances I'd like to start in anticipation of an outage this weekend. Whilst I don't doubt this will work, I do like to throw caution to the wind and program for all eventualities - such as the Macro failing half-way through, needing a restart, and then failing again because it tries to start a server that's already started.

 

So, a very high level view of the code is this:
- Obtain Metadata list of servers.

- Define variables like Port, Tag, LogDir

- ?????

- Start Server

- Check Server status

 

????? is the missing piece - this is where I'd like to check the server is active prior to trying to start it up. Is there a decent way of doing this, one that either tells me the server is alive, or, one that handles an ERROR: properly and doesn't kill the SAS code (sort of like On Error Goto Next in VBA).

 

i'd like to do this in SAS code to remove any issues that may come with the permissions and governance of the Unix file system.

 

 

Thanks in anticipation,

 

Dan

SAS Employee
Posts: 56

Re: Programmatically assess whether a LASR server is active


You might consider issuing a serverinfo action using the imstat procedure. If you get the servers status back you can assume its up.

http://support.sas.com/documentation/cdl/en/inmsref/70021/HTML/default/viewer.htm#n0kpeeuwv9vy29n1ic...

Contributor
Posts: 21

Re: Programmatically assess whether a LASR server is active

Posted in reply to SimonDawson

Thanks Simon, you're right of course, but it just forces an ERROR: when the server has been terminated and I was looking for a method that would maybe prompt a Boolean response, or would be handled without forcing an ERROR: into the log.

 

At this time, I'm just assigning a LIBNAME (that also returns an ERROR: if the server is down) and I then use an IFC statement to query the existence of the libref, which then allows me to conditionally set a macro variable as to the success or failure of the server startup.

 

I wonder, is there a standard macro variable like &syserr, &sysrc etc that'll tell me the result of the PROC LASR CREATE once it's completed? As I'm not in a position to 'break' the CREATE procedure, I wouldn't be able to test the sort of response codes I could expect should the procedure fail or complete properly.

Ask a Question
Discussion stats
  • 2 replies
  • 105 views
  • 0 likes
  • 2 in conversation