def closed(self, code, reason):
        self.closed_code, self.closed_reason = code, reason

        if not (self.closed_code == 1000 or getattr(self.stream.closing, 'code', None) == 1000):
            try:
                error = json.loads(self.closed_reason)
                raise DXJobLogStreamingException("Error while streaming job logs: {type}: {message}\n".format(**error))
            except (__HOLE__, ValueError):
                error = "Error while streaming job logs: {code} {reason}\n".format(code=self.closed_code,
                                                                                   reason=self.closed_reason)
                raise DXJobLogStreamingException(error)
        elif self.print_job_info:
            if self.job_id not in self.seen_jobs:
                self.seen_jobs[self.job_id] = {}
            for job_id in self.seen_jobs.keys():
                self.seen_jobs[job_id] = dxpy.describe(job_id)
                print(get_find_executions_string(self.seen_jobs[job_id], has_children=False, show_outputs=True))
        else:
            self.seen_jobs[self.job_id] = dxpy.describe(self.job_id)

        if self.seen_jobs[self.job_id].get('state') in ['failed', 'terminated']:
            err_exit(code=3)
dataset/ETHPy150Open dnanexus/dx-toolkit/src/python/dxpy/utils/job_log_client.py/DXJobLogStreamClient.closed