Sry - sent email prematurely. You need to poll and read the stderr and stdout for text messages alerting there is an error. In python this is what I use:
def execute_hive_query(query, hive_exception = None): return_code = None cmd = ["hive","-S", "-e", query] proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) while return_code is None: time.sleep(10) return_code = proc.poll() out = proc.stdout.read() error = proc.stderr.read() handle_hive_exception(out,error,hive_exception) def handle_hive_exception(stdout,stderr,hive_exception = None): if hive_exception is not None: hive_exception(stdout,stderr) else: if stderr != '': stderr = stderr.lower() if stderr.find('error') > -1 or stderr.find('failed') >-1: if stderr.find('log4j:error could not find value for key log4j.appender.fa') == -1: raise Exception(stderr) return On Tue, Jul 16, 2013 at 8:03 PM, Brad Ruderman <bruder...@radiumone.com>wrote: > You need to stream and read the stderr and stdout for text messages > alerting there is an error. In python this is what I use: > > > On Tue, Jul 16, 2013 at 7:42 PM, kentkong_work <kentkong_w...@163.com>wrote: > >> ** >> hi, >> I use a shell script to run hive query in background, like this >> hive -e "select uname, age from usertable" >> result.csv & >> >> sometimes, the hive query failed, but I can't find. >> only thing I can do is waiting for long time, 5 or 6 hours, if I >> still can't see the result.csv, I know the query failed. >> is there some way to let hive tell me the query failed? >> >> >> Kent >> > >