Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IA-2965 update home dir for jupyter #2492

Merged
merged 19 commits into from Jan 24, 2022
Merged

IA-2965 update home dir for jupyter #2492

merged 19 commits into from Jan 24, 2022

Conversation

Qi77Qi
Copy link
Collaborator

@Qi77Qi Qi77Qi commented Jan 6, 2022

https://broadworkbench.atlassian.net/browse/IA-2756
https://broadworkbench.atlassian.net/browse/IA-2965

Main changes:

  1. PD is now mapped to $HOME inside Jupyter container
  2. <work>/.jupyter dir on the VM is deleted when runtimes are deleted so that when we create a new one, new jupyter process have a clean start
  3. Jupyter container is restarted in startup script becuz we're resetting PYTHONPATH and PATH to new path that doesn't have /notebooks. Because of this we need to re-copy startup script into the new container, and re-fix welder path for dataproc.
  4. We're updating jupyter_notebook_config.py so that it doesn't have /notebooks as dir for notebooks

Tested manually:
Create a VM with develop branch that has home/jupyter/notebooks as work dir. Deploy a new leo with this branch, and see if the following works as expected on the same VM

  • pausing
  • resuming
  • deleting but keep the VM, and create a new VM with the same PD

Have you read CONTRIBUTING.md lately? If not, do that first.

I, the developer opening this PR, do solemnly pinky swear that:

  • I've documented my API changes in Swagger

In all cases:

  • Get a thumbsworth of review and PO signoff if necessary
  • Verify all tests go green (you can re-run automation tests with a comment saying jenkins retest
  • Run the automation tests multiple times in parallel to weed out instability if applicable via a comment saying multi-test
  • Squash and merge; Delete your branch after this
  • Test this change deployed correctly and works on dev environment after deployment

@Qi77Qi Qi77Qi force-pushed the pdMount branch 2 times, most recently from cf7804a to e601f31 Compare January 8, 2022 01:24
@Qi77Qi
Copy link
Collaborator Author

Qi77Qi commented Jan 8, 2022

jenkins retest

@Qi77Qi
Copy link
Collaborator Author

Qi77Qi commented Jan 14, 2022

jenkins retest

@codecov
Copy link

codecov bot commented Jan 14, 2022

Codecov Report

Merging #2492 (512e6b7) into develop (491e128) will increase coverage by 0.01%.
The diff coverage is 87.50%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #2492      +/-   ##
===========================================
+ Coverage    75.30%   75.31%   +0.01%     
===========================================
  Files          113      113              
  Lines         8705     8711       +6     
  Branches       148      144       -4     
===========================================
+ Hits          6555     6561       +6     
  Misses        2150     2150              
Impacted Files Coverage Δ
.../workbench/leonardo/util/DataprocInterpreter.scala 59.85% <33.33%> (ø)
...rkbench/leonardo/util/BaseRuntimeInterpreter.scala 66.66% <100.00%> (+0.34%) ⬆️
...te/dsde/workbench/leonardo/util/BucketHelper.scala 74.71% <100.00%> (+1.21%) ⬆️
.../dsde/workbench/leonardo/util/GceInterpreter.scala 72.89% <100.00%> (ø)
...orkbench/leonardo/util/RuntimeTemplateValues.scala 97.84% <100.00%> (+0.02%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 491e128...512e6b7. Read the comment docs.

@@ -31,6 +31,10 @@ services:
PIP_USER: "false"
PIP_TARGET: "${NOTEBOOKS_DIR}/packages"
R_LIBS: "${NOTEBOOKS_DIR}/packages"
# The next two lines aren't great. But they're for updating PYTHONPATH, PATH in older than (inclusive) us.gcr.io/broad-dsp-gcr-public/terra-jupyter-base:1.0.2
# We should remove the two lines once we no longer support older images. In the meantime, we need to be careful updating Jupyter base images.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be nice if we could link a ticket here. Seems like one of those things we'd forget to update even if we did no longer support the older images

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's a bit unclear what the condition will be for the ticket. So for now, I'm adding a comment and added date when the comment is added

@@ -68,6 +67,7 @@ export START_USER_SCRIPT_URI=$(startUserScriptUri)
export START_USER_SCRIPT_OUTPUT_URI=$(startUserScriptOutputUri)
export WELDER_MEM_LIMIT=$(welderMemLimit)
export MEM_LIMIT=$(memLimit)
export INIT_BUCKET_NAME=$(initBucketName)
export USE_GCE_STARTUP_SCRIPT=$(useGceStartupScript)
GPU_ENABLED=$(gpuEnabled)
export IS_RSTUDIO_RUNTIME="false" # TODO: update to commented out code once we release Rmd file syncing
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not related to this ticket, but is this TODO still valid?

RMD file syncing is released currently as far as I'm aware. cc @gpcarr

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's turned off for now. Once @gpcarr 's current rmd ticket is done, we should be able to turn it back on

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah it's still valid - we're hardcoding to false until everything is in place for Rmd file syncing. I'm not sure we'd be able to turn it on when my backend changes are done though, I think we'd need to wait for the frontend to be ready as well

# This condition assumes Dataproc's cert directory is different from GCE's cert directory, a better condition would be
# a dedicated flag that distinguishes gce and dataproc. But this will do for now
# If it's GCE, we resize the PD. Dataproc doesn't have PD
if [ -f "$FILE" ]; then
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe make a ticket to template the cloudService in here, would be nice not too rely on this as it could change and break this in an unexpected way;

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -209,7 +213,8 @@ abstract private[util] class BaseRuntimeInterpreter[F[_]](
}

// Shutdown script to run after the runtime is paused
protected def getShutdownScript(runtimeAndRuntimeConfig: RuntimeAndRuntimeConfig): F[Map[String, String]] = {
protected def getShutdownScript(runtimeAndRuntimeConfig: RuntimeAndRuntimeConfig,
shouldDeleteJupyterDir: Boolean): F[Map[String, String]] = {
Copy link
Collaborator

@jdcanas jdcanas Jan 21, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what exactly is the use case for this flag?

Is the intent to cleanup old /notebooks dirs that exist from before this change? depending on how important the use case is, might be worth having a test where this is true to verify the functionality (I see tests where it is true, but not sure if its verified)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The flag is to tell whether shutdown script should delete .jupyter dir during shutting down. It's only true when it's GCE VM and user wants to delete the VM.

It'll have issue if we create runtimes with different images using the same PD. Will update RuntimeCreationDiskSpec to verify that

Copy link
Collaborator

@jdcanas jdcanas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly looks good, a couple nits

@Qi77Qi
Copy link
Collaborator Author

Qi77Qi commented Jan 24, 2022

multi-test

1 similar comment
@Qi77Qi
Copy link
Collaborator Author

Qi77Qi commented Jan 24, 2022

multi-test

@Qi77Qi
Copy link
Collaborator Author

Qi77Qi commented Jan 24, 2022

out of the 3 multi test runs, 1 passed, 1 failed at fiab-start, 1 failed with one test failure due to Sam error

Copy link
Contributor

@gpcarr gpcarr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm :shipit:

@Qi77Qi Qi77Qi merged commit 1ebc44e into develop Jan 24, 2022
@Qi77Qi Qi77Qi deleted the pdMount branch January 24, 2022 20:11
@Qi77Qi Qi77Qi changed the title IA-2756 update home dir for jupyter IA-2965 update home dir for jupyter Jan 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants