Fix crash when spawned job completes very fast
Description
Job can complete before we return from Job.span()
to
Scheduler._spawn_job()
, so that _active_jobs
would not yet contain
the job.
This would print a stack on the console and try to run a second time the job which can have unexpected effects.
In order to reproduce the issue, in
buildstream/_scheduler/jobs/job.py
, in Job.spawn
,
add a call to time.sleep()
right before call to
asyncio.get_child_watcher()
.
This merge request, when approved, will close: #857 (closed)