args: job_id: the id of the remote job response: log: log file
()
| 66 | 'GET', |
| 67 | ]) |
| 68 | def download_log(): |
| 69 | ''' |
| 70 | args: |
| 71 | job_id: the id of the remote job |
| 72 | response: |
| 73 | log: log file |
| 74 | ''' |
| 75 | try: |
| 76 | job_id = request.args['job_id'] |
| 77 | except: |
| 78 | return make_response( |
| 79 | jsonify(message="No job_id provided, please check your request."), |
| 80 | 400) |
| 81 | log_dir = current_app.config.get('LOG_DIR') |
| 82 | log_dir = os.path.expanduser(log_dir) |
| 83 | log_file_path = os.path.join(log_dir, job_id, 'stdout.log') |
| 84 | if not os.path.isfile(log_file_path): |
| 85 | return make_response( |
| 86 | jsonify(message="Log not exsits, please check your job_id"), 400) |
| 87 | else: |
| 88 | return send_file(log_file_path, as_attachment=True) |
| 89 | |
| 90 | |
| 91 | def send_heartbeat_addr_to_worker(worker_addr, heartbeat_server_addr): |