无法在 RStudio 中将大型 ish .RDS 文件部署到 Shinyapp.io [英] Can't deploy large ish .RDS files to shinyapp.io in RStudio

查看:90
本文介绍了无法在 RStudio 中将大型 ish .RDS 文件部署到 Shinyapp.io的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从 RStudio 部署一个闪亮的应用程序.除了ui.r"和server.r"文件外,我还有 3 个 .RDS 文件(50kb、15mb 和 18mb),我在 server.r 文件中读取这些文件,它们在本地运行良好.当我开始上传时,它无法给出以下错误:

I'm trying to deploy a shiny app from RStudio. Along with the "ui.r" and "server.r" files, I have 3 .RDS files (50kb, 15mb and 18mb), which I read in server.r file, and they work fine locally. When I commence upload, it fails giving the following error:

Preparing to deploy application...DONE 
Uploading bundle for application: 794264...
Error in force(code) : Could not upload file. 
Calls: <Anonymous> -> withStatus -> force
Execution halted

我尝试选择 50kb 和 15mb 文件,这很有效.当我单独选择 18 mb 时它可以工作,但是当我选择所有三个时,它似乎不起作用.我将文件大小增加到大约.500 mb(最有可能缩小包大小),使用以下内容:

I tried selecting on the 50kb and 15mb file, that worked. When I select the 18 mb on its own it works, but when I select all the three of them, it doesn't seem to work. I increased the file size to approx. 500 mb (which was most likely downsizing the bundle size) using the following:

options(rsconnect.max.bundle.files = 500000000)

当我读到它时,它以字节为单位.

As I read it takes the value in bytes.

那是徒劳的.

我使用控制台进行部署:

I deployed using the console:

deployApp(appDir="Documents/GitHub/DataScience_JH_Coursera_Assignments/10.Capstone/shinyapp/PredictionText/",logLevel="verbose",lint=TRUE)

无济于事,但我设法将问题归零并得到以下日志:

To no avail, but I'm managed to zero in to the problematic line and I got the following log:

----- Deployment error -----
Error in force(code) : Could not upload file.

----- Error stack trace -----
4: stop("Could not upload file.")
3: force(code)
2: withStatus(paste0("Uploading bundle for ", assetTypeName, ": ", 
       application$id), {
       bundlePath <- bundleApp(target$appName, appDir, appFiles, 
           appPrimaryDoc, assetTypeName, contentCategory, verbose)
       if (isShinyapps(accountDetails)) {
           bundleSize <- file.info(bundlePath)$size
           checkSum <- md5sum(bundlePath)
           bundle <- client$createBundle(application$id, "application/x-tar", 
               bundleSize, checkSum)
           if (verbose) 
               timestampedLog("Starting upload now")
           if (!uploadBundle(bundle, bundleSize, bundlePath)) {
               stop("Could not upload file.")
           }
           if (verbose) 
               timestampedLog("Upload complete")
           response <- client$updateBundleStatus(bundle$id, status = "ready")
           bundle <- client$getBundle(bundle$id)
       }
       else {
           bundle <- client$uploadApplication(application$id, bundlePath)
       }
   })
1: deployApp(appDir = "Documents/GitHub/DataScience_JH_Coursera_Assignments/10.Capstone/shinyapp/PredictionText/", 
       logLevel = "verbose", lint = TRUE)

所以它在这里失败了,我假设:

So it's failing here, I'm assuming:

if (!uploadBundle(bundle, bundleSize, bundlePath)) {

仅供参考,我的包大小设置为大约 3GB,如果我在得到以下内容时正确进行了转换:

FYI my bundle size is set to approx 3gb, if I did the conversion right when I got the following:

getOption("rsconnect.max.bundle.size")
[1] 3145728000

我已经坚持了 5 天了.我阅读了我可以阅读的所有论坛,尝试单独上传文件,却发现 Shiny/rsconnect 似乎在此之前删除了实例,因此无法逐个上传文件.我什至试图弄乱 .dcf rsconnect 文件,但那里也没有.任何帮助/见解将不胜感激.

I've been stuck on this for 5 days now. I read all the forums I can read, tried uploading the files individually only to find that shiny/rsconnect seems to delete the instance before that, hence not being able to upload files one-by-one. I even try to mess with .dcf rsconnect file and nothing there too. Any help/insight would be much appreciated.

推荐答案

我已经设法解决了这个问题,因为我将 *.RDS 文件与 server.r 和 ui.r 放在同一个文件夹中文件.我只需要在与 *.r 文件相同的文件夹中创建一个名为data"的文件夹,然后将 *.RDS 文件转储到那里并上传工作.

I've managed to solve the problem, as it turns out I had the *.RDS files in the same folder as the server.r and ui.r files. I just needed to create a folder called "data" in the same folder as *.r files and dump the *.RDS files there and the upload work.

日志本来可以更清楚一点.

The logs could've been a bit more clear.

另外,不相关,但它确实有帮助,刷新缓存",导航到 rsconnect 和所有后续文件夹,直到到达您的 [appname].dcf 文件并删除该文件.

Also, not related, but it did help, to "flush the cache", navigate into the rsconnect and all subsequent folders till you reach your [appname].dcf file and delete that file.

这篇关于无法在 RStudio 中将大型 ish .RDS 文件部署到 Shinyapp.io的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆