Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Have an option to save output of greta installation process to a single log file #493

Closed
njtierney opened this issue Feb 14, 2022 · 2 comments · Fixed by #683
Closed

Have an option to save output of greta installation process to a single log file #493

njtierney opened this issue Feb 14, 2022 · 2 comments · Fixed by #683

Comments

@njtierney
Copy link
Collaborator

something like

greta_install_deps(write_logfile = TRUE, logfile_path = NULL)

Which then saves the logfile to something like: "greta-logfile-YYYY-MM-DD.md"

The .md file has HTML "details" tags that might looks like this

miniconda installation heaps and heaps of stuff
"greta-env" creation heaps more stuff
"python dependencies" installation heaps more stuff
@njtierney njtierney added this to the 0.4.2 milestone Feb 14, 2022
@njtierney njtierney added Up Next and removed Up Next labels Mar 28, 2022
@njtierney njtierney modified the milestones: 0.5.0, 0.6.0 Feb 8, 2023
@njtierney
Copy link
Collaborator Author

njtierney commented Mar 1, 2024

Or alternatively provide a function that writes out all of the notes files.

Something like the following works - although there's probably a better way using {whiskers} or {epoxy} or other log file systems

summary_details <- function(summary, code) {
  # capture code but don't run it
  glue::glue(
    "
    <details>
      <summary>
        [summary]
      </summary>
  ```
        {[code]}
  ```
    </details>
  ",
    .open = "[",
    .close = "]"
  )
}

greta_install_summary_conda_error <- summary_details(
  "Conda create error",
  ".internals$greta_stash$conda_create_error"
)
greta_install_summary_conda_output <- summary_details(
  "Conda create output",
  ".internals$greta_stash$conda_create_notes"
)
greta_install_summary_conda_install_error <- summary_details(
  "Conda install error",
  ".internals$greta_stash$conda_install_error"
)
greta_install_summary_conda_install_notes <- summary_details(
  "Conda install notes",
  ".internals$greta_stash$conda_install_notes"
)
greta_install_summary_miniconda_error <- summary_details(
  "Miniconda install error",
  ".internals$greta_stash$miniconda_error"
)
greta_install_summary_miniconda_notes <- summary_details(
  "Miniconda install notes",
  ".internals$greta_stash$miniconda_notes"
)

greta_install_notes <- glue::glue_collapse(
  x = c(
    "# Greta installation notes",
    greta_install_summary_conda_error,
    greta_install_summary_conda_output,
    greta_install_summary_conda_install_error,
    greta_install_summary_conda_install_notes,
    greta_install_summary_miniconda_error,
    greta_install_summary_miniconda_notes
  ),
  sep = "\n\n"
)

glue::glue(greta_install_notes) %>% 
  readr::write_lines(file = "~/Downloads/greta-log.md")

rmarkdown::render("~/Downloads/greta-log.md")

@njtierney
Copy link
Collaborator Author

Which yields:

image

@njtierney njtierney moved this from Backlog to Weekly Todo in {greta} CRAN 0.5.0 release Aug 5, 2024
njtierney added a commit to njtierney/greta that referenced this issue Aug 8, 2024
…es them defunct.

* Added option to write to a single logfile with `greta_set_install_logfile()`, and `write_greta_install_log()`. (greta-dev#493)
* Added `destroy_greta_deps()` function to remove miniconda and python conda environment
@github-project-automation github-project-automation bot moved this from In Progress to Done in {greta} CRAN 0.5.0 release Aug 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

1 participant