Is there a way to run an R script with a specified environment (snapshot) and instance type?

Comments

4 comments

  • Comment author
    Former User of DNAx Community_13

    To clarify - a way to run an Rscript from bash terminal in RAP.

    0
  • Comment author
    Chai Fungtammasan DNAnexus Team

    There are some approaches I tried before, but I am also welcome other community members to step in if there is a better method.

     

    1) use dx-create-snapshot within cloud_workstation to save the environment after you set it up.

     

    2) Containerize the Rscript inside the Docker and run it as Docker.

     

    The first approach would work in interactive mode, while the second would work in non-interactive job submission. I think the second one if what you are looking for.

     

    On your point about instance type, there isn't a way to fix certain analysis on particular instance type. You can set the default instance type when you build the applet, but the user would be able to change it. See the note on how to develop applet here.

     

    https://documentation.dnanexus.com/getting-started/developer-quickstart

    0
  • Comment author
    Former User of DNAx Community_13

    Thanks Chai! I'm encountering an odd issue setting up a Docker image, when trying to build on top of the r-base image, I get the following error:

     

    image

    0
  • Comment author
    Chai Fungtammasan DNAnexus Team

    Do you want to run R interactively? If that is the case, do you want to develop the script in Rstudio instead? We have it available on our platform and the tutorial by our R expert here.

    I tried to reproduce the error you got and I got the exact same thing. I'm not sure what's going on. Maybe it is related to entrypoint, path, or something.

    What I normally use when run R as a script would be binary Rscript though, not the R. I call the R binary when I want to run something interactively, but Rstudio would be better in such case.

    Here is my flow to figure out where is Rscript inside the Docker.

    1) running cloud workstation or ttyd

    2) inside cloud workeer, pull docker image

    docker pull r-base

    3) use bash in interactive mode to inspect docker

    docker run -it --rm r-base:latest bin/bash

    4) inside docker, you can check location of binary

    find . -name "Rscript"

    you would get

    ./usr/bin/Rscript

    ./usr/lib/R/bin/Rscript

    5) after knowing where it is, you can then call Rscript directly

    ./usr/bin/Rscript

     

    We will have Docker webinar coming soon, and you might enjoy some of it too.

     

     

    0

Please sign in to leave a comment.