Skip to content

Commit

Permalink
Remove all the dask support code from Lab startup
Browse files Browse the repository at this point in the history
  • Loading branch information
athornton committed Aug 30, 2023
1 parent 83ce534 commit 9a42472
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 51 deletions.
21 changes: 0 additions & 21 deletions modify_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

def main() -> None:
increase_log_limit()
remove_dask_url()


def increase_log_limit() -> None:
Expand Down Expand Up @@ -54,25 +53,5 @@ def write_limits_file(settings: dict) -> None:
json.dump(settings, f, sort_keys=True, indent=4)


def remove_dask_url() -> None:
for fn in WS_FILES:
process_ws_file(fn)


def process_ws_file(fn: str) -> None:
with open(fn) as f:
try:
contents = json.load(f)
except (OSError, json.decoder.JSONDecodeError) as e:
return # Skip file
try:
del contents["data"]["dask-dashboard-launcher"]["url"]
except KeyError:
return # if it ain't there, it ain't a problem
LOGGER.info(f"Removing Dask dashboard URL from workspace file {fn}")
with open(fn, "w") as f:
json.dump(contents, f, separators=(",", ":"))


if __name__ == "__main__":
main()
36 changes: 6 additions & 30 deletions runlab.sh
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,6 @@ function manage_access_token() {
fi
}

function copy_lsst_dask() {
mkdir -p "${HOME}/.config/dask"
cp "/opt/lsst/software/jupyterlab/lsst_dask.yml" "${HOME}/.config/dask/"
}

function reset_user_env() {
local now=$(date +%Y%m%d%H%M%S)
local reloc="${HOME}/.user_env.${now}"
Expand Down Expand Up @@ -150,13 +145,6 @@ function copy_etc_skel() {
done
}

function start_dask_worker() {
cmd="/opt/lsst/software/jupyterlab/lsstwrapdask.bash"
echo "Starting dask worker: ${cmd}"
exec ${cmd}
exit 0 # Not reached
}

function start_noninteractive() {
cmd="python3 -s \
/opt/lsst/software/jupyterlab/noninteractive/noninteractive"
Expand Down Expand Up @@ -272,29 +260,17 @@ fi
FIREFLY_HTML="slate.html"
export FIREFLY_URL FIREFLY_HTML
export JUPYTER_PREFER_ENV_PATH="no"
if [ -z "${JUPYTERHUB_SERVICE_PREFIX}" ]; then
# dask.distributed gets cranky if it's not there (since it is used
# in lsst_dask.yml); it will be for interactive use, and whether
# or not the proxy dashboard URL is correct doesn't matter in a
# noninteractive context.
JUPYTERHUB_SERVICE_PREFIX="${JUPYTERHUB_BASE_URL}user/${JUPYTERHUB_USER}"
export JUPYTERHUB_SERVICE_PREFIX
fi
# Fetch/update magic notebook. We want this in interactive, noninteractive,
# and Dask pods. We must have ${HOME} mounted but that is the case for
# all of those scenarios.
# Fetch/update magic notebook. We want this in interactive and noninteractive
# pods. We must have ${HOME} mounted but that is the case for both of those
# scenarios.
. /opt/lsst/software/jupyterlab/refreshnb.sh
eups admin clearCache
if [ -n "${DASK_WORKER}" ]; then
start_dask_worker
exit 0 # Not reached
elif [ -n "${NONINTERACTIVE}" ]; then
if [ -n "${NONINTERACTIVE}" ]; then
start_noninteractive
exit 0 # Not reached
else
# All of these tasks should only be run if we are an interactive lab,
# rather than a noninteractive lab or a Dask worker.
copy_lsst_dask
# These tasks should only be run if we are an interactive lab rather than
# a noninteractive lab.
modify_settings_files
manage_access_token
fi
Expand Down

0 comments on commit 9a42472

Please sign in to comment.