diff --git a/NAMESPACE b/NAMESPACE index d37a2a60..53332439 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -34,6 +34,8 @@ export(convertFA2Tree) export(convert_aln2fa) export(countByColumn) export(createFA2Tree) +export(createJobResultsURL) +export(createJobStatusEmailMessage) export(createWordCloud2Element) export(createWordCloudElement) export(create_lineage_lookup) @@ -45,18 +47,16 @@ export(filterByDomains) export(filterByFrequency) export(findParalogs) export(find_top_acc) -export(format_job_args) +export(formatJobArgumentsHTML) export(gc_undirected_network) export(generateAllAlignments2FA) export(generate_all_aln2fa) export(generate_msa) export(get_accnums_from_fasta_file) -export(get_job_message) export(get_proc_medians) export(get_proc_weights) export(ipr2viz) export(ipr2viz_web) -export(make_job_results_url) export(make_opts2procs) export(mapAcc2Name) export(map_acc2name) @@ -88,7 +88,7 @@ export(reverse_operon) export(run_deltablast) export(run_rpsblast) export(selectLongestDuplicate) -export(send_job_status_email) +export(sendJobStatusEmail) export(shortenLineage) export(sinkReset) export(summarizeByLineage) diff --git a/R/job_status_emails.R b/R/job_status_emails.R index 4a96459a..6b1412e9 100644 --- a/R/job_status_emails.R +++ b/R/job_status_emails.R @@ -7,7 +7,7 @@ # 1. source("job_status_emails.R") # 2. call: # # event_type can be 'start' or 'end' -# send_job_status_email(notify_email, job_dir, pin_id, event_type) +# sendJobStatusEmail(notify_email, job_dir, pin_id, event_type) # Return # unfortunately, there is no return value for the underlying sendmailR methods # @@ -25,7 +25,7 @@ #' @return the URL where the user can check the status of their job #' @export #' -make_job_results_url <- function( +createJobResultsURL <- function( pin_id, base_url = Sys.getenv("BASE_URL", unset = "http://jravilab.org/molevolvr/")) { return(paste0(base_url, "?r=", pin_id, "&p=home")) @@ -91,9 +91,9 @@ make_job_results_url <- function( #' #' @examples #' \dontrun{ -#' format_job_args("/data/scratch/janani/molevolvr_out/Ba5sV1_full") +#' formatJobArgumentsHTML("/data/scratch/janani/molevolvr_out/Ba5sV1_full") #' } -format_job_args <- function(job_args) { +formatJobArgumentsHTML <- function(job_args) { # format job arguments into html-formatted key/value pairs job_args_list <- tags$ul(lapply(names(job_args), function(key) { # look up human labels for field names, values, if available @@ -146,7 +146,7 @@ format_job_args <- function(job_args) { } #' Produces a mail message that can be sent to a user when their job is accepted. -#' Used by the send_job_status_email() method. +#' Used by the sendJobStatusEmail() method. #' #' @param job_dir #' the directory where the job's arguments are stored, in job_args.yml @@ -166,11 +166,11 @@ format_job_args <- function(job_args) { #' @return #' the result of the sendmailR::sendmail() call #' @export -get_job_message <- function(job_dir, pin_id, job_results_url, event_type, context) { +createJobStatusEmailMessage <- function(job_dir, pin_id, job_results_url, event_type, context) { # pull the set of args written to dir/job_args.yml, so we # can send it in the email job_args <- yaml::read_yaml(file.path(job_dir, "job_args.yml")) - job_args_list <- format_job_args(job_args) + job_args_list <- formatJobArgumentsHTML(job_args) # determine which template to use based on the event type if (event_type == "start") { @@ -217,7 +217,7 @@ get_job_message <- function(job_dir, pin_id, job_results_url, event_type, contex #' @return #' the result of the sendmailR::sendmail() call #' @export -send_job_status_email <- function(notify_email, job_dir, pin_id, event_type, context = NULL) { +sendJobStatusEmail <- function(notify_email, job_dir, pin_id, event_type, context = NULL) { # ------------------------------------------------- # --- step 1. build the email subject and contents # ------------------------------------------------- @@ -232,10 +232,10 @@ send_job_status_email <- function(notify_email, job_dir, pin_id, event_type, con } # construct the job results URL from the pin_id - job_results_url <- make_job_results_url(pin_id) + job_results_url <- createJobResultsURL(pin_id) # produce a formatted email message from the arguments and template - message <- get_job_message( + message <- createJobStatusEmailMessage( job_dir, pin_id, job_results_url, event_type, context ) diff --git a/man/make_job_results_url.Rd b/man/createJobResultsURL.Rd similarity index 89% rename from man/make_job_results_url.Rd rename to man/createJobResultsURL.Rd index 77f7bda5..02407f15 100644 --- a/man/make_job_results_url.Rd +++ b/man/createJobResultsURL.Rd @@ -1,10 +1,10 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/job_status_emails.R -\name{make_job_results_url} -\alias{make_job_results_url} +\name{createJobResultsURL} +\alias{createJobResultsURL} \title{Given a pin_id, returns the URL where the user can check the status of their job} \usage{ -make_job_results_url( +createJobResultsURL( pin_id, base_url = Sys.getenv("BASE_URL", unset = "http://jravilab.org/molevolvr/") ) diff --git a/man/get_job_message.Rd b/man/createJobStatusEmailMessage.Rd similarity index 75% rename from man/get_job_message.Rd rename to man/createJobStatusEmailMessage.Rd index 0c7ee8f2..1f779793 100644 --- a/man/get_job_message.Rd +++ b/man/createJobStatusEmailMessage.Rd @@ -1,11 +1,17 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/job_status_emails.R -\name{get_job_message} -\alias{get_job_message} +\name{createJobStatusEmailMessage} +\alias{createJobStatusEmailMessage} \title{Produces a mail message that can be sent to a user when their job is accepted. -Used by the send_job_status_email() method.} +Used by the sendJobStatusEmail() method.} \usage{ -get_job_message(job_dir, pin_id, job_results_url, event_type, context) +createJobStatusEmailMessage( + job_dir, + pin_id, + job_results_url, + event_type, + context +) } \arguments{ \item{job_dir}{the directory where the job's arguments are stored, in job_args.yml} @@ -23,5 +29,5 @@ the result of the sendmailR::sendmail() call } \description{ Produces a mail message that can be sent to a user when their job is accepted. -Used by the send_job_status_email() method. +Used by the sendJobStatusEmail() method. } diff --git a/man/format_job_args.Rd b/man/formatJobArgumentsHTML.Rd similarity index 73% rename from man/format_job_args.Rd rename to man/formatJobArgumentsHTML.Rd index 7af96750..371fb6f1 100644 --- a/man/format_job_args.Rd +++ b/man/formatJobArgumentsHTML.Rd @@ -1,11 +1,11 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/job_status_emails.R -\name{format_job_args} -\alias{format_job_args} +\name{formatJobArgumentsHTML} +\alias{formatJobArgumentsHTML} \title{Format job arguments into html-formatted key/value pairs, for including in an email} \usage{ -format_job_args(job_args) +formatJobArgumentsHTML(job_args) } \arguments{ \item{job_args}{a list of job arguments, e.g. as read from the job_args.yml file} @@ -19,6 +19,6 @@ in an email } \examples{ \dontrun{ -format_job_args("/data/scratch/janani/molevolvr_out/Ba5sV1_full") +formatJobArgumentsHTML("/data/scratch/janani/molevolvr_out/Ba5sV1_full") } } diff --git a/man/send_job_status_email.Rd b/man/sendJobStatusEmail.Rd similarity index 84% rename from man/send_job_status_email.Rd rename to man/sendJobStatusEmail.Rd index 4357687a..b53f652a 100644 --- a/man/send_job_status_email.Rd +++ b/man/sendJobStatusEmail.Rd @@ -1,17 +1,11 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/job_status_emails.R -\name{send_job_status_email} -\alias{send_job_status_email} +\name{sendJobStatusEmail} +\alias{sendJobStatusEmail} \title{Sends a "job accepted" email to a user when their job is accepted, including details about the job submission and how to check its status.} \usage{ -send_job_status_email( - notify_email, - job_dir, - pin_id, - event_type, - context = NULL -) +sendJobStatusEmail(notify_email, job_dir, pin_id, event_type, context = NULL) } \arguments{ \item{notify_email}{the email address to send the notification to}