Skip to contents

Set and get default remote locations. Default locations are specific to an orderly repository (based on the path of the repository) so there is no interaction between different orderly projects.

Usage

orderly_default_remote_set(value, root = NULL, locate = TRUE)

orderly_default_remote_get(root = NULL, locate = TRUE)

Arguments

value

A string describing a remote, a remote object, or NULL to clear

root

The path to an orderly root directory, or NULL (the default) to search for one from the current working directory if locate is TRUE.

locate

Logical, indicating if the configuration should be searched for. If TRUE and config is not given, then orderly looks in the working directory and up through its parents until it finds an orderly_config.yml file.

Value

The default remote (for orderly_default_remote_get). The function orderly_default_remote_set is called for its side effects only.

Examples

# Same setup as in orderly_remote_path, with a remote orderly:
path_remote <- orderly1::orderly_example("demo")
id <- orderly1::orderly_run("other", list(nmin = 0),
                           root = path_remote, echo = FALSE)
#> [ name       ]  other
#> [ id         ]  20250731-134544-3e294bb2
#> [ sources    ]  functions.R
#> [ parameter  ]  nmin: 0
#> [ start      ]  2025-07-31 13:45:44.248227
#> [ data       ]  source => extract: 20 x 2
#> [ parameter  ]  nmin: 0
#> [ end        ]  2025-07-31 13:45:44.268788
#> [ elapsed    ]  Ran report in 0.02056098 secs
#> [ artefact   ]  summary.csv: 3fac8347e152c84c96e6676413c718b7
#> [ ...        ]  graph.png: 67b3e662440b3978ee78b9d4cc159884
orderly1::orderly_commit(id, root = path_remote)
#> [ commit     ]  other/20250731-134544-3e294bb2
#> [ copy       ]
#> [ import     ]  other:20250731-134544-3e294bb2
#> [ success    ]  :)
#> [1] "/tmp/Rtmp82yBdj/file1cbf5fb1e2a5/archive/other/20250731-134544-3e294bb2"
id <- orderly1::orderly_run("use_dependency",
                           root = path_remote, echo = FALSE)
#> [ name       ]  use_dependency
#> [ id         ]  20250731-134544-7819606b
#> [ depends    ]  other@20250731-134544-3e294bb2:summary.csv -> incoming.csv
#> [ start      ]  2025-07-31 13:45:44.472306
#> [ end        ]  2025-07-31 13:45:44.490479
#> [ elapsed    ]  Ran report in 0.01817322 secs
#> [ artefact   ]  graph.png: 67b3e662440b3978ee78b9d4cc159884
#> [ ...        ]  info.rds: 506dec5bc1e66945c93a570a6b8bce0a
orderly1::orderly_commit(id, root = path_remote)
#> [ commit     ]  use_dependency/20250731-134544-7819606b
#> [ copy       ]
#> [ import     ]  use_dependency:20250731-134544-7819606b
#> [ success    ]  :)
#> [1] "/tmp/Rtmp82yBdj/file1cbf5fb1e2a5/archive/use_dependency/20250731-134544-7819606b"

# And a local orderly
path_local <- orderly1::orderly_example("demo")

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

# There is no remote set by default:
try(orderly1::orderly_default_remote_get(root = path_local))
#> Error in orderly1::orderly_default_remote_get(root = path_local) : 
#>   default remote has not been set yet: use 'orderly1::orderly_default_remote_set'

# We can set one:
orderly1::orderly_default_remote_set(remote, root = path_local)

# and now we can retrieve it:
orderly1::orderly_default_remote_get(root = path_local)
#> <orderly_remote_path>
#>   Public:
#>     bundle_import: function (path) 
#>     bundle_pack: function (name, parameters = NULL, instance = NULL) 
#>     clone: function (deep = FALSE) 
#>     config: orderly_config, R6
#>     initialize: function (path, name) 
#>     kill: function (...) 
#>     list_reports: function () 
#>     list_versions: function (name) 
#>     metadata: function (name, id) 
#>     name: /tmp/Rtmp82yBdj/file1cbf5fb1e2a5
#>     pull: function (name, id) 
#>     push: function (path) 
#>     run: function (...) 
#>     url_report: function (name, id) 

# Note that this has not affected the other orderly:
try(orderly1::orderly_default_remote_get(root = path_remote))
#> Error in orderly1::orderly_default_remote_get(root = path_remote) : 
#>   default remote has not been set yet: use 'orderly1::orderly_default_remote_set'