Skip to content

Commit

Permalink
Merge pull request #144 from mrc-ide/mrc-5855
Browse files Browse the repository at this point in the history
Remove most refs to old machines for clarity
  • Loading branch information
richfitz authored Oct 8, 2024
2 parents 2b8ab3e + c5e0d0f commit 2a40ac2
Show file tree
Hide file tree
Showing 16 changed files with 85 additions and 95 deletions.
6 changes: 3 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: hipercow
Title: High Performance Computing
Version: 1.0.35
Version: 1.0.36
Authors@R: c(person("Rich", "FitzJohn", role = c("aut", "cre"),
email = "[email protected]"),
person("Wes", "Hinsley", role = "aut"),
Expand All @@ -11,14 +11,15 @@ Description: Set up cluster environments and jobs. Moo.
License: MIT + file LICENSE
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.3.1
RoxygenNote: 7.3.2
URL: https://github.com/mrc-ide/hipercow, https://mrc-ide.github.io/hipercow
BugReports: https://github.com/mrc-ide/hipercow/issues
Imports:
audio,
cli,
fs,
ids,
pkgdepends,
rlang,
withr
Suggests:
Expand All @@ -32,7 +33,6 @@ Suggests:
logwatch,
mockery,
openssl,
pkgdepends,
prettyunits,
redux,
rmarkdown,
Expand Down
6 changes: 3 additions & 3 deletions R/windows.R
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,13 @@ windows_check <- function(path = getwd()) {
##' written in `/etc/fstab`)
##'
##' @param path_remote The network path for this drive. It
##' will look something like `\\\\fi--didef3.dide.ic.ac.uk\\tmp\\`.
##' will look something like `\\\\projects.dide.ic.ac.uk\\tmp\\`.
##' Unfortunately backslashes are really hard to get right here and
##' you will need to use twice as many as you expect (so *four*
##' backslashes at the beginning and then two for each separator).
##' If this makes you feel bad know that you are not alone:
##' https://xkcd.com/1638 -- alternatively you may use forward
##' slashes in place of backslashes (e.g. `//fi--didef3.dide.ic.ac.uk/tmp`)
##' slashes in place of backslashes (e.g. `//projects.dide.ic.ac.uk/tmp`)
##'
##' @param drive_remote The place to mount the drive on the cluster.
##' We're probably going to mount things at Q: and T: already so
Expand All @@ -83,7 +83,7 @@ windows_check <- function(path = getwd()) {
##' # this as "M:" when running tasks by first creating a path
##' # mapping:
##' share <- windows_path("~/net/malaria",
##' "//fi--didenas1.dide.ic.ac.uk/Malaria",
##' "//wpia-hn.hpc.dide.ic.ac.uk/Malaria",
##' "M:")
##'
##' # This share object contains information about how to relate your
Expand Down
2 changes: 1 addition & 1 deletion drivers/windows/DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: hipercow.windows
Title: DIDE HPC Support for Windows
Version: 1.0.35
Version: 1.0.36
Authors@R: c(person("Rich", "FitzJohn", role = c("aut", "cre"),
email = "[email protected]"),
person("Wes", "Hinsley", role = "aut"),
Expand Down
2 changes: 1 addition & 1 deletion drivers/windows/R/driver.R
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ windows_keypair <- function(config, path_root) {
i = "Please run 'windows_keypair_generate()' to generate a keypair"),
parent = e)
})
key <- sprintf("//fi--san03.dide.ic.ac.uk/homes/%s/.hipercow/key", username)
key <- sprintf("//qdrive.dide.ic.ac.uk/homes/%s/.hipercow/key", username)
list(pub = pub, key = key)
}

Expand Down
2 changes: 1 addition & 1 deletion drivers/windows/R/keys.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ windows_generate_keypair <- function(update = FALSE, call = NULL) {
return(invisible())
}
}
share <- sprintf("//fi--san03.dide.ic.ac.uk/homes/%s", username)
share <- sprintf("//qdrive.dide.ic.ac.uk/homes/%s", username)
share_local <- dide_locally_resolve_unc_path(share)
if (!is.null(share_local) && file.exists(share_local)) {
pub <- windows_generate_keypair_locally(share_local)
Expand Down
8 changes: 4 additions & 4 deletions drivers/windows/tests/testthat/helper-config.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ example_root <- function(mount_path, sub = "b/c") {


example_mounts <- function(root) {
remote <- c("\\\\fi--didef3\\other",
"\\\\fi--san03\\homes\\bob",
"\\\\fi--didenas1\\Project",
"\\\\fi--didef3\\tmp",
remote <- c("\\\\projects\\other",
"\\\\qdrive\\homes\\bob",
"\\\\wpia-hn\\Project",
"\\\\projects\\tmp",
"\\\\wpia-hn\\newshare")
local <- file.path(root, c("other", "home", "proj", "temp", "sk"))
fs::dir_create(file.path(local, "sub"))
Expand Down
4 changes: 2 additions & 2 deletions drivers/windows/tests/testthat/test-keypair.R
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ test_that("can generate a keypair", {

mockery::expect_called(mock_resolve, 1)
expect_equal(mockery::mock_args(mock_resolve)[[1]],
list("//fi--san03.dide.ic.ac.uk/homes/bob"))
list("//qdrive.dide.ic.ac.uk/homes/bob"))

mockery::expect_called(mock_key_set, 1)
expect_equal(
Expand Down Expand Up @@ -129,5 +129,5 @@ test_that("can fetch keypair", {
expect_equal(
res,
list(pub = pubkey,
key = "//fi--san03.dide.ic.ac.uk/homes/bob/.hipercow/key"))
key = "//qdrive.dide.ic.ac.uk/homes/bob/.hipercow/key"))
})
56 changes: 23 additions & 33 deletions drivers/windows/tests/testthat/test-mounts.R
Original file line number Diff line number Diff line change
Expand Up @@ -79,16 +79,16 @@ test_that("Parse return value into sensible output (linux)", {
paths <- file.path(tmp, c("other", "home", "malaria"))
fs::dir_create(paths)
dat <- c(
"//fi--didef3/other on %s/other type cifs (rw,relatime)",
"//fi--san03/homes/bob on %s/home type cifs (rw,relatime)",
"//fi--didenas1/Malaria on %s/malaria type cifs (rw,relatime)")
"//projects/other on %s/other type cifs (rw,relatime)",
"//qdrive/homes/bob on %s/home type cifs (rw,relatime)",
"//wpia-hn/Malaria on %s/malaria type cifs (rw,relatime)")
dat <- vcapply(dat, function(x) sprintf(x, tmp), USE.NAMES = FALSE)
mock_system2 <- mockery::mock(dat)
mockery::stub(detect_mounts_unix, "system2", mock_system2)
res <- detect_mounts_unix()
cmp <- cbind(remote = c("\\\\fi--didef3\\other",
"\\\\fi--san03\\homes\\bob",
"\\\\fi--didenas1\\Malaria"),
cmp <- cbind(remote = c("\\\\projects\\other",
"\\\\qdrive\\homes\\bob",
"\\\\wpia-hn\\Malaria"),
local = paths)
expect_equal(res, cmp)
})
Expand All @@ -100,17 +100,17 @@ test_that("Warn if given unexpected output (linux)", {
paths <- file.path(tmp, c("other", "home", "malaria"))
fs::dir_create(paths)
dat <- c(
"//fi--didef3/other on %s/other type cifs (rw,relatime)",
"//fi--san03/homes/bob sur %s/home type cifs (rw,relatime)",
"//fi--didenas1/Malaria on %s/malaria type cifs (rw,relatime)")
"//projects/other on %s/other type cifs (rw,relatime)",
"//qdrive/homes/bob sur %s/home type cifs (rw,relatime)",
"//wpia-hn/Malaria on %s/malaria type cifs (rw,relatime)")
dat <- vcapply(dat, function(x) sprintf(x, tmp), USE.NAMES = FALSE)
mock_system2 <- mockery::mock(dat)
mockery::stub(detect_mounts_unix, "system2", mock_system2)
expect_warning(
res <- detect_mounts_unix(),
"Ignoring mounts")
cmp <- cbind(remote = c("\\\\fi--didef3\\other",
"\\\\fi--didenas1\\Malaria"),
cmp <- cbind(remote = c("\\\\projects\\other",
"\\\\wpia-hn\\Malaria"),
local = paths[-2])
expect_equal(res, cmp)
})
Expand All @@ -119,32 +119,32 @@ test_that("Warn if given unexpected output (linux)", {
test_that("Can parse wmic output", {
x <- c("\r",
"Node,ConnectionState,LocalName,RemoteName,Status\r",
"BUILDERHV,Connected,q:,\\\\fi--san03\\homes\\bob,OK\r",
"BUILDERHV,Connected,T:,\\\\fi--didef3\\tmp,OK\r")
"BUILDERHV,Connected,q:,\\\\qdrive\\homes\\bob,OK\r",
"BUILDERHV,Connected,T:,\\\\projects\\tmp,OK\r")
expect_equal(
wmic_parse(x),
cbind(remote = c("\\\\fi--san03\\homes\\bob", "\\\\fi--didef3\\tmp"),
cbind(remote = c("\\\\qdrive\\homes\\bob", "\\\\projects\\tmp"),
local = c("q:", "T:")))
})


test_that("Ignore disconnected mounts", {
x <- c("\r",
"Node,ConnectionState,LocalName,RemoteName,Status\r",
"BUILDERHV,Connected,q:,\\\\fi--san03\\homes\\bob,OK\r",
"BROKEN,Disconnected,T:,\\\\fi--didef3\\broken,Degraded\r")
"BUILDERHV,Connected,q:,\\\\qdrive\\homes\\bob,OK\r",
"BROKEN,Disconnected,T:,\\\\projects\\broken,Degraded\r")
expect_equal(
wmic_parse(x),
cbind(remote = c("\\\\fi--san03\\homes\\bob"),
cbind(remote = c("\\\\qdrive\\homes\\bob"),
local = c("q:")))
})


test_that("Can validate wmic output", {
x <- c("\r",
"node,connectionstate,localname,remotename,status\r",
"BUILDERHV,Connected,q:,\\\\fi--san03\\homes\\bob,OK\r",
"BUILDERHV,Connected,T:,\\\\fi--didef3\\tmp,OK\r")
"BUILDERHV,Connected,q:,\\\\qdrive\\homes\\bob,OK\r",
"BUILDERHV,Connected,T:,\\\\projects\\tmp,OK\r")
expect_error(
wmic_parse(x),
"Failed to find expected names in wmic output: RemoteName, LocalName")
Expand Down Expand Up @@ -191,8 +191,8 @@ test_that("wmic_call copes with command and parse errors", {
res_bad <- "lolno"
res_good <- c("\r",
"Node,ConnectionState,LocalName,RemoteName,Status\r",
"BUILDERHV,Connected,q:,\\\\fi--san03\\homes\\bob,OK\r",
"BUILDERHV,Connected,T:,\\\\fi--didef3\\tmp,OK\r")
"BUILDERHV,Connected,q:,\\\\qdrive\\homes\\bob,OK\r",
"BUILDERHV,Connected,T:,\\\\projects\\tmp,OK\r")

mock_system <- mockery::mock(stop("Error running command"), res_bad, res_good)
mockery::stub(wmic_call, "system_intern_check", mock_system)
Expand Down Expand Up @@ -286,19 +286,9 @@ test_that("Remap nas regex - South Ken", {
})


test_that("Check nas regex won't map cross-campus", {
test_that("Check app not used for non-infini shared", {
expect_equal(use_app_on_nas_south_ken(
"\\\\fi--didenas1.dide.ic.ac.uk\\X"), "\\\\fi--didenas1.dide.ic.ac.uk\\X")
expect_equal(use_app_on_nas_south_ken(
"//fi--didenas3.dide.ic.ac.uk/X"), "//fi--didenas3.dide.ic.ac.uk/X")
expect_equal(use_app_on_nas_south_ken(
"\\\\fi--didenas4\\X"), "\\\\fi--didenas4\\X")
expect_equal(use_app_on_nas_south_ken(
"//fi--didenas5/X"), "//fi--didenas5/X")
expect_equal(use_app_on_nas_south_ken(
"\\\\fi--didenas1.dide.local\\X"), "\\\\fi--didenas1.dide.local\\X")
expect_equal(use_app_on_nas_south_ken(
"//fi--didenas3.dide.local/X"), "//fi--didenas3.dide.local/X")
"\\\\qdrive.dide.ic.ac.uk\\X"), "\\\\qdrive.dide.ic.ac.uk\\X")
})


Expand Down
30 changes: 15 additions & 15 deletions drivers/windows/tests/testthat/test-paths.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
test_that("can create a path mapping", {
p <- getwd()
m <- windows_path(p, "//fi--san03/homes/bob", "Q:")
m <- windows_path(p, "//qdrive/homes/bob", "Q:")
expect_s3_class(m, "windows_path")
str <- as.character(m)
expect_match(str, "\\(local\\) .+ => .+ \\(remote\\)")
Expand All @@ -9,33 +9,33 @@ test_that("can create a path mapping", {

test_that("cannot create a path mapping on I:", {
p <- getwd()
expect_error(windows_path(p, "//fi--san03/homes/bob", "I:"),
expect_error(windows_path(p, "//qdrive/homes/bob", "I:"),
"You cannot use I:")
})

test_that("can validate creation of path mapping", {
expect_error(
windows_path(tempfile(), "//fi--san03/homes/bob", "Q:"),
windows_path(tempfile(), "//qdrive/homes/bob", "Q:"),
"Local mount point does not exist.")
expect_error(
windows_path("Q:", "Q://fi--san03/homes/bob", "Q:"),
windows_path("Q:", "Q://qdrive/homes/bob", "Q:"),
"path_remote must be a network path")
expect_error(
windows_path(getwd(), "//fi--san03/homes/bob", "Q"),
windows_path(getwd(), "//qdrive/homes/bob", "Q"),
"drive_remote must be of the form 'X:'")
})


test_that("Can clean a remote path", {
expect_equal(
clean_path_remote("//fi--san03/homes/bob"),
"\\\\fi--san03.dide.ic.ac.uk\\homes\\bob")
clean_path_remote("//qdrive/homes/bob"),
"\\\\qdrive.dide.ic.ac.uk\\homes\\bob")
expect_equal(
clean_path_remote("//fi--san03.dide.local/homes/bob"),
"\\\\fi--san03.dide.ic.ac.uk\\homes\\bob")
clean_path_remote("//qdrive.dide.local/homes/bob"),
"\\\\qdrive.dide.ic.ac.uk\\homes\\bob")
expect_equal(
clean_path_remote("//fi--san03.dide.ic.ac.uk/homes/bob/"),
"\\\\fi--san03.dide.ic.ac.uk\\homes\\bob")
clean_path_remote("//qdrive.dide.ic.ac.uk/homes/bob/"),
"\\\\qdrive.dide.ic.ac.uk\\homes\\bob")
})


Expand All @@ -62,8 +62,8 @@ test_that("Can detect a path into a share", {
t <- withr::local_tempdir()
t <- normalize_path(t)
shares <- list(
windows_path(p, "//fi--san03/homes/bob", "Q:"),
windows_path(tempdir(), "//fi--san03/tmp", "T:"))
windows_path(p, "//qdrive/homes/bob", "Q:"),
windows_path(tempdir(), "//qdrive/tmp", "T:"))

x <- prepare_path(t, shares)
expect_equal(x$rel, basename(t))
Expand Down Expand Up @@ -95,8 +95,8 @@ test_that("Can create a remote path", {
t <- withr::local_tempdir()
t <- normalize_path(t)
shares <- list(
home = windows_path(p, "//fi--san03/homes/bob", "Q:"),
temp = windows_path(tempdir(), "//fi--san03/tmp", "T:"))
home = windows_path(p, "//qdrive/homes/bob", "Q:"),
temp = windows_path(tempdir(), "//qdrive/tmp", "T:"))

res <- remote_path(t, shares)
expect_equal(res, paste0("T:/", basename(t)))
Expand Down
18 changes: 9 additions & 9 deletions drivers/windows/tests/testthat/test-web-format.R
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
test_that("Can format the overall load", {
x <- list(cluster = "didehpc",
x <- list(cluster = "hipercow",
detail = NULL,
summary = data.frame(
name = c("fi--dideclusthn", "fi--didemrchnb"),
name = c("wpia-hn", "wpia-hn2"),
free = c(203, 850),
used = c(13, 930),
total = c(216, 1780),
percent_used = c(6, 52),
stringsAsFactors = FALSE),
overall = list(name = "didehpc",
overall = list(name = "hipercow",
free = 1053,
used = 943,
total = 1996,
percent_used = 47))
class(x) <- "dide_clusterload"
expected <- c(" name free used total % used",
"--------------- ---- ---- ----- ------",
"fi--dideclusthn 203 13 216 6%",
" fi--didemrchnb 850 930 1780 52%",
"--------------- ---- ---- ----- ------",
" didehpc 1053 943 1996 47%")
expected <- c(" name free used total % used",
"-------- ---- ---- ----- ------",
" wpia-hn 203 13 216 6%",
"wpia-hn2 850 930 1780 52%",
"-------- ---- ---- ----- ------",
"hipercow 1053 943 1996 47%")
str <- withr::with_options(list(crayon.enabled = FALSE),
format(x))
expect_equal(str, expected)
Expand Down
10 changes: 5 additions & 5 deletions drivers/windows/tests/testthat/test-web.R
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ test_that("submit sends correct payload", {
resources <- list(
cores = 1,
exclusive = FALSE,
queue = "GeneralNodes")
queue = "AllNodes")

expect_equal(
cl$submit(path, "name", resources = resources,
Expand All @@ -256,14 +256,14 @@ test_that("submit sends correct payload", {
c("123", "456"))))

expect_equal(
cl$submit(path, "name", resources, "fi--didemrchnb",
cl$submit(path, "name", resources, "wpia-hn",
depends_on = character()),
dide_id)
mockery::expect_called(mock_client$POST, 2L)
expect_equal(
mockery::mock_args(mock_client$POST)[[2]],
list("/submit_1.php",
client_body_submit(path, "name", resources, "fi--didemrchnb",
client_body_submit(path, "name", resources, "wpia-hn",
character())))
})

Expand Down Expand Up @@ -372,14 +372,14 @@ test_that("status job sends correct payload", {
r <- mock_response(200, content = "Running")
mock_client <- list(GET = mockery::mock(r))
cl <- web_client$new(login = FALSE, client = mock_client)
expect_equal(cl$status_job(dide_id, "fi--didemrchnb"),
expect_equal(cl$status_job(dide_id, "wpia-hn"),
"running")

mockery::expect_called(mock_client$GET, 1L)
expect_equal(
mockery::mock_args(mock_client$GET)[[1]],
list("/api/v1/get_job_status/",
query = list(scheduler = "fi--didemrchnb",
query = list(scheduler = "wpia-hn",
jobid = dide_id)))
})

Expand Down
Loading

0 comments on commit 2a40ac2

Please sign in to comment.