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

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

commit ebd0d02c1f4afc51cad9c503c49c7359fcddf223
Author: Oleksandr Polishchuk2 <[email protected]>
AuthorDate: Fri May 6 14:28:46 2022 +0300

    fixed conflict
---
 .../general/scripts/os/get_list_available_pkgs.py  | 42 ++++++++++++++++------
 1 file changed, 32 insertions(+), 10 deletions(-)

diff --git 
a/infrastructure-provisioning/src/general/scripts/os/get_list_available_pkgs.py 
b/infrastructure-provisioning/src/general/scripts/os/get_list_available_pkgs.py
index 86c84128c..c8f655347 100644
--- 
a/infrastructure-provisioning/src/general/scripts/os/get_list_available_pkgs.py
+++ 
b/infrastructure-provisioning/src/general/scripts/os/get_list_available_pkgs.py
@@ -42,16 +42,25 @@ def get_available_pip_pkgs(version):
     try:
         for _ in range(100):
             pip_pkgs = dict()
-            client = xmlrpc.client.ServerProxy('https://pypi.python.org/pypi')
-            raw_pkgs = client.browse(["Programming Language :: Python :: " + 
version + ""])
-            all_pkgs = [i[0] for i in raw_pkgs]
-            if len(all_pkgs) != 0:
-                for pkg in all_pkgs:
-                    pip_pkgs[pkg] = "N/A"
-                return pip_pkgs
-            else:
-                time.sleep(5)
-                continue
+            attempt = 0
+            while attempt < 3:
+                try:
+                    client = 
xmlrpc.client.ServerProxy('https://pypi.python.org/pypi')
+                    raw_pkgs = client.browse(["Programming Language :: Python 
:: " + version + ""])
+                    all_pkgs = [i[0] for i in raw_pkgs]
+                    if len(all_pkgs) != 0:
+                        for pkg in all_pkgs:
+                            pip_pkgs[pkg] = "N/A"
+                        return pip_pkgs
+                    else:
+                        time.sleep(5)
+                        continue
+                except:
+                    attempt += 1
+                    time.sleep(10)
+            if attempt == 3:
+                logging.info("Unable to get available pip packages")
+                raise Exception
     except Exception as err:
         print('Error: {0}'.format(err))
         sys.exit(1)
@@ -60,8 +69,13 @@ def get_available_pip_pkgs(version):
 def get_uncategorised_pip_pkgs(all_pkgs_pip2, all_pkgs_pip3):
     try:
         pip_pkgs = dict()
+<<<<<<< HEAD
         attempts = 0
         while attempts < 3:
+=======
+        attempt = 0
+        while attempt < 3:
+>>>>>>> 80e8ea9dc... [DATALAB-2768]: changed retrying cycle concept
             try:
                 client = 
xmlrpc.client.ServerProxy('https://pypi.python.org/pypi')
                 raw_pkgs = client.list_packages()
@@ -69,11 +83,19 @@ def get_uncategorised_pip_pkgs(all_pkgs_pip2, 
all_pkgs_pip3):
                 for pkg in raw_pkgs:
                     if pkg not in all_pkgs_pip2 and pkg not in all_pkgs_pip3:
                         all_pkgs_other.append(pkg)
+<<<<<<< HEAD
                 for pkg in all_pkgs_other:
                     pip_pkgs[pkg] = "N/A"
                 return pip_pkgs
             except:
                 attempts += 1
+=======
+                        for pkg in all_pkgs_other:
+                            pip_pkgs[pkg] = "N/A"
+                        return pip_pkgs
+            except:
+                attempt += 1
+>>>>>>> 80e8ea9dc... [DATALAB-2768]: changed retrying cycle concept
                 time.sleep(10)
         if attempt == 3:
             logging.info("Unable to get uncategorised pip packages")


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to