<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: LSF - automatic job rerun using sasbatch script in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/LSF-automatic-job-rerun-using-sasbatch-script/m-p/610242#M18063</link>
    <description>&lt;P&gt;What is causing your Oracle errors in the first place? How can you be sure that a re-run won't just give you the same errors?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the errors are caused by Oracle data not being available when it should be then a better approach might be to test this in your SAS program and keep looping until it is available within a certain time limit.&lt;/P&gt;</description>
    <pubDate>Sun, 08 Dec 2019 03:05:50 GMT</pubDate>
    <dc:creator>SASKiwi</dc:creator>
    <dc:date>2019-12-08T03:05:50Z</dc:date>
    <item>
      <title>LSF - automatic job rerun using sasbatch script</title>
      <link>https://communities.sas.com/t5/New-SAS-User/LSF-automatic-job-rerun-using-sasbatch-script/m-p/610208#M18055</link>
      <description>&lt;P&gt;Hello Dear Community!&lt;/P&gt;&lt;P&gt;I am trying to create an auto-rerun mechanism by implementing some code into sasbatch script after sascommand will finish. General idea is to:&lt;BR /&gt;1) locate a log of sas process and an id of the flow containing current job,&lt;BR /&gt;2) check if the log contains particular ORA-xxxxx errors,&lt;BR /&gt;3) if so, then trigger jrerun class from LSF Platform Command Line Interface,&lt;BR /&gt;4) exit sasbatch passing $rc to LSF&lt;/P&gt;&lt;P&gt;The idea was implemented as:&lt;/P&gt;&lt;PRE&gt;#define used paths
log_dir=/path/to/sas_logs_directory
out_log=/path/to/auto-rerun_log.txt
out_log2=/path/to/lsf_rerun_log.txt

if [ -n "${LSB_JOBNAME}"]; then
	if [ ! -f "$out_log"]; then
		touch $out_log
	fi
	#get flow runtime attributes
	IFS-: read -r flow_id username flow_name job_name &amp;lt;&amp;lt;&amp;lt; "${LSB_JOBNAME}"
	
	#find log of the current process
	log_path=$(ls -t $log_dir/*.log | xargs grep -li "job:\s*$job_name" | grep -i "/$flow_name_" | head -1)
	
	#set path to txt file containing lines which represents ORA errors we look for
	conf_path-/path/to/error_list
	
	#analyse process' log line by line
	while read -r line;
	do
		#if error is found in log then try to rerun flow
		if grep -q "$line" $log_path; then
			(nohup /path/to/rerun_script.sh $flow_id &amp;gt;$out_log2 2&amp;gt;&amp;amp;1) &amp;amp;
			disown
			break
		fi
	done &amp;lt; $conf_path
fi&lt;/PRE&gt;&lt;P&gt;While rerun_script is the script which calls jrerun class after sleep command - in order to let parent script exit $rc in the meanwhile. It looks like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;sleep 10
/some/lsf/path/jrerun&lt;/PRE&gt;&lt;P&gt;Problem is that job is running for the all time. In LSF history I can see that jrerun was called before job exited.&lt;BR /&gt;Furthermore in $out_log2 I can see message:&lt;/P&gt;&lt;PRE&gt;&amp;lt;flow_id&amp;gt; has no starting or exit points.&lt;/PRE&gt;&lt;P&gt;Do anyone have an idea how I can pass return code to LSF before jrerun calling? Or maybe some simplier way to perform autorerun of SAS jobs in Platform LSF?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using SAS 9.4 and Platform Process Manager 9.1&lt;BR /&gt;&lt;BR /&gt;Thank you for all your support,&lt;/P&gt;&lt;P&gt;Max.&lt;/P&gt;</description>
      <pubDate>Sat, 07 Dec 2019 17:43:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/LSF-automatic-job-rerun-using-sasbatch-script/m-p/610208#M18055</guid>
      <dc:creator>caeduspl</dc:creator>
      <dc:date>2019-12-07T17:43:49Z</dc:date>
    </item>
    <item>
      <title>Re: LSF - automatic job rerun using sasbatch script</title>
      <link>https://communities.sas.com/t5/New-SAS-User/LSF-automatic-job-rerun-using-sasbatch-script/m-p/610242#M18063</link>
      <description>&lt;P&gt;What is causing your Oracle errors in the first place? How can you be sure that a re-run won't just give you the same errors?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the errors are caused by Oracle data not being available when it should be then a better approach might be to test this in your SAS program and keep looping until it is available within a certain time limit.&lt;/P&gt;</description>
      <pubDate>Sun, 08 Dec 2019 03:05:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/LSF-automatic-job-rerun-using-sasbatch-script/m-p/610242#M18063</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2019-12-08T03:05:50Z</dc:date>
    </item>
    <item>
      <title>Re: LSF - automatic job rerun using sasbatch script</title>
      <link>https://communities.sas.com/t5/New-SAS-User/LSF-automatic-job-rerun-using-sasbatch-script/m-p/610277#M18067</link>
      <description>&lt;P&gt;Hello, thank you for your response.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This mechanism is designed for particular ORA errors we encounter that we know they can be resolver just by rerun. It is the mechanism just designed for them.&lt;/P&gt;</description>
      <pubDate>Sun, 08 Dec 2019 10:48:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/LSF-automatic-job-rerun-using-sasbatch-script/m-p/610277#M18067</guid>
      <dc:creator>caeduspl</dc:creator>
      <dc:date>2019-12-08T10:48:32Z</dc:date>
    </item>
    <item>
      <title>Re: LSF - automatic job rerun using sasbatch script</title>
      <link>https://communities.sas.com/t5/New-SAS-User/LSF-automatic-job-rerun-using-sasbatch-script/m-p/610322#M18076</link>
      <description>&lt;P&gt;If that is the case you could also check for that error in your SAS code and repeat the step. It might be easier than an LSF solution.&lt;/P&gt;</description>
      <pubDate>Sun, 08 Dec 2019 19:30:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/LSF-automatic-job-rerun-using-sasbatch-script/m-p/610322#M18076</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2019-12-08T19:30:58Z</dc:date>
    </item>
  </channel>
</rss>

