Skip to content

Commit

Permalink
Merge pull request #81 from teddyCodex/issue-47-rename-functions
Browse files Browse the repository at this point in the history
Refactored function names in R/job_status_emails.R
- fixes #47
  • Loading branch information
the-mayer authored Oct 8, 2024
2 parents a7219d0 + 6ec0b13 commit e62a71c
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 35 deletions.
8 changes: 4 additions & 4 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
20 changes: 10 additions & 10 deletions R/job_status_emails.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
#
Expand All @@ -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"))
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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") {
Expand Down Expand Up @@ -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
# -------------------------------------------------
Expand All @@ -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
)

Expand Down
6 changes: 3 additions & 3 deletions man/make_job_results_url.Rd → man/createJobResultsURL.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 11 additions & 5 deletions man/get_job_message.Rd → man/createJobStatusEmailMessage.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions man/format_job_args.Rd → man/formatJobArgumentsHTML.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 3 additions & 9 deletions man/send_job_status_email.Rd → man/sendJobStatusEmail.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e62a71c

Please sign in to comment.