From d1dd6453f8ac3697fc5f620de5abf6de9825df5e Mon Sep 17 00:00:00 2001 From: Jeremy Nicklas <jnicklas@osc.edu> Date: Fri, 26 Jan 2018 12:53:52 -0500 Subject: [PATCH] speed up load time --- CHANGELOG.md | 4 ++++ template/after.sh | 3 +++ template/before.sh.erb | 3 +++ template/script.sh.erb | 12 +++++++++++- 4 files changed, 21 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7e0920c..fb2a001 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Changed +- Increased verbosity of output to make debugging easier. +- Does not launch template script as login shell anymore to speed up load time. + ### Fixed - Fix job not ending if forked processes still running. diff --git a/template/after.sh b/template/after.sh index b6a344a..1d43fce 100755 --- a/template/after.sh +++ b/template/after.sh @@ -1,9 +1,12 @@ # Wait for the Jupyter Notebook server to start echo "Waiting for Jupyter Notebook server to open port ${port}..." +echo "TIMING - Starting wait at: $(date)" if wait_until_port_used "${host}:${port}" 60; then echo "Discovered Jupyter Notebook server listening on port ${port}!" + echo "TIMING - Wait ended at: $(date)" else echo "Timed out waiting for Jupyter Notebook server to open port ${port}!" + echo "TIMING - Wait ended at: $(date)" pkill -P ${SCRIPT_PID} clean_up 1 fi diff --git a/template/before.sh.erb b/template/before.sh.erb index 2460f3b..8c9a650 100755 --- a/template/before.sh.erb +++ b/template/before.sh.erb @@ -26,6 +26,9 @@ # - $password # The plain text password used to authenticate to the web server with +# Export the module function if it exists +[[ $(type -t module) == "function" ]] && export -f module + # Find available port to run server on port=$(find_port) diff --git a/template/script.sh.erb b/template/script.sh.erb index f0d5eb4..718951c 100755 --- a/template/script.sh.erb +++ b/template/script.sh.erb @@ -1,4 +1,7 @@ -#!/bin/bash -l +#!/usr/bin/env bash + +# Benchmark info +echo "TIMING - Starting main script at: $(date)" # Set working directory to home directory cd "${HOME}" @@ -13,7 +16,14 @@ module purge # Load the require modules module load <%= context.modules %> + +# List loaded modules +module list <%- end -%> +# Benchmark info +echo "TIMING - Starting jupyter at: $(date)" + # Launch the Jupyter Notebook Server +set -x jupyter notebook --config="${CONFIG_FILE}" <%= context.extra_jupyter_args %> -- GitLab