Skip to content

Commit

Permalink
refit jobs with large counts files are now run via bsub. changing the…
Browse files Browse the repository at this point in the history
… way permissions check for file modification is done
  • Loading branch information
cband committed Jun 8, 2020
1 parent 5f76a73 commit 0d89717
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 16 deletions.
8 changes: 6 additions & 2 deletions R/global.R
Original file line number Diff line number Diff line change
Expand Up @@ -432,14 +432,18 @@ verify_access_to_write <- function(sample_path) {

can_edit_review = F
if (file.exists(review_file)) {
can_edit_review = !system(paste0('touch -a -r ', review_file, ' ', review_file), ignore.stderr = T)
#can_edit_review = !system(paste0('touch -a -r ', review_file, ' ', review_file), ignore.stderr = T)
can_edit_review = !system(paste0('(mv ', review_file, ' ', review_file, '. ; ',
' mv ', review_file, '. ', review_file, ') 2> /dev/null'), ignore.stderr = T)
} else {
can_edit_review = has_permissions_to_write(sample_path)
}

can_edit_qc = F
if (file.exists(qc_file)) {
can_edit_qc = !system(paste0('touch -c -a -r ', qc_file, ' ', qc_file), ignore.stderr = T)
#can_edit_qc = !system(paste0('touch -c -a -r ', qc_file, ' ', qc_file), ignore.stderr = T)
can_edit_qc = !system(paste0('(mv ', qc_file, ' ', qc_file, '. ; ',
' mv ', qc_file, '. ', qc_file, ') 2> /dev/null'), ignore.stderr = T)
} else {
can_edit_qc = has_permissions_to_write(sample_path)
}
Expand Down
2 changes: 1 addition & 1 deletion example_facets_preview.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@
"verify_sshfs_mount" : "juno",
"r_script_path" : "/opt/common/CentOS_7-dev/bin/Rscript",
"facets_suite_lib": "/juno/work/ccs/shared/software/R_libs/facetsSuite/2.0.6/",
"facets_suite_run_wrapper": "/juno/work/ccs/shared/software/R_libs/facetsSuite/2.0.4/run-facets-wrapper.R",
"facets_suite_run_wrapper": "/juno/work/ccs/shared/software/R_libs/facetsSuite/2.0.6/run-facets-wrapper.R",
"facets_qc_script": "/juno/work/ccs/bandlamc/git/facets-preview/facets_qc/v1.0/facets_fit_qc.R"
}
30 changes: 19 additions & 11 deletions inst/application/server.R
Original file line number Diff line number Diff line change
Expand Up @@ -802,27 +802,35 @@ function(input, output, session) {

name_tag = glue(name_tag)
refit_name <- glue('/refit_{name_tag}')

cmd_script_pfx = paste0(values$config$watcher_dir, "/refit_jobs/facets_refit_cmd_")
refit_cmd_file <- glue("{cmd_script_pfx}{sample_id}_{name_tag}.sh")


refit_dir <- paste0(run_path, refit_name)
facets_lib_path = supported_facets_versions[version==facets_version_to_use]$lib_path

counts_file_name = glue("{run_path}/countsMerged____{sample_id}.dat.gz")

if (any(values$submitted_refit == refit_dir)) {
showModal(modalDialog(
title = "Not submitted", paste0("Job already queued. Check logs: ", refit_cmd_file, ".*")
))
return(NULL)
}

if (!is.null(values$selected_repo)) {
counts_file_name = glue(paste0("{run_path}/",values$selected_repo$counts_file_format))
}

if (!file.exists(counts_file_name)) {
# try alternate counts file; tempo format; eg: SU2LC_MSK_1365_T__SU2LC_MSK_1365_N.snp_pileup.gz
if (file.exists(glue("{run_path}/{sample_id}.snp_pileup.gz"))) {
counts_file_name = glue("{run_path}/{sample_id}.snp_pileup.gz")
} else {
showModal(modalDialog( title = "Not submitted", paste0("Counts file does not exist: ", counts_file_name) ))
return(NULL)
}
}

refit_cmd_file <- glue("{cmd_script_pfx}{sample_id}_{name_tag}.sh")
if (file.size(counts_file_name) > 5e7) {
refit_cmd_file <- glue("{cmd_script_pfx}{sample_id}_{name_tag}.bsub.sh")
}

if (any(values$submitted_refit == refit_dir)) {
showModal(modalDialog(
title = "Not submitted", paste0("Counts file does not exist: ", counts_file_name)
title = "Not submitted", paste0("Job already queued. Check logs: ", refit_cmd_file, ".*")
))
return(NULL)
}
Expand Down
6 changes: 4 additions & 2 deletions refit_watcher/refit_watcher.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ WATCHER_DIR="/juno/work/ccs/shared/software/refit_watcher/"

INOTIFY_SH="$WATCHER_DIR/bin/refit_watcher_inotify_cmd.sh"

rm -f $INOTIFY_SH

nohup sh -c "sleep 4; touch $WATCHER_DIR/refit_jobs/facets_refit_cmd_watcher_poll.sh" 2> /dev/null > /dev/null &

echo "
Expand All @@ -16,6 +14,10 @@ $WATCHER_DIR/bin/inotifywait --format '%w%f' --include 'facets_refit_cmd_.*sh\$'
if [[ \"\$FILE\" =~ \"facets_refit_cmd_watcher_poll.sh\" ]]; then
echo \$CUR_TIME inotify is running
nohup bash -c 'sleep 59; touch $WATCHER_DIR/refit_jobs/facets_refit_cmd_watcher_poll.sh' &
elif [[ \"\$FILE\" =~ \"bsub.sh\" ]]; then
echo \$CUR_TIME Running: \$FILE
bsub -We 1:59 -n 4 -R \"rusage[mem=16]\" -o \$FILE.log -e \$FILE.err bash \$FILE
echo \$CUR_TIME Finished: \$FILE
else
echo \$CUR_TIME Running: \$FILE
bash \$FILE > \$FILE.log 2> \$FILE.err &
Expand Down

0 comments on commit 0d89717

Please sign in to comment.