Skip to contents

Create a "handle" for interacting with orderly repositories that are hosted at a different path. This might be useful in cases where you have access to an orderly repository via a network mount or a synchronised folder (e.g., Dropbox, Box, etc). More generally, orderly_remote_path implements an interface used by orderly to abstract over different ways that orderly repositories might be hosted remotely, including over HTTP APIs.

Usage

orderly_remote_path(path, name = NULL)

Arguments

path

Path to the orderly store

name

Name of the remote

Value

An orderly_remote_path object, with methods that orderly will use in order to control this remote

See also

orderly_pull_dependencies() and orderly_pull_archive(), which are the primary ways these remote objects are used. See also OrderlyWeb for a system for hosting orderly repositories over an HTTP API.

Examples

# Suppose we have a "remote" orderly repository at some path.
# This might be read-only for you in practice and available via a
# network filesystem or a dropbox folder synced to your computer.
# We'll populate this with a pair of reports:
path_remote <- orderly1::orderly_example("demo")
id <- orderly1::orderly_run("other", list(nmin = 0),
                           root = path_remote, echo = FALSE)
#> [ name       ]  other
#> [ id         ]  20250731-134551-67d96f79
#> [ sources    ]  functions.R
#> [ parameter  ]  nmin: 0
#> [ start      ]  2025-07-31 13:45:51.410966
#> [ data       ]  source => extract: 20 x 2
#> [ parameter  ]  nmin: 0
#> [ end        ]  2025-07-31 13:45:51.431656
#> [ elapsed    ]  Ran report in 0.02068973 secs
#> [ artefact   ]  summary.csv: 3fac8347e152c84c96e6676413c718b7
#> [ ...        ]  graph.png: 67b3e662440b3978ee78b9d4cc159884
orderly1::orderly_commit(id, root = path_remote)
#> [ commit     ]  other/20250731-134551-67d96f79
#> [ copy       ]
#> [ import     ]  other:20250731-134551-67d96f79
#> [ success    ]  :)
#> [1] "/tmp/Rtmp82yBdj/file1cbf13a66d58/archive/other/20250731-134551-67d96f79"
id <- orderly1::orderly_run("use_dependency",
                           root = path_remote, echo = FALSE)
#> [ name       ]  use_dependency
#> [ id         ]  20250731-134551-a02f6b4f
#> [ depends    ]  other@20250731-134551-67d96f79:summary.csv -> incoming.csv
#> [ start      ]  2025-07-31 13:45:51.628814
#> [ end        ]  2025-07-31 13:45:51.643488
#> [ elapsed    ]  Ran report in 0.0146749 secs
#> [ artefact   ]  graph.png: 67b3e662440b3978ee78b9d4cc159884
#> [ ...        ]  info.rds: 08057a6c48667b21478d8251978a899a
orderly1::orderly_commit(id, root = path_remote)
#> [ commit     ]  use_dependency/20250731-134551-a02f6b4f
#> [ copy       ]
#> [ import     ]  use_dependency:20250731-134551-a02f6b4f
#> [ success    ]  :)
#> [1] "/tmp/Rtmp82yBdj/file1cbf13a66d58/archive/use_dependency/20250731-134551-a02f6b4f"

# We'll create a an object to interact with this remote using
# orderly_remote_path.
remote <- orderly1::orderly_remote_path(path_remote)

# We can use this object directly
remote$list_reports()
#>  [1] "changelog"          "connection"         "default-param"     
#>  [4] "global"             "html"               "interactive"       
#>  [7] "minimal"            "multi-artefact"     "multifile-artefact"
#> [10] "other"              "slow1"              "slow10"            
#> [13] "slow3"              "spaces"             "use_dependency"    
#> [16] "use_dependency_2"   "use_resource"       "use_resource_dir"  
#> [19] "view"              
remote$list_versions("other")
#> [1] "20250731-134551-67d96f79"

# More typically one will interact with the functions
# orderly_pull_archive and orderly_pull_dependencies.

# Now, suppose that you have your "local" copy of this; it shares
# the same source (ordinarily these would both be under version
# control with git):
path_local <- orderly1::orderly_example("demo")

# If we wanted to run the report "use_dependency" we need to have
# a copy of the report "other", on which it depends:
try(orderly1::orderly_run("use_dependency", root = path_local))
#> [ name       ]  use_dependency
#> Error in orderly_find_report(id, name, config, draft = use_draft, must_work = TRUE) : 
#>   Did not find archive report other:latest

# We can "pull" dependencies of a report before running
orderly1::orderly_pull_dependencies("use_dependency", remote = remote,
                                   root = path_local)
#> [ depends    ]  use_dependency has 1 dependency
#> [ pull       ]  other:20250731-134551-67d96f79
#> [ import     ]  other:20250731-134551-67d96f79

# Now we can run the report because we have a local copy of the
# dependency:
orderly1::orderly_run("use_dependency", root = path_local)
#> [ name       ]  use_dependency
#> [ id         ]  20250731-134551-faa2673a
#> [ depends    ]  other@20250731-134551-67d96f79:summary.csv -> incoming.csv
#> [ start      ]  2025-07-31 13:45:51.982119
#> 
#> > d <- read.csv("incoming.csv", stringsAsFactors = FALSE)
#> 
#> > png("graph.png")
#> 
#> > par(mar = c(15, 4, 0.5, 0.5))
#> 
#> > barplot(setNames(d$number, d$name), las = 2)
#> 
#> > dev.off()
#> agg_record_562870578 
#>                    2 
#> 
#> > info <- orderly1::orderly_run_info()
#> 
#> > saveRDS(info, "info.rds")
#> [ end        ]  2025-07-31 13:45:51.997167
#> [ elapsed    ]  Ran report in 0.01504779 secs
#> [ artefact   ]  graph.png: 67b3e662440b3978ee78b9d4cc159884
#> [ ...        ]  info.rds: 32e91c2b85d0d760b62cf96698bdb7b2
#> [1] "20250731-134551-faa2673a"

# We can also directly pull previously run reports:
orderly1::orderly_pull_archive("use_dependency", id, remote = remote,
                              root = path_local)
#> [ pull       ]  use_dependency:20250731-134551-a02f6b4f
#> [ depends    ]  other/20250731-134551-67d96f79
#> [ pull       ]  other:20250731-134551-67d96f79 already exists, skipping
#> [ import     ]  use_dependency:20250731-134551-a02f6b4f
orderly1::orderly_list_archive(root = path_local)
#>             name                       id
#> 1          other 20250731-134551-67d96f79
#> 2 use_dependency 20250731-134551-a02f6b4f