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 2021/02/03 10:24:27 UTC

[incubator-datalab] 02/02: [DATALAB-2091]: removed lcd(

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

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

commit 165142dd6339c0ec3160ab3ed39b9d2dacd1d260
Author: leonidfrolov <fr...@gmail.com>
AuthorDate: Wed Feb 3 12:24:07 2021 +0200

    [DATALAB-2091]: removed lcd(
---
 .../scripts/deploy_datalab.py                       |  9 ++++-----
 .../src/general/lib/aws/actions_lib.py              |  9 +++------
 .../src/general/lib/gcp/actions_lib.py              |  8 +++-----
 .../azure/common_notebook_update_refresh_token.py   |  1 -
 .../src/ssn/scripts/docker_build.py                 | 21 +++++++++------------
 5 files changed, 19 insertions(+), 29 deletions(-)

diff --git a/infrastructure-provisioning/scripts/deploy_datalab.py b/infrastructure-provisioning/scripts/deploy_datalab.py
index a3a07ee..6d7a750 100644
--- a/infrastructure-provisioning/scripts/deploy_datalab.py
+++ b/infrastructure-provisioning/scripts/deploy_datalab.py
@@ -197,12 +197,11 @@ def generate_docker_command():
 
 def build_docker_images(args):
     # Building base and ssn docker images
-    with lcd(args.workspace_path):
-        local('sudo docker build --build-arg OS={0} --build-arg SRC_PATH="infrastructure-provisioning/src/" --file '
+    local('cd {2}; sudo docker build --build-arg OS={0} --build-arg SRC_PATH="infrastructure-provisioning/src/" --file '
               'infrastructure-provisioning/src/general/files/{1}/'
-              'base_Dockerfile -t docker.datalab-base .'.format(args.conf_os_family, args.conf_cloud_provider))
-        local('sudo docker build --build-arg OS={0} --file infrastructure-provisioning/src/general/files/{1}/'
-              'ssn_Dockerfile -t docker.datalab-ssn .'.format(args.conf_os_family, args.conf_cloud_provider))
+              'base_Dockerfile -t docker.datalab-base .'.format(args.conf_os_family, args.conf_cloud_provider, args.workspace_path))
+    local('cd {2}; sudo docker build --build-arg OS={0} --file infrastructure-provisioning/src/general/files/{1}/'
+              'ssn_Dockerfile -t docker.datalab-ssn .'.format(args.conf_os_family, args.conf_cloud_provider, args.workspace_path))
 
 
 def deploy_datalab(args):
diff --git a/infrastructure-provisioning/src/general/lib/aws/actions_lib.py b/infrastructure-provisioning/src/general/lib/aws/actions_lib.py
index a3580e5..3f31ae1 100644
--- a/infrastructure-provisioning/src/general/lib/aws/actions_lib.py
+++ b/infrastructure-provisioning/src/general/lib/aws/actions_lib.py
@@ -1529,12 +1529,9 @@ def installing_python(region, bucket, user_name, cluster_name, application='', p
         local('wget https://www.python.org/ftp/python/' + python_version +
               '/Python-' + python_version + '.tgz -O /tmp/Python-' + python_version + '.tgz')
         local('tar zxvf /tmp/Python-' + python_version + '.tgz -C /tmp/')
-        with lcd('/tmp/Python-' + python_version):
-            local('./configure --prefix=/opt/python/python' + python_version +
-                  ' --with-zlib-dir=/usr/local/lib/ --with-ensurepip=install')
-            local('sudo make altinstall')
-        with lcd('/tmp/'):
-            local('sudo rm -rf Python-' + python_version + '/')
+        local('cd /tmp/Python-{0}; ./configure --prefix=/opt/python/python{0} --with-zlib-dir=/usr/local/lib/ --with-ensurepip=install'.format(python_version))
+        local('cd /tmp/Python-{0}; sudo make altinstall'.format(python_version))
+        local('cd /tmp/; sudo rm -rf Python-' + python_version + '/')
         if region == 'cn-north-1':
             local('sudo -i /opt/python/python{}/bin/python{} -m pip install -U pip=={} --no-cache-dir'.format(
                 python_version, python_version[0:3], os.environ['conf_pip_version']))
diff --git a/infrastructure-provisioning/src/general/lib/gcp/actions_lib.py b/infrastructure-provisioning/src/general/lib/gcp/actions_lib.py
index 015d354..fc95c91 100644
--- a/infrastructure-provisioning/src/general/lib/gcp/actions_lib.py
+++ b/infrastructure-provisioning/src/general/lib/gcp/actions_lib.py
@@ -1302,11 +1302,9 @@ class GCPActions:
             if not os.path.exists('/opt/python/python{}'.format(python_version)):
                 local('wget https://www.python.org/ftp/python/{0}/Python-{0}.tgz -O /tmp/Python-{0}.tgz'.format(python_version))
                 local('tar zxvf /tmp/Python-{}.tgz -C /tmp/'.format(python_version))
-                with lcd('/tmp/Python-{}'.format(python_version)):
-                    local('./configure --prefix=/opt/python/python{} --with-zlib-dir=/usr/local/lib/ --with-ensurepip=install'.format(python_version))
-                    local('sudo make altinstall')
-                with lcd('/tmp/'):
-                    local('sudo rm -rf Python-{}/'.format(python_version))
+                local('cd /tmp/Python-{0}; ./configure --prefix=/opt/python/python{0} --with-zlib-dir=/usr/local/lib/ --with-ensurepip=install'.format(python_version))
+                local('cd /tmp/Python-{}; sudo make altinstall'.format(python_version))
+                local('cd /tmp/; sudo rm -rf Python-{}/'.format(python_version))
                 local('sudo -i virtualenv /opt/python/python{}'.format(python_version))
                 venv_command = 'source /opt/python/python{}/bin/activate'.format(python_version)
                 pip_command = '/opt/python/python{0}/bin/pip{1}'.format(python_version, python_version[:3])
diff --git a/infrastructure-provisioning/src/general/scripts/azure/common_notebook_update_refresh_token.py b/infrastructure-provisioning/src/general/scripts/azure/common_notebook_update_refresh_token.py
index ffef0f7..0b8d07d 100644
--- a/infrastructure-provisioning/src/general/scripts/azure/common_notebook_update_refresh_token.py
+++ b/infrastructure-provisioning/src/general/scripts/azure/common_notebook_update_refresh_token.py
@@ -27,7 +27,6 @@ import argparse
 import os
 import sys
 import time
-from fabric import lcd
 from fabric.contrib.files import exists
 
 parser = argparse.ArgumentParser()
diff --git a/infrastructure-provisioning/src/ssn/scripts/docker_build.py b/infrastructure-provisioning/src/ssn/scripts/docker_build.py
index 709f61c..9347d6b 100644
--- a/infrastructure-provisioning/src/ssn/scripts/docker_build.py
+++ b/infrastructure-provisioning/src/ssn/scripts/docker_build.py
@@ -60,18 +60,15 @@ def image_build(src_path, node):
                 local('cp /home/datalab-user/keys/azure_auth.json {}base/azure_auth.json'.format(src_path))
         else:
             cloud_provider = 'gcp'
-        with lcd(src_path):
-            local(
-                'docker build --build-arg OS={0} --build-arg SRC_PATH= --file general/files/{1}/base_Dockerfile -t docker.datalab-base:latest .'.format(
-                    os_family, cloud_provider))
-            try:
-                for i in range(len(node)):
-                    local(
-                        'docker build --build-arg OS={0} --file general/files/{1}/{2}_Dockerfile -t docker.datalab-{2} .'.format(
-                            os_family, cloud_provider, node[i]))
-            except Exception as err:
-                print("Failed to build {} image".format(node[i]), str(err))
-                raise Exception
+        local('cd {2}; docker build --build-arg OS={0} --build-arg SRC_PATH= --file general/files/{1}/base_Dockerfile -t docker.datalab-base:latest .'.format(
+                    os_family, cloud_provider, src_path))
+        try:
+            for i in range(len(node)):
+                local('cd {3}; docker build --build-arg OS={0} --file general/files/{1}/{2}_Dockerfile -t docker.datalab-{2} .'.format(
+                            os_family, cloud_provider, node[i], src_path))
+        except Exception as err:
+            print("Failed to build {} image".format(node[i]), str(err))
+            raise Exception
     except Exception as err:
         traceback.print_exc()
         sys.exit(1)


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