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

Turn off all deployment logs from deployApp #1051

Closed
alessap opened this issue Mar 11, 2024 · 3 comments · Fixed by #1064
Closed

Turn off all deployment logs from deployApp #1051

alessap opened this issue Mar 11, 2024 · 3 comments · Fixed by #1064
Assignees

Comments

@alessap
Copy link

alessap commented Mar 11, 2024

Hey,

Due to GDPR regulations and the likes, it is not allowed to show sensitive data in all the IT platforms and applications we use in our organization.
For this reason, we wish to completely turn off the logs from rsconnect::deployApp() with for example logLevel="quiet" such that potential sensitive data are not shown in the deployment on our platform. Often traceback error message spit out data used in the code, which might be sensitive data.

This seems to work correctly with knitr and R, however with quarto and python we still see the traceback from an error. We wish not to see these logs.

Best regards,
Alessandro

@alessap
Copy link
Author

alessap commented Apr 18, 2024

Is there any update regarding this issue?

@aronatkins aronatkins self-assigned this Apr 23, 2024
@aronatkins
Copy link
Contributor

Customer ticket 101818

@alessap - No updates to share at the moment, but I'll try to make time for this issue soon.

Have you considered capturing and discarding the output with capture.output()?

@aronatkins
Copy link
Contributor

Given any type of content, output from the deployment task is emitted to console, even with logLevel = "quiet". This was tested with Quarto+R, Quarto+Python, and R Markdown documents having both syntax errors and other runtime errors.

---
title: "Python syntax"
---

```{python}
1 + 1 +
```
---
title: "R syntax"
---

```{r}
1 + 1 +
```
---
title: "Python error"
---

```{python}
raise Exception("whoops")
```
---
title: "R error"
---

```{r}
stop("hammer time")
```

The R syntax and error examples were deployed as qmd and Rmd (rendering with Quarto and R Markdown, respectively).

When a Quarto + Python document contains an error (any type of rendering error, including a Python syntax error), that error is included in the deployment task output and emitted to console.

Part of that output could look like:

Executing 'syntax-py.ipynb'
  Cell 1/1: ''...

An error occurred while executing the following cell:
------------------
1 + 1 +
------------------


  Cell In[1], line 1
    1 + 1 +
           ^
SyntaxError: invalid syntax


Unable to render the deployed content: Rendering exited abnormally: exit status 1

When a Quarto + R document or an R Markdown output contains a similar error, that error is also included in the deployment task output and emitted to console.

Part of that output could look like (both Quarto+R and R Markdown output is similar):

processing file: syntax-r.qmd
1/3                  
2/3 [unnamed-chunk-1]



Quitting from lines 6-7 [unnamed-chunk-1] (syntax-r.qmd)
Error in `parse()`:
! <text>:2:0: unexpected end of input
1: 1 + 1 +
   ^
Backtrace:
  1. global .main()
  2. execute(...)
  3. rmarkdown::render(...)
  4. knitr::knit(knit_input, knit_output, envir = envir, quiet = quiet)
  5. knitr:::process_file(text, output)
     ...
 13. knitr:::eng_r(options)
 16. knitr (local) evaluate(...)
 17. evaluate::evaluate(...)
 19. evaluate:::parse_all.character(...)
 20. base::parse(text = x, srcfile = src)
Execution halted
Unable to render the deployed content: Rendering exited abnormally: exit status 1

In addition, a syntax error may also confuse renv while it is scanning for dependencies, producing output like:

WARNING: One or more problems were discovered while enumerating dependencies.

# /private/var/folders/f5/d_lvj8s17bx46zzhfr5gqywc0000gp/T/Rtmp5VZTQ2/file13527336ff1e8/syntax-r.qmd --------
Error: <text>:8:0: unexpected end of input
6: 1 + 1 +
7: 
  ^

Please see `?renv::dependencies` for more information.

When the Quarto + Python document produces an execution error, the error is included in the deployment task output and emitted to the console.

Part of this output could look like:

Executing 'error-py.ipynb'
  Cell 1/1: ''...

An error occurred while executing the following cell:
------------------
raise Exception("whoops")
------------------


---------------------------------------------------------------------------
Exception                                 Traceback (most recent call last)
Cell In[1], line 1
----> 1 raise Exception("whoops")

Exception: whoops

Stopped session pings to http://127.0.0.1:44537
An error occurred while running your content.
This link offers advice for this kind of error:
    https://docs.posit.co/connect/user/troubleshooting/#render-python-code-error
Unable to render the deployed content: An error occurred while running your content. (Error code: render-python-code-error)

When a Quarto + R or R Markdown document contains a similar runtime error, that error is included in the deployment task output and emitted to the console.

Part of that output could look like:

processing file: error-r.qmd
1/3                  
2/3 [unnamed-chunk-1]



Quitting from lines 6-7 [unnamed-chunk-1] (error-r.qmd)
Error:
! hammer time
Execution halted
Unable to render the deployed content: Rendering exited abnormally: exit status 1

In this case (runtime error, not a syntax error), there is no renv complaint ahead of deployment.

This testing indicates that we need two changes:

  1. suppress task output with logLevel = "quiet"
  2. suppress renv dependency errors with logLevel = "quiet"

Other than the renv warnings, there appears to be no difference in output for different types of content.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants