def view(run_id): run = context.instance.get_run_by_id(run_id) debug_payload = DebugRunPayload.build(context.instance, run) check.invariant(run is not None) out_name = "{}.gzip".format(run_id) result = io.BytesIO() with gzip.GzipFile(fileobj=result, mode="wb") as file: debug_payload.write(file) result.seek(0) # be kind, please rewind return send_file(result, as_attachment=True, attachment_filename=out_name)
async def download_debug_file_endpoint(self, request: Request): run_id = request.path_params["run_id"] context = self.make_request_context(request) run = context.instance.get_run_by_id(run_id) debug_payload = DebugRunPayload.build(context.instance, run) result = io.BytesIO() with gzip.GzipFile(fileobj=result, mode="wb") as file: debug_payload.write(file) result.seek(0) # be kind, please rewind return StreamingResponse(result, media_type="application/gzip")
def export_command(run_id, output_file): with DagsterInstance.get() as instance: run = instance.get_run_by_id(run_id) if run is None: raise click.UsageError( "Could not find run with run_id '{}'.\n{}".format( run_id, _recent_failed_runs_text(instance))) debug_payload = DebugRunPayload.build(instance, run) with GzipFile(output_file, "wb") as file: click.echo("Exporting run_id '{}' to gzip output file {}.".format( run_id, output_file)) debug_payload.write(file)
def export_run(instance, run, output_file): debug_payload = DebugRunPayload.build(instance, run) with GzipFile(output_file, "wb") as file: click.echo("Exporting run_id '{}' to gzip output file {}.".format( run.run_id, output_file)) debug_payload.write(file)