使用Cloud Foundry在Bluemix上部署Shiny应用程序的CF_STAGING_TIMEOUT

时间:2017-10-24 21:40:40

标签: r shiny ibm-cloud cloudfoundry

我有一个Shiny应用程序在本地运行,我正在努力使用Cloud Foundry将其部署到Bluemix。我正在使用this buildpack

应用程序构建的默认暂存时间是15分钟,但这不足以安装R和我的应用程序所需的软件包。如果我尝试使用默认值推送我的应用程序,我会收到一个关于时间不足的错误:

Error restarting application: sherlock-topics failed to stage within 15.000000 minutes

我更改了manifest.yml以增加暂存时间:

applications:  
- name: sherlock-topics
  memory: 728M
  instances: 1
  buildpack: git://github.com/beibeiyang/cf-buildpack-r.git
  env:
    CRAN_MIRROR: https://cran.rstudio.com
    CF_STAGING_TIMEOUT: 45
    CF_STARTUP_TIMEOUT: 9999

然后我在推送之前也改变了CLI的暂存时间:

cf set-env sherlock-topics CF_STAGING_TIMEOUT 45
cf push sherlock-topics

然后,应用程序尝试部署。它在容器中安装R并安装包,但仅持续约15分钟(稍长一点)。当它在15分钟标记之后到达第一个新任务(包)时,它会出错,但会出现一个不同的,令人遗憾的错误消息。

Staging failed
Destroying container
Successfully destroyed container

FAILED
Error restarting application: StagingError

日志中没有任何内容,但有关正在安装的库的信息,然后是Staging failed

关于为什么即使在我增加CF_STAGING_TIMEOUT之后它还没有继续超过15分钟标记的任何想法?

2 个答案:

答案 0 :(得分:2)

平台操作员控制分段超时和应用程序启动超时的硬限制。 library(data.table) DT <- data.table(Date = as.Date(c("2015-10-01","2015-10-25","2015-11-04","2015-11-06")), hour = c("AM","PM","AM","PM"), factor1 = c("A","B","C","D"), volume = c(1,2,3,4)) ## Create a regular sequence of all dates in range ## with a row for each combo of hour and factor1 TS <- CJ(Date = seq.Date(from = DT[,min(Date)], to = DT[,max(Date)],by = "day"), hour = DT[,unique(hour)], factor1 = DT[,unique(factor1)]) ## Join the data to this expanded time series setkey(DT,Date,hour,factor1) setkey(TS,Date,hour,factor1) TS <- DT[TS] ## Fill with zeros if necessary TS[is.na(volume), volume := 0] ## If you want a separate column for factor level Wide <- dcast(TS, ... ~ factor1, value.var = "volume") ## Or if you want a column (time series) for each combo VeryWide <- dcast(TS, ... ~ factor1 + hour, value.var = "volume") CF_STAGING_TIMEOUT是cf cli配置选项,告诉cli等待暂存和应用启动的时间。

请参阅此处的文档以供参考:

https://docs.cloudfoundry.org/devguide/deploy-apps/large-app-deploy.html#consid_limits

作为最终用户,您无法超越平台运营商实施的硬限制。

答案 1 :(得分:1)

我遇到了同样的问题。我还尝试部署一个带有大量依赖项的 ShinyR 应用。

诀窍是将 num_threads 属性添加到 r.yml 文件。这肯定会加快构建时间。

这是一个可能的样子:

packages:
 - packages: 
    - name: bupaR
    - name: edeaR
   num_threads: 8

查看https://docs.cloudfoundry.org/buildpacks/r/index.html了解更多信息