Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Display initial loading message in terminal #6957

Closed
wants to merge 4 commits into from

Conversation

vitaliy-guliy
Copy link
Contributor

Signed-off-by: Vitaliy Gulyy vgulyy@redhat.com

What it does

It's a solution proposal.

On slow infrastructures after running a task user has to wait for several seconds until task terminal is appeared. On che.openshift.io where an extension of Theia is running, this delay is around 5 seconds.

The main idea is to open a terminal immediately when the user asked for running a task.
Terminal should have an initial message e.g. Task '${taskLabel}' - Connecting...

Solves issue eclipse-che/che#15277

The corresponding issue into Theia repository and demo videos demonstrating the problem will be created and recorded.

How to test

  • Run Theia on slow infrastructure
  • Go to che.openshift.io, create your workspace and test

Review checklist

Reminder for reviewers

Signed-off-by: Vitaliy Gulyy <vgulyy@redhat.com>
@akosyakov
Copy link
Member

@vitaliy-guliy is there a way to reproduce with the vanilla Theia on master with system connection throttling? It would help to see the issue more clear and compare with the behavior proposed in the PR. Reproduction steps would help, thank you.

@akosyakov akosyakov added proposal feature proposals (potential future features) tasks issues related to the task system labels Jan 23, 2020
export class TaskTerminal {

@inject(WidgetManager)
protected readonly widgetManager: WidgetManager;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use termialservice, it is responsible to create terminals and hides the logic of working with widhermanager


@injectable()
export class TaskTerminal {

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TaskTerminal will mean that it provides an access to a terminal for a task. This class seems to be responsible to manage many tasks terminals. TakTerminalManager or TaskTerminalService would be the better name. Also it will be aligned with other wrappers around WidgetManager, e.g. EditorManager, TerminalService and so on

@inject(ApplicationShell)
protected readonly shell: ApplicationShell;

protected terminalWidgets: TerminalWidget[] = [];
Copy link
Member

@akosyakov akosyakov Jan 23, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a single place which keeps references to all widget. It’s WidgetManager, please use its methods to look up terminal widgets, don’t cache it. Caching is common cause of race conditions, memory leaks and so on

/**
* Initial message to be displayed while terminal is not started.
*/
readonly loadingMessage?: string;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should test reload page reload. What would you expect should happen? We try to preserve terminals. I assume terminal should appear immediately with loading message till connection to the task process is not recovered. We need ways to test it with the vanilla Theia.

@@ -193,6 +194,24 @@ export class TerminalWidgetImpl extends TerminalWidget implements StatefulWidget
for (const contribution of this.terminalContributionProvider.getContributions()) {
contribution.onCreate(this);
}

if (this.options.loadingMessage) {
this.loadingMessage = document.createElement('div');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use css, you can find css guidance in our coding guidelines


protected terminalWidgets: TerminalWidget[] = [];

async openEmptyTerminal(taskLabel: string): Promise<void> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about returning a widget id here and passing it to attach later to avoid guessing?

@@ -454,6 +459,9 @@ export class TaskService implements TaskConfigurationClient {
* It looks for configured and detected tasks.
*/
async run(source: string, taskLabel: string, scope?: string): Promise<TaskInfo | undefined> {
// Open an empty terminal, display a message informing the user that terminal is starting
await this.taskTerminal.openEmptyTerminal(taskLabel);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see that code below can exit without reaching attach ever what should happen with the terminal then?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@elaihau can a task be executed without the terminal? background tasks?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vitaliy-guliy
Maybe it's not good place for creating a new terminal widget, for example here a task can be terminated or restarted, so how is a new terminal widget handled for this case?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@elaihau can a task be executed without the terminal? background tasks?

@akosyakov sorry for replying so late.
as far as I can tell, we create terminalProcess for all tasks.

@marechal-p please correct me if i am wrong

@akosyakov
Copy link
Member

@vitaliy-guliy let us know if you need help to prepare a test case for the vanilla Theia

Signed-off-by: Vitaliy Guliy <vgulyy@redhat.com>
@@ -454,6 +459,9 @@ export class TaskService implements TaskConfigurationClient {
* It looks for configured and detected tasks.
*/
async run(source: string, taskLabel: string, scope?: string): Promise<TaskInfo | undefined> {
// Open an empty terminal, display a message informing the user that terminal is starting
await this.taskTerminal.openEmptyTerminal(taskLabel);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vitaliy-guliy
Maybe it's not good place for creating a new terminal widget, for example here a task can be terminated or restarted, so how is a new terminal widget handled for this case?

@@ -54,6 +54,7 @@ export class TerminalWidgetImpl extends TerminalWidget implements StatefulWidget
protected waitForConnection: Deferred<MessageConnection> | undefined;
protected hoverMessage: HTMLDivElement;
protected lastTouchEnd: TouchEvent | undefined;
protected loadingMessage: HTMLDivElement;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you considering using some icon-loader for terminal tab till connection to the task process is not recovered instead of a loading message?
Like here, for example:

loader-icon

if (taskInfo && taskInfo.config.label) {
for (let i = 0; i < this.terminalWidgets.length; i++) {
const w = this.terminalWidgets[i];
if (taskInfo.config.label === w.title.label) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think label usage to find the corresponding widget is not enough: user can have tasks with the same label, but different source or type, for example.

@RomanNikitenko
Copy link
Contributor

@vitaliy-guliy
I would like to avoid usage of an additional storage for terminal widgets.
Could you take a look at #7108

Signed-off-by: Vitaliy Guliy <vgulyy@redhat.com>
Signed-off-by: Vitaliy Gulyy <vgulyy@redhat.com>
@vitaliy-guliy
Copy link
Contributor Author

@vitaliy-guliy is there a way to reproduce with the vanilla Theia on master with system connection throttling? It would help to see the issue more clear and compare with the behavior proposed in the PR. Reproduction steps would help, thank you.

@akosyakov sorry for the delay. I cannot reproduce the problem with the vanilla Theia running on che.openshift.io and on the local machine. Network throttling does not affect on the delay. It looks like eclipse-che-theia extensions and eclipse-che plugins forces to appear the delay in running of tasks.
Let's leave this PR as draft as we need to investigate the issue more deep.

@vitaliy-guliy vitaliy-guliy deleted the task-terminal branch March 31, 2020 09:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
proposal feature proposals (potential future features) tasks issues related to the task system
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants