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/09 09:19:00 UTC

[incubator-datalab] 01/02: [DATALAB-2091]: added sys.exit to init_datalab_connection

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 0f548894557dc2ec49468a8358055af28d5e482d
Author: leonidfrolov <fr...@gmail.com>
AuthorDate: Mon Feb 8 17:42:48 2021 +0200

    [DATALAB-2091]: added sys.exit to init_datalab_connection
---
 .../src/general/lib/os/fab.py                      | 29 ++++++++++++----------
 1 file changed, 16 insertions(+), 13 deletions(-)

diff --git a/infrastructure-provisioning/src/general/lib/os/fab.py b/infrastructure-provisioning/src/general/lib/os/fab.py
index 6bf93b8..10abc45 100644
--- a/infrastructure-provisioning/src/general/lib/os/fab.py
+++ b/infrastructure-provisioning/src/general/lib/os/fab.py
@@ -1008,16 +1008,19 @@ def close_connection():
     conn.close()
 
 def init_datalab_connection(ip, user, pkey):
-    global conn
-    attempt = 0
-    while attempt < 100:
-        logging.info('connection attempt {}'.format(attempt))
-        conn = Connection(ip, user, connect_kwargs={'key_filename': pkey})
-        try:
-            conn.run('ls')
-            return conn
-        except Exception as ex:
-            logging.error(ex)
-            traceback.print_exc()
-            attempt += 1
-            time.sleep(10)
\ No newline at end of file
+    try:
+        global conn
+        attempt = 0
+        while attempt < 100:
+            logging.info('connection attempt {}'.format(attempt))
+            conn = Connection(ip, user, connect_kwargs={'key_filename': pkey})
+            try:
+                conn.run('ls')
+                return conn
+            except Exception as ex:
+                logging.error(ex)
+                traceback.print_exc()
+                attempt += 1
+                time.sleep(10)
+    except:
+        sys.exit(1)
\ No newline at end of file


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