team-monolith-product / jupyterlab-judge

A simple online judge for Jupyter Lab.
BSD 3-Clause "New" or "Revised" License
4 stars 0 forks source link

Make idle waiting more robust #23

Closed a3626a closed 1 year ago

a3626a commented 1 year ago

Several 'Kernel is not responding. Please try again.' Errors are reported. We have deeply investigated this issue. We expect 40% of the cases would be solved by this change.

kernelDisplayStatus is quite complicated value derived from connection status and context status.

get kernelDisplayStatus(): ISessionContext.KernelDisplayStatus {
  const kernel = this.session?.kernel;

  if (this._isTerminating) {
    return 'terminating';
  }

  if (this._isRestarting) {
    return 'restarting';
  }

  if (this._pendingKernelName === this.noKernelName) {
    return 'unknown';
  }

  if (!kernel && this._pendingKernelName) {
    return 'initializing';
  }

  if (
    !kernel &&
    !this.isReady &&
    this.kernelPreference.canStart !== false &&
    this.kernelPreference.shouldStart !== false
  ) {
    return 'initializing';
  }

  return (
    (kernel?.connectionStatus === 'connected'
      ? kernel?.status
      : kernel?.connectionStatus) ?? 'unknown'
  );
}

So listening to 'statusChanged' signal has so many holes to cause endless waiting.