Skip to content

Commit

Permalink
Make blj_go and similar functions into stand-alone scripts; not funct…
Browse files Browse the repository at this point in the history
…ions. This is for compatibility with non-bash shells.
  • Loading branch information
IvoryC committed Mar 9, 2020
1 parent a182da2 commit 3b18467
Show file tree
Hide file tree
Showing 19 changed files with 82 additions and 90 deletions.
2 changes: 1 addition & 1 deletion resources/aws/ec2_head_node_profile
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ set_ec2_owner() {
}

# Initialize bash environment
source "${BLJ_SCRIPT}/blj_config"
source "${BLJ}/script/blj_config"
[ "$(get_blj_prop docker.user)" != "" ] && export DOCKER_ID="$(get_blj_prop docker.user)"
######=========================================######
###### BioLockJ AWS ~/.bash_profile LOADED ######
Expand Down
2 changes: 1 addition & 1 deletion script/aws_config_lib
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
##############################################################
## This script contains functions to work with AWS Config ##
##############################################################
. ${BLJ_SCRIPT}/docker_functions
. ${BLJ}/script/docker_functions

AWS_CONF=~/.aws/aws_config
STANDARD_CONFIG="${BLJ}/resources/config/default/standard.properties"
Expand Down
10 changes: 5 additions & 5 deletions script/aws_functions
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
## This script is used for AWS core functions + logic ##
##############################################################

. ${BLJ_SCRIPT}/aws_config_lib
. ${BLJ_SCRIPT}/aws_head_node_lib
. ${BLJ_SCRIPT}/aws_upload_lib
. ${BLJ_SCRIPT}/aws_clean_lib
. ${BLJ_SCRIPT}/blj_functions
. ${BLJ}/script/aws_config_lib
. ${BLJ}/script/aws_head_node_lib
. ${BLJ}/script/aws_upload_lib
. ${BLJ}/script/aws_clean_lib
. ${BLJ}/script/blj_functions

alias clearPipes="sudo rm -rf ${EFS}/pipelines/*; echo AWS pipelines removed"
alias tailnf="tail -1000f /.nextflow.log"
Expand Down
2 changes: 1 addition & 1 deletion script/aws_upload_lib
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ stage_blj_config() {
console_log "Starting --> [ stage_blj_config ]: Upload Pipeline Config --> EFS: $(basename $(get_config ec2))"
upload_to_efs "$(local_nf_conf)" "${EC2_HOME}/.nextflow/config"
upload_to_efs "${BLJ}/resources/aws/ec2_head_node_profile"
upload_to_efs "${BLJ_SCRIPT}" "${EFS}"
upload_to_efs "${BLJ}/script" "${EFS}"
upload_to_efs "$(get_config local)" "${BLJ_CONFIG}"
exe_remote_cmd 'mv ~/.bash_profile ~/.bash_profile~; mv ~/ec2_head_node_profile ~/.bash_profile'
localS3=$(get_property $(get_config local) aws.s3)
Expand Down
4 changes: 2 additions & 2 deletions script/biolockj-api
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ main(){
fi
}

. ${BLJ_SCRIPT}/blj_functions
. ${BLJ_SCRIPT}/blj_user_arg_lib # note that several functions are over-written
. ${BLJ}/script/blj_functions
. ${BLJ}/script/blj_user_arg_lib # note that several functions are over-written

# Optionally print a message, then show help, then exit with status 1
# over-witten from blj_functions
Expand Down
2 changes: 1 addition & 1 deletion script/blj_complete
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
## This script manually completes current module and pipeline status. ##
## All modules numbered below than the current module will also be reset. ##
###############################################################################
. ${BLJ_SCRIPT}/blj_functions
. ${BLJ}/script/blj_functions

if [ ${#1} -gt 0 ]; then myDir="${1}"; else myDir="$PWD"; fi
echo "Starting [ blj_complete ] to reset status of modules before/including $myDir to --> \"biolockjComplete\""
Expand Down
2 changes: 1 addition & 1 deletion script/blj_download
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
## Users can copy the command and execute it from a local workstation. ##
## ##
############################################################################
. ${BLJ_SCRIPT}/blj_functions
. ${BLJ}/script/blj_functions

pipeline=$(most_recent_pipeline)
SUM=summary.txt
Expand Down
14 changes: 14 additions & 0 deletions script/blj_go
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

## This script navigates the $USER to their most recent pipeline and lists the current directory

. $BLJ/script/blj_functions

[ ! -d "${BLJ_PROJ}" ] && exit_script "Exit program - BLJ_PROJ: directory not found: ${BLJ_PROJ}" && return
pipeline=$(most_recent_pipeline)
if [ ${#pipeline} -gt 0 ]; then
echo "Goto latest BioLockJ pipeline: ${pipeline}"
cd "${pipeline}" && ls "${pipeline}"
else
echo "No pipelines found in BLJ_PROJ: ${BLJ_PROJ}"
fi
26 changes: 26 additions & 0 deletions script/blj_log
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash

# This script tails 1K lines from the current pipelines Java log file.
# If the current directory is not a BioLockJ pipeline, print last 1K lines from the most recent pipeline executed.
# If param is passed, pass it to tail command in place of -1000 parameter.

. $BLJ/script/blj_functions


pipeline=$(current_pipeline)
if [ ${#pipeline} -gt 0 ]; then
echo "Tail current BioLockJ pipeline log: $pipeline"
else
pipeline=$(most_recent_pipeline)
[ ${#pipeline} -gt 0 ] && echo "Tail most recent BioLockJ pipeline log: $pipeline"
fi

if [ ${#pipeline} -gt 0 ]; then
if [ ${#1} -gt 0 ]; then
\tail $1 $pipeline/*.log
else
\tail -1000 $pipeline/*.log
fi
else
echo "No pipelines found in BLJ_PROJ: ${BLJ_PROJ}"
fi
2 changes: 1 addition & 1 deletion script/blj_reset
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ main(){
echo "Reset complete."
}

. ${BLJ_SCRIPT}/blj_functions
. ${BLJ}/script/blj_functions

set_pipeline_dir(){
if $(is_pipeline_dir "$myDir"); then
Expand Down
18 changes: 18 additions & 0 deletions script/blj_summary
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash

# This script prints the Summary BioModule output of current pipeline.
# If the current directory is not a BioLockJ pipeline, print the summary of the most recent pipeline executed.

. $BLJ/script/blj_functions

pipeline=$(most_recent_pipeline)
SUM=summary.txt
if [ -f $SUM ]; then
echo "Print summary file: $SUM"
cat $SUM
elif [ ${#pipeline} -gt 0 ]; then
echo "Print summary file: $pipeline/$SUM"
cat "$pipeline/$SUM"
else
echo "No pipeline summary found in BLJ_PROJ: ${BLJ_PROJ}"
fi
2 changes: 1 addition & 1 deletion script/blj_test
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
## Otherwise exit script if any pipeline fails. ##
## ##
###########################################################################
. ${BLJ_SCRIPT}/blj_functions
. ${BLJ}/script/blj_functions


# Get pipeline status
Expand Down
2 changes: 1 addition & 1 deletion script/blj_user_arg_lib
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
## ##
###################################################################

. ${BLJ_SCRIPT}/blj_functions
. ${BLJ}/script/blj_functions

# example: take_standard_biolockj_args "$@"
take_standard_biolockj_args(){
Expand Down
66 changes: 0 additions & 66 deletions script/blj_user_lib

This file was deleted.

4 changes: 2 additions & 2 deletions script/docker_functions
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
## This script contains common functions used in BioLockJ. ##
## ##
###################################################################
. "${BLJ_SCRIPT}/docker_config"
. ${BLJ_SCRIPT}/blj_functions
. "${BLJ}/script/docker_config"
. ${BLJ}/script/blj_functions

alias bljb="build_blj_only"
alias bljd="build_blj_only; clearDock; push_blj_only"
Expand Down
4 changes: 2 additions & 2 deletions script/launch_aws
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ main(){
fi
}

. ${BLJ_SCRIPT}/blj_user_arg_lib
. ${BLJ_SCRIPT}/aws_functions
. ${BLJ}/script/blj_user_arg_lib
. ${BLJ}/script/aws_functions

main $@
4 changes: 2 additions & 2 deletions script/launch_docker
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ main(){
ifArgUsed $GUI_ARG && startBrowser # if the gui has its own docker container, this CMD would be defined there
}

. ${BLJ_SCRIPT}/blj_user_arg_lib
. ${BLJ_SCRIPT}/docker_config
. ${BLJ}/script/blj_user_arg_lib
. ${BLJ}/script/docker_config

# Read script args and bash env vars
# Param 1 - Array of launch_docker script args
Expand Down
4 changes: 2 additions & 2 deletions script/launch_java
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ main(){
after_java_start
}

. ${BLJ_SCRIPT}/blj_functions
. ${BLJ_SCRIPT}/blj_user_arg_lib
. ${BLJ}/script/blj_functions
. ${BLJ}/script/blj_user_arg_lib

# Make sure required variables exist and are valid
check_env_vars(){
Expand Down
2 changes: 1 addition & 1 deletion script/make_nextflow
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
## substituting "_" for each "." characters in the Java class name ##
################################################################################
. /app/biolockj/script/blj_config
. ${BLJ_SCRIPT}/aws_functions
. ${BLJ}/script/aws_functions

# Build the template file that NextflowUtil.java will use to create the pipeline main.nf
# Param 1 - All make_nextflow script args
Expand Down

0 comments on commit 3b18467

Please sign in to comment.