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/03/12 08:24:18 UTC

[incubator-datalab] branch DLAB-1527 created (now 277876f)

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

lfrolov pushed a change to branch DLAB-1527
in repository https://gitbox.apache.org/repos/asf/incubator-datalab.git.


      at 277876f  [DATALAB-1527]: added handling of lock during apt update

This branch includes the following new commits:

     new 277876f  [DATALAB-1527]: added handling of lock during apt update

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



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


[incubator-datalab] 01/01: [DATALAB-1527]: added handling of lock during apt update

Posted by lf...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 277876f74c5d0784d0038bfa2b11c06d4727ec16
Author: leonidfrolov <fr...@gmail.com>
AuthorDate: Fri Mar 12 10:24:05 2021 +0200

    [DATALAB-1527]: added handling of lock during apt update
---
 .../src/general/lib/os/debian/common_lib.py        | 22 ++++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)

diff --git a/infrastructure-provisioning/src/general/lib/os/debian/common_lib.py b/infrastructure-provisioning/src/general/lib/os/debian/common_lib.py
index 6d6dcf5..a822bac 100644
--- a/infrastructure-provisioning/src/general/lib/os/debian/common_lib.py
+++ b/infrastructure-provisioning/src/general/lib/os/debian/common_lib.py
@@ -44,7 +44,8 @@ def manage_pkg(command, environment, requisites):
                         time.sleep(10)
                     else:
                         try:
-                            error_parser = "frontend is locked|locked"
+                            error_parser = "frontend is locked|locked|not get lock|unavailable"
+
                             sudo('dpkg --configure -a 2>&1 | tee /tmp/tee.tmp; if ! grep -w -E "({0})" /tmp/tee.tmp > '
                                      '/tmp/dpkg.log; then echo "" > /tmp/dpkg.log;fi'.format(error_parser))
                             err = sudo('cat /tmp/dpkg.log')
@@ -62,13 +63,26 @@ def manage_pkg(command, environment, requisites):
                                      '/tmp/dpkg.log; then echo "" > /tmp/dpkg.log;fi'.format(error_parser))
                                 err = sudo('cat /tmp/dpkg.log')
                                 count = count + 1
-                            sudo('apt update')
 
-                            sudo('apt-get {0} {1} 2>&1 | tee /tmp/tee.tmp; if ! grep -w -E "({2})" /tmp/tee.tmp > '
-                                 '/tmp/apt.log; then echo "" > /tmp/apt.log;fi'.format(command, requisites, error_parser))
+                            sudo('apt update 2>&1 | tee /tmp/tee.tmp; if ! grep -w -E "({0})" /tmp/tee.tmp > '
+                                 '/tmp/apt.log; then echo "" > /tmp/apt.log;fi'.format(error_parser))
                             err = sudo('cat /tmp/apt.log')
                             count = 0
                             while err != '' and count < 10:
+                                pid = sudo('lsof /var/lib/apt/lists/lock | grep apt | awk \'{print $2}\'')
+                                if pid != '':
+                                    sudo('kill -9 {}'.format(pid))
+                                    sudo('rm -f /var/lib/apt/lists/lock')
+                                sudo('apt update 2>&1 | tee /tmp/tee.tmp; if ! grep -w -E "({0})" /tmp/tee.tmp > '
+                                 '/tmp/apt.log; then echo "" > /tmp/apt.log;fi'.format(error_parser))
+                                err = sudo('cat /tmp/apt.log')
+                                count = count + 1
+
+                            sudo('apt-get {0} {1} 2>&1 | tee /tmp/tee.tmp; if ! grep -w -E "({2})" /tmp/tee.tmp > '
+                                 '/tmp/apt.log; then echo "" > /tmp/apt-get.log;fi'.format(command, requisites, error_parser))
+                            err = sudo('cat /tmp/apt-get.log')
+                            count = 0
+                            while err != '' and count < 10:
                                 sudo('lsof /var/lib/dpkg/lock')
                                 sudo('lsof /var/lib/apt/lists/lock')
                                 sudo('lsof /var/cache/apt/archives/lock')


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