% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/htc-upload.R
\name{htc_upload}
\alias{htc_upload}
\title{Upload files to an HTC submit node}
\usage{
htc_upload(
  files,
  remote_path = "~/",
  config = NULL,
  dry_run = FALSE,
  verbose = FALSE
)
}
\arguments{
\item{files}{A character vector. One or more local file paths or directory
paths to copy to the submit node. A single file, a vector of files, and
a directory path are all accepted. Directories are copied recursively.}

\item{remote_path}{A character string. The destination directory on the
submit node. Defaults to \code{"~/"} (the user's home directory). This should
match the path used in the subsequent call to \code{\link[=htc_submit]{htc_submit()}}.}

\item{config}{A named list as returned by \code{\link[=htc_config]{htc_config()}}. Must contain
\code{username} and \code{server}. If \code{NULL}, the function errors with instructions
to call \code{\link[=htc_config]{htc_config()}} first.}

\item{dry_run}{Logical. If \code{TRUE}, prints the \code{scp} command that would be
executed without running it. Useful for verifying the command before
transferring files. Defaults to \code{FALSE}.}

\item{verbose}{Logical. If \code{TRUE}, prints progress messages. Defaults to
\code{FALSE}.}
}
\value{
Called for its side effects. Returns \code{invisible(NULL)}.
}
\description{
\code{htc_upload()} copies one or more local files or directories to a
directory on an HTC submit node via \code{scp}. It is the first step in the
job submission workflow -- files must be present on the submit node before
\code{htc_submit()} can run \code{condor_submit}.
}
\section{Workflow}{

\code{htc_upload()} is the first system-facing step in the submitr workflow.
Call it after generating your submit file and executable script with
\code{\link[=htc_gen_submit]{htc_gen_submit()}} and \code{\link[=htc_gen_executable]{htc_gen_executable()}}, and before calling
\code{\link[=htc_submit]{htc_submit()}}.

The typical sequence is:

\if{html}{\out{<div class="sourceCode r">}}\preformatted{cfg <- htc_config()

htc_upload(
  files  = c("job.sub", "job.sh", "analysis.R", "data.csv"),
  config = cfg
)

htc_submit(submit_file = "job.sub", config = cfg)
}\if{html}{\out{</div>}}
}

\section{SSH connection reuse}{

Each call to \code{htc_upload()} opens a new SSH connection. If you have not
configured ControlMaster in your \verb{~/.ssh/config}, this will trigger a
Duo MFA prompt. Run \code{\link[=htc_config]{htc_config()}} for setup guidance.
}

\examples{
\donttest{
# Preview the scp command without connecting to CHTC
cfg <- list(username = "netid", server = "ap2002.chtc.wisc.edu")
tmp <- tempfile(fileext = ".sub")
writeLines("queue 1", tmp)
htc_upload(files = tmp, config = cfg, dry_run = TRUE)
}

\dontrun{
# All remaining examples require a live CHTC connection
cfg <- htc_config()

# Upload a single file
htc_upload(files = "job.sub", config = cfg)

# Upload multiple files
htc_upload(
  files  = c("job.sub", "job.sh", "analysis.R"),
  config = cfg
)

# Upload a directory
htc_upload(files = "jobs/", config = cfg)

# Upload to a specific remote directory
htc_upload(
  files       = c("job.sub", "job.sh"),
  remote_path = "~/projects/penguins/",
  config      = cfg
)
}
}
