Patchwork [bitbake-devel,1/2] monitordisk: update return value

login
register
mail settings
Submitter Kang Kai
Date July 24, 2012, 7:04 a.m.
Message ID <cb139de49946bb1ae88ccffa25d78996ce7d0184.1343113295.git.kai.kang@windriver.com>
Download mbox | patch
Permalink /patch/32907/
State New
Headers show

Comments

Kang Kai - July 24, 2012, 7:04 a.m.
update function check()'s return value of class diskMonitor. When
runqueue is terminated by disk monitor, cooker has a chance to deal this
situation accordingly.

Signed-off-by: Kang Kai <kai.kang@windriver.com>
---
 bitbake/lib/bb/monitordisk.py |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

Patch

diff --git a/bitbake/lib/bb/monitordisk.py b/bitbake/lib/bb/monitordisk.py
index 9469193..ac6f9be 100644
--- a/bitbake/lib/bb/monitordisk.py
+++ b/bitbake/lib/bb/monitordisk.py
@@ -200,7 +200,11 @@  class diskMonitor:
 
     def check(self, rq):
 
-        """ Take action for the monitor """
+        """
+        Take action for the monitor.
+        Return True to tell cooker that runqueue is terminated by disk monitor.
+        This return value is useful for UIs such as Hob.
+        """
 
         if self.enableMonitor:
             for dev in self.devDict:
@@ -219,10 +223,12 @@  class diskMonitor:
                         logger.error("No new tasks can be excuted since the disk space monitor action is \"STOPTASKS\"!")
                         self.checked[dev] = True
                         rq.finish_runqueue(False)
+                        return True
                     elif self.devDict[dev][0] == "ABORT" and not self.checked[dev]:
                         logger.error("Immediately abort since the disk space monitor action is \"ABORT\"!")
                         self.checked[dev] = True
                         rq.finish_runqueue(True)
+                        return True
 
                 # The free inodes, float point number
                 freeInode = st.f_favail
@@ -237,8 +243,10 @@  class diskMonitor:
                         logger.error("No new tasks can be excuted since the disk space monitor action is \"STOPTASKS\"!")
                         self.checked[dev] = True
                         rq.finish_runqueue(False)
+                        return True
                     elif self.devDict[dev][0]  == "ABORT" and not self.checked[dev]:
                         logger.error("Immediately abort since the disk space monitor action is \"ABORT\"!")
                         self.checked[dev] = True
                         rq.finish_runqueue(True)
-        return
+                        return True
+        return False