Skip to contentSkip to conversation

bitbake: cooker: clear up state on stateShutdown command

PATCH In review Alex DAMIAN 2 participants 3 messages Sep 10, 2013 – Sep 14, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bitbake: cooker: clear up state on stateShutdown command

From: Alexandru DAMIAN <[email protected]>

On resident bitbake server, a stateShutdown command (first Ctrl-C in client) will leave the server in an unusable state.

This patch forces the server to reload data and begin processing commands again, coping correctly with Ctrl-C commands.

bitbake/lib/bb/cooker.py +2 -1
index c3721aa..42eec2c 100644
@@ -1101,6 +1101,7 @@ class BBCooker:
                 rq.finish_runqueue(True)
             elif self.state == state.shutdown:
                 rq.finish_runqueue(False)
+                self.state = state.initial
             failures = 0
             try:
                 retval = rq.execute_runqueue()
@@ -1191,7 +1192,7 @@ class BBCooker:
         if self.state == state.running:
             return
 
-        if self.state in (state.shutdown, state.stop):
+        if self.state == state.stop:
             self.parser.shutdown(clean=False, force = True)
             sys.exit(1)
 
Signature · 1 line
1.8.1.2
#1 lore raw
Quoted 23 lines · Alex DAMIAN

From: Alexandru DAMIAN <[email protected]>

On resident bitbake server, a stateShutdown command (first Ctrl-C in client) will leave the server in an unusable state.

This patch forces the server to reload data and begin processing commands again, coping correctly with Ctrl-C commands.

bitbake/lib/bb/cooker.py +1 -0
index c3721aa..42eec2c 100644
@@ -1101,6 +1101,7 @@ class BBCooker:
                 rq.finish_runqueue(True)
             elif self.state == state.shutdown:
                 rq.finish_runqueue(False)
+                self.state = state.initial
             failures = 0
             try:
                 retval = rq.execute_runqueue()

bitbake/lib/bb/cooker.py class BBCooker: · line 1197

Quoted 7 lines
bitbake/lib/bb/cooker.py +1 -1
@@ -1191,7 +1192,7 @@ class BBCooker:
         if self.state == state.running:
             return
 
-        if self.state in (state.shutdown, state.stop):
+        if self.state == state.stop:
             self.parser.shutdown(clean=False, force = True)
             sys.exit(1)

This doesn't seem very intuitive. As I read the code above, "shutdown" means it sits and does nothing, "stop" means it exits? Surely these should be the other way around?

Cheers,

Richard

#2 lore raw
Quoted 27 lines · Richard Purdie
Quoted 26 lines · Alex DAMIAN

From: Alexandru DAMIAN <[email protected]>

On resident bitbake server, a stateShutdown command (first Ctrl-C in client) will leave the server in an unusable state.

This patch forces the server to reload data and begin processing commands again, coping correctly with Ctrl-C commands.

bitbake/lib/bb/cooker.py +1 -0
index c3721aa..42eec2c 100644
@@ -1101,6 +1101,7 @@ class BBCooker:
                 rq.finish_runqueue(True)
             elif self.state == state.shutdown:
                 rq.finish_runqueue(False)
+                self.state = state.initial
             failures = 0
             try:
                 retval = rq.execute_runqueue()
@@ -1191,7 +1192,7 @@ class BBCooker:
         if self.state == state.running:
             return
 
Quoted 8 lines

bitbake/lib/bb/cooker.py class BBCooker: · line 1197

Quoted 4 lines
bitbake/lib/bb/cooker.py +1 -1
-        if self.state in (state.shutdown, state.stop):
+        if self.state == state.stop:
             self.parser.shutdown(clean=False, force = True)
             sys.exit(1)

This doesn't seem very intuitive. As I read the code above, "shutdown" means it sits and does nothing, "stop" means it exits? Surely these should be the other way around?

For completeness, my patch series addresses the above problems in different ways. The underlying problems were the server not being reset to state.initial after a command failed and the sys.exit() call causing the server to exit.

Cheers,

Richard