3
0
Fork 0
mirror of https://github.com/YosysHQ/sby.git synced 2025-04-06 14:24:08 +00:00

Fix bug in handling of chained tasks

Signed-off-by: Clifford Wolf <clifford@clifford.at>
This commit is contained in:
Clifford Wolf 2018-05-01 14:58:18 +02:00
parent 21d9e5d66f
commit 162bdc9a3b

View file

@ -44,7 +44,7 @@ class SbyTask:
self.output_callback = None self.output_callback = None
self.exit_callback = None self.exit_callback = None
self.job.tasks_all.append(self) self.job.tasks_pending.append(self)
def register_dep(self, next_task): def register_dep(self, next_task):
if self.finished: if self.finished:
@ -93,6 +93,7 @@ class SbyTask:
stderr=(subprocess.STDOUT if self.logstderr else None)) stderr=(subprocess.STDOUT if self.logstderr else None))
fl = fcntl.fcntl(self.p.stdout, fcntl.F_GETFL) fl = fcntl.fcntl(self.p.stdout, fcntl.F_GETFL)
fcntl.fcntl(self.p.stdout, fcntl.F_SETFL, fl | os.O_NONBLOCK) fcntl.fcntl(self.p.stdout, fcntl.F_SETFL, fl | os.O_NONBLOCK)
self.job.tasks_pending.remove(self)
self.job.tasks_running.append(self) self.job.tasks_running.append(self)
self.running = True self.running = True
return return
@ -155,7 +156,7 @@ class SbyJob:
} }
self.tasks_running = [] self.tasks_running = []
self.tasks_all = [] self.tasks_pending = []
self.start_clock_time = time() self.start_clock_time = time()
@ -175,10 +176,10 @@ class SbyJob:
print(line, file=f) print(line, file=f)
def taskloop(self): def taskloop(self):
for task in self.tasks_all: for task in self.tasks_pending:
task.poll() task.poll()
while len(self.tasks_running): while len(self.tasks_running) or len(self.tasks_pending):
fds = [] fds = []
for task in self.tasks_running: for task in self.tasks_running:
if task.running: if task.running:
@ -192,6 +193,9 @@ class SbyJob:
for task in self.tasks_running: for task in self.tasks_running:
task.poll() task.poll()
for task in self.tasks_pending:
task.poll()
if self.opt_timeout is not None: if self.opt_timeout is not None:
total_clock_time = int(time() - self.start_clock_time) total_clock_time = int(time() - self.start_clock_time)
if total_clock_time > self.opt_timeout: if total_clock_time > self.opt_timeout: