Skip to contents

Attempts to gracefully stop a running pyDarwin job on a remote host by creating a 'stop.darwin' file in the remote project directory.

Usage

stop_pyDarwinRemote(
  LocalDirectoryPath,
  LocalJobInfoFilePath = NULL,
  OriginalOptionsPath = NULL,
  Password = NULL,
  KeyPath = NULL,
  verbose = getOption("verbose", default = FALSE)
)

Arguments

LocalDirectoryPath

Character string: The base local directory associated with the pyDarwin job. This directory is used to locate the job information file and the original options file.

LocalJobInfoFilePath

Character string (optional): Explicit path to the local JSON file containing remote job information. If NULL (default), it's constructed using LocalDirectoryPath and ProjectName (derived from OriginalOptionsPath).

OriginalOptionsPath

Character string (optional): Explicit path to the original local options.json file. If NULL (default), it's sought in LocalDirectoryPath. This is used to derive ProjectName if needed.

Password

Character string. The password for SSH authentication. Defaults to "", which is appropriate when using key-based authentication. Using keys is strongly recommended over embedding passwords in scripts.

KeyPath

Character string. The path to your private SSH key file. Defaults to the path stored in the SSH_PRIVATE_KEY_PATH environment variable.

verbose

Logical: Passed to ssh::ssh_connect for verbose SSH output. Default: getOption("verbose", default = FALSE).

Value

Invisibly returns TRUE if the stop signal file was successfully created (or already existed), and FALSE if there was an SSH error or an error creating the file. This only signals the intent to stop; it does not confirm the pyDarwin process has actually stopped.

Examples

if (FALSE) { # \dontrun{
# Assuming 'my_project_remote_job_info.json' and 'options.json'
# exist in '~/darwin_runs/my_project_run'.
try({
  stop_pyDarwinRemote(
    LocalDirectoryPath = "~/darwin_runs/my_project_run",
    KeyPath = "~/.ssh/id_rsa_remote"
  )
})

# Explicitly providing paths
try({
 stop_pyDarwinRemote(
   LocalDirectoryPath = "~/darwin_runs/my_project_run", # Still used as a base if needed
   LocalJobInfoFilePath = "~/darwin_runs/my_project_run/my_project_remote_job_info.json",
   OriginalOptionsPath = "~/darwin_runs/my_project_run/options.json"
 )
})
} # }