Export RMarkdown as PDF using Scenario

khoward88
khoward88 Registered Posts: 4

I am looking to create a scenario that will export an RMarkdown report as a PDF and save it to a managed folder. I can manually download the RMarkdown report as a PDF today by going into the report -> Actions -> Download so I figured this would be able to be done through scenarios. However, when I go to create a scenario and select "Export RMarkdown Report" as the step there is no option to select a destination folder.

I have done a similar setup with a dashboard but the "Export Dashboard" step for the scenarios allows you to select a destination folder.

I think it has to be saving a PDF somewhere when "Export RMarkdown Report" is ran because the viewer under Rmarkdown Reports -> My Report loads a PDF. I am just not sure where on the server this is being done or how to save it in a way I can access it.

Has anyone ran into this that would know a way to export the report in PDF format through a scenario?


Operating system used: Linux

Tagged:

Best Answer

  • khoward88
    khoward88 Registered Posts: 4
    Answer ✓

    Okay I think I figured something out that works for this. I will preface this solution with saying that we host in house so I don't think it would work in the cloud version. I found out that if in the scenario I do "send a message" as a step, I can attach an RMarkdown report to an email. This still didn't resolve my use case (without writing a bunch of code to connect to our mail server and pull the message) since I wanted to actually move the file. However, what I discovered is that doing the send a message step with attachment also generates the PDF (or whatever output you have the RMarkdown report set to) locally on the server in the path <dataiku install>/data_dir/code-reports/<project slug>/<report slug>/snapshots/ The name appears to be random but if you sort by timestamp you can find it.

    With this, I plan to setup a CRON job on the server to move any PDF that appears in that directory to the destination I want it.

    Not the best solution but hopefully that helps someone!

Setup Info
    Tags
      Help me…