Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename from orderly to orderly1 #129

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/R-CMD-check-mac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
steps:
- uses: actions/checkout@v2

- uses: r-lib/actions/setup-r@v1
- uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.config.r }}

Expand Down
11 changes: 6 additions & 5 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: orderly.server
Title: Serve Orderly
Version: 0.3.31
Version: 0.3.32
Description: Run orderly reports as a server.
License: MIT + file LICENSE
Author: Rich FitzJohn
Expand All @@ -13,11 +13,11 @@ Imports:
ids,
jsonlite,
lgr,
orderly (>= 1.4.10),
orderly1 (>= 1.7.0),
porcelain (>= 0.1.9),
processx,
redux,
rrq (>= 0.6.0),
rrq (>= 0.7.1),
utils,
yaml
Suggests:
Expand All @@ -30,9 +30,10 @@ Suggests:
testthat,
withr,
zip
RoxygenNote: 7.2.0
RoxygenNote: 7.2.3
Encoding: UTF-8
Remotes:
mrc-ide/rrq,
reside-ic/porcelain,
ropensci/jsonvalidate,
vimc/orderly
orderly1=vimc/orderly@vimc-7135
34 changes: 17 additions & 17 deletions R/api.R
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ target_git_fetch <- function(runner) {
path <- runner$root
res <- git_fetch(path)
if (length(res$output) > 0L) {
orderly::orderly_log("fetch", res$output)
orderly1::orderly_log("fetch", res$output)
}
res$output
}
Expand All @@ -102,7 +102,7 @@ endpoint_git_fetch <- function(runner) {
target_git_pull <- function(runner) {
res <- git_pull(runner$root)
if (length(res$output) > 0L) {
orderly::orderly_log("pull", res$output)
orderly1::orderly_log("pull", res$output)
}
res$output
}
Expand Down Expand Up @@ -198,8 +198,8 @@ target_bundle_pack <- function(path, name, parameters = NULL,
if (!is.null(parameters)) {
parameters <- jsonlite::fromJSON(parameters)
}
res <- orderly::orderly_bundle_pack(tempfile(), name, parameters, root = path,
instance = instance)
res <- orderly1::orderly_bundle_pack(tempfile(), name, parameters,
root = path, instance = instance)
on.exit(unlink(res$path))
bytes <- readBin(res$path, "raw", n = file.size(res$path))
bytes <- porcelain::porcelain_add_headers(
Expand All @@ -221,7 +221,7 @@ target_bundle_import <- function(path, data) {
data_path <- tempfile(fileext = ".zip")
on.exit(unlink(data_path))
writeBin(data, data_path)
orderly::orderly_bundle_import(data_path, root = path)
orderly1::orderly_bundle_import(data_path, root = path)
scalar(TRUE)
}

Expand All @@ -237,7 +237,7 @@ endpoint_bundle_import <- function(path, data) {
}

target_report_info <- function(runner, id, name) {
info <- orderly::orderly_info(id, name, root = runner$root)
info <- orderly1::orderly_info(id, name, root = runner$root)
info <- recursive_scalar(info)
## Rename parameters to params for consistency with rest of API
info <- append(info, list(params = info$parameters))
Expand Down Expand Up @@ -483,7 +483,7 @@ check_timeout <- function(runner, rate_limit = 2 * 60) {
}

target_report_version_artefact_hashes <- function(path, name, id) {
db <- orderly::orderly_db("destination", root = path)
db <- orderly1::orderly_db("destination", root = path)
get_report_version(db, name, id)
sql <- paste(
"select",
Expand Down Expand Up @@ -512,7 +512,7 @@ target_reports <- function(path, reports = NULL) {
if (!is.null(reports)) {
reports <- unlist(strsplit(reports, split = ","))
}
db <- orderly::orderly_db("destination", root = path)
db <- orderly1::orderly_db("destination", root = path)
get_all_reports(db, reports)
}

Expand All @@ -526,7 +526,7 @@ endpoint_reports <- function(path) {
}

target_report_versions <- function(path, name) {
db <- orderly::orderly_db("destination", root = path)
db <- orderly1::orderly_db("destination", root = path)
sql <- paste(
"select report_version.id",
"from report_version",
Expand All @@ -551,7 +551,7 @@ endpoint_report_versions <- function(path) {
}

target_report_version_details <- function(path, name, id) {
db <- orderly::orderly_db("destination", root = path)
db <- orderly1::orderly_db("destination", root = path)
report_version <- get_report_version(db, name, id)
artefacts <- get_artefacts_for_version(db, id)
parameters <- get_parameters_for_versions(db, id)
Expand Down Expand Up @@ -586,7 +586,7 @@ endpoint_report_version_details <- function(path) {
}

target_report_versions_custom_fields <- function(path, versions) {
db <- orderly::orderly_db("destination", root = path)
db <- orderly1::orderly_db("destination", root = path)
get_custom_fields_for_versions(db, unlist(strsplit(versions, split = ",")))
}

Expand All @@ -600,7 +600,7 @@ endpoint_report_versions_custom_fields <- function(path) {
}

target_custom_fields <- function(path) {
db <- orderly::orderly_db("destination", root = path)
db <- orderly1::orderly_db("destination", root = path)

sql <- paste(
"select custom_fields.id",
Expand All @@ -619,7 +619,7 @@ endpoint_custom_fields <- function(path) {
}

target_report_versions_params <- function(path, versions) {
db <- orderly::orderly_db("destination", root = path)
db <- orderly1::orderly_db("destination", root = path)
get_parameters_for_versions(db, unlist(strsplit(versions, split = ",")))
}

Expand All @@ -633,7 +633,7 @@ endpoint_report_versions_params <- function(path) {
}

target_report_version_data_hashes <- function(path, name, id) {
db <- orderly::orderly_db("destination", root = path)
db <- orderly1::orderly_db("destination", root = path)
get_report_version(db, name, id)
sql <- paste(
"select",
Expand All @@ -657,7 +657,7 @@ endpoint_report_version_data_hashes <- function(path) {
}

target_report_version_resource_hashes <- function(path, name, id) {
db <- orderly::orderly_db("destination", root = path)
db <- orderly1::orderly_db("destination", root = path)
get_report_version(db, name, id)
sql <- paste(
"select",
Expand Down Expand Up @@ -685,7 +685,7 @@ target_report_version_changelog <- function(path,
name,
id,
public_only = FALSE) {
db <- orderly::orderly_db("destination", root = path)
db <- orderly1::orderly_db("destination", root = path)
version <- get_report_version(db, name, id)
if (public_only) {
version_field <- "changelog.report_version_public"
Expand Down Expand Up @@ -743,7 +743,7 @@ build_version <- function(v, custom_fields, params) {
}

target_all_versions <- function(path) {
db <- orderly::orderly_db("destination", root = path)
db <- orderly1::orderly_db("destination", root = path)
versions <- get_all_versions(db)
custom_fields <- get_custom_fields_for_versions(db, versions$id)
params <- get_parameters_for_versions(db, versions$id)
Expand Down
2 changes: 1 addition & 1 deletion R/backup.R
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ orderly_backup_ <- R6::R6Class(
}
now <- Sys.time()
message(sprintf("%s - Backing up orderly db", now))
orderly:::orderly_backup(self$config)
orderly1:::orderly_backup(self$config)
self$last_backup <- now
invisible(TRUE)
}
Expand Down
2 changes: 1 addition & 1 deletion R/dependencies.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
get_dependencies <- function(path, name, id,
direction, propagate, max_depth, show_all, use) {
report_tree <- orderly::orderly_graph(name = name, id = id,
report_tree <- orderly1::orderly_graph(name = name, id = id,
root = path, locate = FALSE,
direction = direction,
propagate = propagate,
Expand Down
8 changes: 4 additions & 4 deletions R/git.R
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,13 @@ git_checkout_branch <- function(name, force = FALSE, root = NULL,
## ^ this does not return anything sensible when we were in
## detached head state; detect HEAD and get the hash perhaps?
args <- c("checkout", if (create) "-b", name)
orderly::orderly_log("git", sprintf("checkout %s; was %s", name, prev))
orderly1::orderly_log("git", sprintf("checkout %s; was %s", name, prev))
git_run(args, root = root, check = TRUE)
prev
}

git_clone_local <- function(source, destination = NULL) {
orderly::orderly_log("git", "clone")
orderly1::orderly_log("git", "clone")
if (!length(destination)) {
destination <- tempfile()
dir_create(destination)
Expand All @@ -83,12 +83,12 @@ git_clone_local <- function(source, destination = NULL) {
}

git_fetch <- function(root = NULL) {
orderly::orderly_log("git", "fetch")
orderly1::orderly_log("git", "fetch")
git_run("fetch", root = root, check = TRUE)
}

git_pull <- function(root = NULL) {
orderly::orderly_log("git", "pull")
orderly1::orderly_log("git", "pull")
git_run("pull", root = root, check = TRUE)
}

Expand Down
4 changes: 2 additions & 2 deletions R/main.R
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ main_worker <- function(args = commandArgs(TRUE)) {
# nocov start
args <- main_worker_args(args)
wait_for_go_signal(NULL, args$go_signal)
w <- rrq::rrq_worker_from_config(orderly_queue_id(args$queue_id, TRUE),
timeout = 30)
w <- rrq::rrq_worker(orderly_queue_id(args$queue_id, TRUE),
timeout_config = 30)
w$loop()
invisible(TRUE)
# nocov end
Expand Down
17 changes: 9 additions & 8 deletions R/runner.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
##' @examples
##' available <- redux::redis_available()
##' if (available) {
##' path <- orderly:::prepare_orderly_git_example()
##' path <- orderly1:::prepare_orderly_git_example()
##' runner <- orderly.server::orderly_runner(path[["local"]], workers = 0)
##' }
orderly_runner <- function(path, identity = NULL, queue_id = NULL,
Expand All @@ -41,7 +41,7 @@ runner_run <- function(key_report_id, key, root, name, parameters, instance,
dir.create(bin)
orderly_bin <- write_script(
bin,
readLines(system.file("script", package = "orderly", mustWork = TRUE)),
readLines(system.file("script", package = "orderly1", mustWork = TRUE)),
versioned = TRUE)
id_file <- path_id_file(root, key)
if (!is.null(parameters)) {
Expand Down Expand Up @@ -161,12 +161,12 @@ orderly_runner_ <- R6::R6Class(
workers, cleanup_on_exit = workers > 0,
worker_timeout = Inf) {
if (is.null(identity)) {
self$config <- orderly::orderly_config(root)
self$config <- orderly1::orderly_config(root)
} else {
self$identity <- identity
self$config <- withr::with_envvar(
c(ORDERLY_API_SERVER_IDENTITY = identity),
orderly::orderly_config(root))
orderly1::orderly_config(root))
}
self$root <- self$config$root
if (!runner_has_git(self$root)) {
Expand All @@ -182,7 +182,7 @@ orderly_runner_ <- R6::R6Class(

## This ensures that the index will be present, which will be
## useful if something else wants to access the database!
DBI::dbDisconnect(orderly::orderly_db("destination", self$config, FALSE))
DBI::dbDisconnect(orderly1::orderly_db("destination", self$config, FALSE))

## Create directories for storing logs and id files
dir_create(dirname(path_stderr(self$root, "ignore")))
Expand All @@ -195,7 +195,8 @@ orderly_runner_ <- R6::R6Class(
message("Starting queue")
self$queue_id <- orderly_queue_id(queue_id)
self$queue <- rrq::rrq_controller$new(self$queue_id, self$con)
self$queue$worker_config_save("localhost", heartbeat_period = 10)
config <- rrq::rrq_worker_config(heartbeat_period = 10)
self$queue$worker_config_save("localhost", config)
self$start_workers(workers, worker_timeout)
self$keys <- orderly_key(self$queue$queue_id)
},
Expand All @@ -204,11 +205,11 @@ orderly_runner_ <- R6::R6Class(
#' Re-read configuration and set options
reload = function() {
if (is.null(self$identity)) {
self$config <- orderly::orderly_config(self$root)
self$config <- orderly1::orderly_config(self$root)
} else {
self$config <- withr::with_envvar(
c(ORDERLY_API_SERVER_IDENTITY = self$identity),
orderly::orderly_config(self$root))
orderly1::orderly_config(self$root))
}

opts <- self$config$server_options()
Expand Down
2 changes: 1 addition & 1 deletion R/temp.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ orderly_upstream_dependencies <- function(reports, root = NULL, locate = TRUE,
if (!is.null(ref)) {
assert_scalar_character(ref)
}
config <- orderly::orderly_config(root, locate)
config <- orderly1::orderly_config(root, locate)
stats::setNames(lapply(reports, report_dependencies, ref, config), reports)
}

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ All the query stuff is already dealt with in [montagu-reporting-api](https://git
IMAGE=docker.montagu.dide.ic.ac.uk:5000/orderly.server:master
docker pull $IMAGE
mkdir orderly
docker run --rm --entrypoint Rscript -v ${PWD}/orderly:/orderly --user ${UID} $IMAGE -e 'orderly:::prepare_orderly_git_example("/orderly")'
docker run --rm --entrypoint Rscript -v ${PWD}/orderly:/orderly --user ${UID} $IMAGE -e 'orderly::orderly_rebuild("/orderly")'
docker run --rm --entrypoint Rscript -v ${PWD}/orderly:/orderly --user ${UID} $IMAGE -e 'orderly1:::prepare_orderly_git_example("/orderly")'
docker run --rm --entrypoint Rscript -v ${PWD}/orderly:/orderly --user ${UID} $IMAGE -e 'orderly1::orderly_rebuild("/orderly")'
docker run --rm -p 8321:8321 -v ${PWD}/orderly:/orderly --user ${UID} $IMAGE /orderly
```

Expand Down
2 changes: 1 addition & 1 deletion docker/common
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ TAG_LATEST="${PACKAGE_ORG}/${PACKAGE_NAME}:latest"
## combined tag so that we never replace an existing tagged
## image built off master with an image with a different
## version of orderly installed
ORDERLY_VERSION="${ORDERLY_VERSION:-master}"
ORDERLY_VERSION="${ORDERLY_VERSION:-vimc-7135}"
if [ "$ORDERLY_VERSION" != "master" ]; then
TAG_SHA="$TAG_SHA-$ORDERLY_VERSION"
buildkite-agent meta-data set "orderly-server-sha" $TAG_SHA
Expand Down
2 changes: 1 addition & 1 deletion inst/schema/spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ As for the `/reports/:name/run/` endpoint, accepts as `POST` body json that will

Also accepts the query parameter `instance` which can be used to change database instance.

Returns binary data, being the created bundle object for use with `orderly::orderly_bundle_run`
Returns binary data, being the created bundle object for use with `orderly1::orderly_bundle_run`

## POST /bundle/import

Expand Down
2 changes: 1 addition & 1 deletion man/orderly_runner.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions man/orderly_runner_.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading