是什么创建了“libloc_%2f...Builts.rds” R 中的临时文件?

发布于 2024-12-05 22:21:53 字数 2844 浏览 0 评论 0原文

我正在 R 中运行一个经常重新启动的服务器进程,并且使用许多 R 包。现在,每次重新启动都会创建一个临时目录,其中包含几个扩展名为“rds”的文件。我真的很想知道哪个 R 包或功能会导致创建这些 .rds 文件(这样我就可以禁用它)。谢谢!

文件名如下所示:

libloc_%2fusr%2flib%2fR%2flibraryVersion,Priority,Depends,Imports,LinkingTo,Suggests,Enhances,OS_type,License,Archs,Built.rds

内容的开头如下所示:

      [,1]         [,2]                 [,3]          [,4]          [,5]                                              
 [1,] "KernSmooth" "/usr/lib/R/library" "2.23-6"      "recommended" "R (>= 2.5.0), stats"                             
 [2,] "MASS"       "/usr/lib/R/library" "7.3-13"      "recommended" "R (>= 2.13.0), grDevices, graphics, stats, utils"
 [3,] "Matrix"     "/usr/lib/R/library" "0.999375-50" "recommended" "R (>= 2.10.0), stats, methods, utils, lattice"   
 [4,] "base"       "/usr/lib/R/library" "2.13.0"      "base"        NA                                                
 [5,] "class"      "/usr/lib/R/library" "7.3-2"       "recommended" "R (>= 2.5.0), stats, utils"                      
 [6,] "compiler"   "/usr/lib/R/library" "2.13.0"      "base"        NA                                                
 [7,] "datasets"   "/usr/lib/R/library" "2.13.0"      "base"        NA                                                
 [8,] "grDevices"  "/usr/lib/R/library" "2.13.0"      "base"        NA                                                
 [9,] "graphics"   "/usr/lib/R/library" "2.13.0"      "base"        NA                                                
[10,] "grid"       "/usr/lib/R/library" "2.13.0"      "base"        NA                                                
[11,] "lattice"    "/usr/lib/R/library" "0.19-26"     "recommended" "R (>= 2.11.0)"                                   
[12,] "methods"    "/usr/lib/R/library" "2.13.0"      "base"        NA                                                
[13,] "nnet"       "/usr/lib/R/library" "7.3-1"       "recommended" "R (>= 2.5.0), stats, utils"                      
[14,] "spatial"    "/usr/lib/R/library" "7.3-2"       "recommended" "R (>= 2.5.0), graphics, stats, utils"            
[15,] "splines"    "/usr/lib/R/library" "2.13.0"      "base"        NA                                                
[16,] "stats"      "/usr/lib/R/library" "2.13.0"      "base"        NA                                                
[17,] "stats4"     "/usr/lib/R/library" "2.13.0"      "base"        "methods, graphics, stats"                        
[18,] "tcltk"      "/usr/lib/R/library" "2.13.0"      "base"        NA                                                
[19,] "tools"      "/usr/lib/R/library" "2.13.0"      "base"        NA                                                
[20,] "utils"      "/usr/lib/R/library" "2.13.0"      "base"        NA                                                

I'm running a server process in R that is restarted often, and which uses many R packages. Right now, each restart creates a temporary directory that contains a couple of files with the "rds" extension. I'd really like to know which R package or feature causes these .rds files to be created (so I can disable that). Thanks!

The filenames look like this:

libloc_%2fusr%2flib%2fR%2flibraryVersion,Priority,Depends,Imports,LinkingTo,Suggests,Enhances,OS_type,License,Archs,Built.rds

and the beginning of the content look like this:

      [,1]         [,2]                 [,3]          [,4]          [,5]                                              
 [1,] "KernSmooth" "/usr/lib/R/library" "2.23-6"      "recommended" "R (>= 2.5.0), stats"                             
 [2,] "MASS"       "/usr/lib/R/library" "7.3-13"      "recommended" "R (>= 2.13.0), grDevices, graphics, stats, utils"
 [3,] "Matrix"     "/usr/lib/R/library" "0.999375-50" "recommended" "R (>= 2.10.0), stats, methods, utils, lattice"   
 [4,] "base"       "/usr/lib/R/library" "2.13.0"      "base"        NA                                                
 [5,] "class"      "/usr/lib/R/library" "7.3-2"       "recommended" "R (>= 2.5.0), stats, utils"                      
 [6,] "compiler"   "/usr/lib/R/library" "2.13.0"      "base"        NA                                                
 [7,] "datasets"   "/usr/lib/R/library" "2.13.0"      "base"        NA                                                
 [8,] "grDevices"  "/usr/lib/R/library" "2.13.0"      "base"        NA                                                
 [9,] "graphics"   "/usr/lib/R/library" "2.13.0"      "base"        NA                                                
[10,] "grid"       "/usr/lib/R/library" "2.13.0"      "base"        NA                                                
[11,] "lattice"    "/usr/lib/R/library" "0.19-26"     "recommended" "R (>= 2.11.0)"                                   
[12,] "methods"    "/usr/lib/R/library" "2.13.0"      "base"        NA                                                
[13,] "nnet"       "/usr/lib/R/library" "7.3-1"       "recommended" "R (>= 2.5.0), stats, utils"                      
[14,] "spatial"    "/usr/lib/R/library" "7.3-2"       "recommended" "R (>= 2.5.0), graphics, stats, utils"            
[15,] "splines"    "/usr/lib/R/library" "2.13.0"      "base"        NA                                                
[16,] "stats"      "/usr/lib/R/library" "2.13.0"      "base"        NA                                                
[17,] "stats4"     "/usr/lib/R/library" "2.13.0"      "base"        "methods, graphics, stats"                        
[18,] "tcltk"      "/usr/lib/R/library" "2.13.0"      "base"        NA                                                
[19,] "tools"      "/usr/lib/R/library" "2.13.0"      "base"        NA                                                
[20,] "utils"      "/usr/lib/R/library" "2.13.0"      "base"        NA                                                

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

初心 2024-12-12 22:21:53

它看起来像由 installed.packages() 创建的文件。检查该函数的来源。

也许您在启动配置文件中调用了它(例如会话启动时的 update.packages() )?

您可以启用对 saveRDS 函数的跟踪,例如添加到 .Rprofile:

trace("saveRDS", function() print(str(head(sys.calls(),-5))))

这将打印(您也可以将其转储到文件中)调用堆栈,例如当我运行 update.packages(ask=' 时Graphics') 然后在控制台上我得到:

Tracing saveRDS(res0, dest, compress = TRUE) on entry 
List of 3
 $ : language update.packages(ask = "graphics")
 $ : language available.packages(contriburl = contriburl, method = method)
 $ : language saveRDS(res0, dest, compress = TRUE)
NULL
Tracing saveRDS(res0, dest, compress = TRUE) on entry 
List of 3
 $ : language update.packages(ask = "graphics")
 $ : language available.packages(contriburl = contriburl, method = method)
 $ : language saveRDS(res0, dest, compress = TRUE)
# ..... and few more calls ...............

It looks like file created by installed.packages(). Check source of this function.

Maybe you have call to it in startup profile (e.g. update.packages() on session start)?

You could enable tracing of saveRDS function, e.g. add to .Rprofile:

trace("saveRDS", function() print(str(head(sys.calls(),-5))))

This will print (you could dump it into file also) call stack, e.g. when I run update.packages(ask='graphics') then on console I got:

Tracing saveRDS(res0, dest, compress = TRUE) on entry 
List of 3
 $ : language update.packages(ask = "graphics")
 $ : language available.packages(contriburl = contriburl, method = method)
 $ : language saveRDS(res0, dest, compress = TRUE)
NULL
Tracing saveRDS(res0, dest, compress = TRUE) on entry 
List of 3
 $ : language update.packages(ask = "graphics")
 $ : language available.packages(contriburl = contriburl, method = method)
 $ : language saveRDS(res0, dest, compress = TRUE)
# ..... and few more calls ...............
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文