def get_completed_job(job_id): cmd = HiveCommand() cmd = cmd.find(job_id) print('Retrieving job:', job_id) if cmd.attributes.get('status', None) != 'done': raise ValueError('Job not yet completed') print('Job data successfully retrieved from Qubole') return cmd
def get_job_result(self, qubole_jid): """Finds and retrieves results for existing Qubole job. Args: id: qubole job id. Returns: Job stdout output. """ self._configure_qubole() qubole_jid = str(qubole_jid) return self._get_qubole_command_output(HiveCommand.find(qubole_jid))
def _get_logs(self, cmd): new_std_out = (cmd.get_log_partial()[0]).split('\n') for line in new_std_out[len(self.old_std_out):]: print(line) cmd = HiveCommand.find(cmd.id) self.old_std_out = new_std_out time.sleep(5) if cmd.attributes['status'] == 'error': raise RuntimeError('Job Failed') if cmd.attributes['status'] == 'cancelled': raise RuntimeError('Job Cancelled') return cmd