|
16 | 16 | #' |
17 | 17 | #' @importFrom processx poll |
18 | 18 | #' @export |
19 | | -worker <- function(cluster = p2p_cluster_name(), host = "pipe.pico.sh", ssh_args = NULL, duration = 60*60) { |
| 19 | +worker <- function(cluster = p2p_cluster_name(host = host, ssh_args = ssh_args), host = "pipe.pico.sh", ssh_args = NULL, duration = 60*60) { |
20 | 20 | parts <- strsplit(cluster, split = "/", fixed = TRUE)[[1]] |
21 | 21 | if (length(parts) != 2L) { |
22 | 22 | stop(sprintf("Argument 'cluster' must be of format '{owner}/{name}': %s", sQuote(cluster))) |
@@ -47,7 +47,7 @@ worker <- function(cluster = p2p_cluster_name(), host = "pipe.pico.sh", ssh_args |
47 | 47 | info("assert connection to p2p cluster %s", sQuote(cluster)) |
48 | 48 | worker_id <- p2p_worker_id() |
49 | 49 | if (!p2p_can_connect(cluster, name = worker_id, host = host, ssh_args = ssh_args)) { |
50 | | - stop(sprintf("Cannot connect to P2P cluster %s - make sure they have given you (%s) access", sQuote(cluster), sQuote(pico_username()))) |
| 50 | + stop(sprintf("Cannot connect to P2P cluster %s - make sure they have given you (%s) access", sQuote(cluster), sQuote(pico_username(host = host, ssh_args = ssh_args)))) |
51 | 51 | } |
52 | 52 |
|
53 | 53 | channel_prefix <- sprintf("%s_%s", .packageName, session_uuid()) |
@@ -103,7 +103,7 @@ worker <- function(cluster = p2p_cluster_name(), host = "pipe.pico.sh", ssh_args |
103 | 103 |
|
104 | 104 | info("connect worker %s to p2p cluster %s", sQuote(worker_id), sQuote(cluster)) |
105 | 105 | cluster_owner <- dirname(cluster) |
106 | | - if (cluster_owner == pico_username()) { |
| 106 | + if (cluster_owner == pico_username(host = host, ssh_args = ssh_args)) { |
107 | 107 | topic <- sprintf("%s/future.p2p", basename(cluster)) |
108 | 108 | } else { |
109 | 109 | topic <- sprintf("%s/future.p2p", cluster) |
@@ -379,12 +379,12 @@ run_worker <- function(cluster, worker_id, host, ssh_args, duration, channels) { |
379 | 379 |
|
380 | 380 | info("assert connection to p2p cluster %s", sQuote(cluster)) |
381 | 381 | if (!p2p_can_connect(cluster, name = worker_id, host = host, ssh_args = ssh_args)) { |
382 | | - stop(sprintf("Cannot connect to P2P cluster %s - make sure they have given you (%s) access", sQuote(cluster), sQuote(pico_username()))) |
| 382 | + stop(sprintf("Cannot connect to P2P cluster %s - make sure they have given you (%s) access", sQuote(cluster), sQuote(pico_username(host = host, ssh_args = ssh_args)))) |
383 | 383 | } |
384 | 384 |
|
385 | 385 | info("connect background worker process %s to p2p cluster %s for %s until %s", sQuote(worker_id), sQuote(cluster), format(duration), expires) |
386 | 386 | cluster_owner <- dirname(cluster) |
387 | | - if (cluster_owner == pico_username()) { |
| 387 | + if (cluster_owner == pico_username(host = host, ssh_args = ssh_args)) { |
388 | 388 | topic <- sprintf("%s/future.p2p", basename(cluster)) |
389 | 389 | } else { |
390 | 390 | topic <- sprintf("%s/future.p2p", cluster) |
|
0 commit comments