vatlab / sos-notebook

Multi-language Jupyter Notebook
http://vatlab.github.io/SoS
BSD 3-Clause "New" or "Revised" License
174 stars 17 forks source link

Making task execution in interactive non-blocking #303

Closed BoPeng closed 3 years ago

BoPeng commented 3 years ago

Right now when we run

task: ...

without

%run -q &

the cell will block, making the checking of job status not possible. It makes sense to make cells non-blocking if all tasks have been submitted.

BoPeng commented 3 years ago

The problem is that sos-notebook has a single execution thread for cell execution, so the task-execution process has to stop before users can run the next cell.

The solution would be moving the burden of checking task status to the controller so that the controller can continue to check the status and update notebook even sos notebook is working on other cells.

BoPeng commented 3 years ago

We need to rearrange the task execution logics.

Right now,

  1. The step executor creates the task, sends the task IDs to workflow executor, and put itself to sleep (with port waiting).
  2. The workflow executor submits the task, check the status of tasks of steps with status task_pendsing from time to time. After the task is done, it sends task results to substep, effectively wake up the substep for it to continue.

We need to move the job from workflow executor to controller so that workflow executor can terminate , basically,

  1. The step executor creates the task, sends the task IDs to workflow executor, and can terminate itself.
  2. The workflow executor submits the task and sends the IDs to controller.
  3. The workflow executor can terminate, or ask the controller the status of the tasks. The workflow executor can terminate and the task would continue to execute and complete as long as the controller is running,