You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@datalab.apache.org by lf...@apache.org on 2022/11/02 14:47:35 UTC

[incubator-datalab] branch DATALAB-3084 updated: [DATALAB-3091]: added hdinsight kernels removal for jupyter

This is an automated email from the ASF dual-hosted git repository.

lfrolov pushed a commit to branch DATALAB-3084
in repository https://gitbox.apache.org/repos/asf/incubator-datalab.git


The following commit(s) were added to refs/heads/DATALAB-3084 by this push:
     new e6c332931 [DATALAB-3091]: added hdinsight kernels removal for jupyter
e6c332931 is described below

commit e6c3329314955e4f9d2eb195c14c09b34e351f17
Author: leonidfrolov <fr...@gmail.com>
AuthorDate: Wed Nov 2 16:47:24 2022 +0200

    [DATALAB-3091]: added hdinsight kernels removal for jupyter
---
 infrastructure-provisioning/src/general/lib/azure/actions_lib.py     | 5 +++++
 .../scripts/azure/jupyter_dataengine-service_create_configs.py       | 1 +
 .../scripts/azure/jupyter_install_dataengine-service_kernels.py      | 1 +
 3 files changed, 7 insertions(+)

diff --git a/infrastructure-provisioning/src/general/lib/azure/actions_lib.py b/infrastructure-provisioning/src/general/lib/azure/actions_lib.py
index 0b9182f9b..1bebb2f21 100644
--- a/infrastructure-provisioning/src/general/lib/azure/actions_lib.py
+++ b/infrastructure-provisioning/src/general/lib/azure/actions_lib.py
@@ -1193,6 +1193,11 @@ class AzureActions:
                                                                                                          cluster_name))
             if exists(conn, '/home/{}/.ensure_dir/hdinsight_secret_ensured'.format(os_user)):
                 conn.sudo("sed -i '/-access-password/d' /home/{}/.Renviron".format(os_user))
+            if exists(conn, '/home/{}/.ensure_dir/sparkmagic_kernels_ensured'.format(os_user)):
+                conn.sudo('rm -rf /home/{0}/.local/share/jupyter/kernels/pysparkkernel/ '
+                          '/home/{0}/.local/share/jupyter/kernels/sparkkernel/ '
+                          '/home/{0}/.sparkmagic/ '
+                          '/home/{0}/.ensure_dir/sparkmagic_kernels_ensured'.format(os_user))
             conn.sudo('rm -rf  /opt/' + cluster_name + '/')
             print("Notebook's {} kernels were removed".format(private))
         except Exception as err:
diff --git a/infrastructure-provisioning/src/general/scripts/azure/jupyter_dataengine-service_create_configs.py b/infrastructure-provisioning/src/general/scripts/azure/jupyter_dataengine-service_create_configs.py
index 488b782b6..40b468428 100644
--- a/infrastructure-provisioning/src/general/scripts/azure/jupyter_dataengine-service_create_configs.py
+++ b/infrastructure-provisioning/src/general/scripts/azure/jupyter_dataengine-service_create_configs.py
@@ -78,6 +78,7 @@ def install_sparkamagic_kernels(args):
         subprocess.run('sed -i \'s|HEADNODEIP:PORT|{0}:{2}|g\' /home/{1}/.sparkmagic/config.json'.format(
                 args.master_ip, args.os_user, args.livy_port, shell=True, check=True)
         subprocess.run('sudo chown -R {0}:{0} /home/{0}/.sparkmagic/'.format(args.os_user), shell=True, check=True)
+        subprocess.run('touch /home/{}/.ensure_dir/sparkmagic_kernels_ensured'.format(args.os_user), shell=True, check=True)
     except:
         sys.exit(1)
 
diff --git a/infrastructure-provisioning/src/general/scripts/azure/jupyter_install_dataengine-service_kernels.py b/infrastructure-provisioning/src/general/scripts/azure/jupyter_install_dataengine-service_kernels.py
index 5136a4873..e00f5251d 100644
--- a/infrastructure-provisioning/src/general/scripts/azure/jupyter_install_dataengine-service_kernels.py
+++ b/infrastructure-provisioning/src/general/scripts/azure/jupyter_install_dataengine-service_kernels.py
@@ -89,6 +89,7 @@ def install_sparkamagic_kernels(args):
         datalab.fab.conn.sudo('sed -i \'s|HEADNODEIP:PORT|{0}:{2}|g\' /home/{1}/.sparkmagic/config.json'.format(
                 args.master_ip, args.os_user, args.livy_port))
         datalab.fab.conn.sudo('chown -R {0}:{0} /home/{0}/.sparkmagic/'.format(args.os_user))
+        datalab.fab.conn.sudo('touch /home/{}/.ensure_dir/sparkmagic_kernels_ensured'.format(args.os_user))
     except:
         sys.exit(1)
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datalab.apache.org
For additional commands, e-mail: commits-help@datalab.apache.org