whole-tale / dashboard

Whole Tale Dashboard
http://wholetale.org
MIT License
7 stars 2 forks source link

Fix instance poller #534

Closed bodom0015 closed 4 years ago

bodom0015 commented 4 years ago

Problem

Present in the Dashboard are a set of helper methods that I refer to as the "instance poller". As the name implies, its job is to poll an instance status and automatically stop once the status matches the target value. This is helpful during instance startup, where we need to poll until the instance.status is equal to 1 (Running).

Previously, the instance poller would activate during the following states:

After PR #517, the instance poller no longer appears to operate. See #531

Approach

Change all methods of launching tales (listed above) to use the new startTale helper method. Ensure that self.get('apiCall').waitForInstance(instance); is explicitly called every time startTale is called.

How to Test

Prerequisites: at least on public/read-only Tale to copy (can use LIGO), stop all running Tales, keep Networks tab open in browser Dev Console

Create Tale

  1. At the top-right, choose "Create New Tale", enter a name/environment, and confirm with the "Create and Launch" option
    • You should be automatically navigated to the "Interact" tab of the "Run" view
    • The Interact tab should display a loading spinner that reads "Please Wait"
    • The "Run" button at the top-right should be disabled and replaced with a spinner that reads Please Wait...
    • The instance poller should be running (check Networks tab)
  2. Wait for the Tale to finish starting
    • The "Run"/"Please Wait" button at the top-right should now be enabled and read "Stop"
    • The instance poller should stop (Networks tab should be quiet)
  3. Stop all Tales to reset test state

Import Tale

  1. Import a tale and confirm with the "Create and Launch" option
    • You should be automatically navigated to the "Interact" tab of the "Run" view
    • The Interact tab should display a loading spinner that reads "Please Wait"
    • The "Run" button at the top-right should be disabled and replaced with a spinner that reads Please Wait...
    • The instance poller should be running (check Networks tab)
  2. Wait for the Tale to finish starting
    • The "Run"/"Please Wait" button at the top-right should now be enabled and read "Stop"
    • The instance poller should stop (Networks tab should be quiet)
  3. Stop all Tales to reset test state

Launching a Tale from Browse / On Load from Browse

  1. From Browse, choose "Run Tale" beneath an existing Tale
    • You should be automatically navigated to the "Interact" tab of the "Run" view
    • The Interact tab should display a loading spinner that reads "Please Wait"
    • The "Run" button at the top-right should be disabled and replaced with a spinner that reads Please Wait...
  2. While the Tale is still launching, open a separate tab to the Browse view and open the Dev Console
    • The Please Wait spinners should still be shown
    • The poller should still be running (check Networks tab)
  3. Wait for the Tale to finish starting
    • The "Run"/"Please Wait" button at the top-right should now be enabled and read "Stop"
    • The instance poller should stop (Networks tab should be quiet)
  4. Stop all Tales / close separate tab(s) to reset test state

Copy on Launch from Browse

  1. From Browse, choose "Run Tale" beneath an existing public/read-only Tale
    • You should be presented with a confirmation modal explaining "Copy on Launch"
  2. Confirm the modal
    • You should be automatically navigated to the "Interact" tab of the "Run" view
    • The Interact tab should display a loading spinner that reads "Please Wait"
    • The "Run" button at the top-right should be disabled and replaced with a spinner that reads Please Wait...
    • The instance poller should be running (check Networks tab)
  3. Wait for the Tale to finish starting
    • The "Run"/"Please Wait" button at the top-right should now be enabled and read "Stop"
    • The instance poller should stop (Networks tab should be quiet)
  4. Stop all Tales to reset test state

Launching a Tale from Run / On Load from Run

  1. From Browse, hover over a Tale and click View
  2. Click the "Run" button at the top-right an existing Tale
    • You should be automatically navigated to the "Interact" tab of the "Run" view
    • The Interact tab should display a loading spinner that reads "Please Wait"
    • The "Run" button at the top-right should be disabled and replaced with a spinner that reads Please Wait...
    • The instance poller should be running (check Networks tab)
  3. While the Tale is still launching, refresh the page
    • The Please Wait spinners should still be shown
    • The poller should still be running (check Networks tab)
  4. Wait for the Tale to finish starting
    • The "Run"/"Please Wait" button at the top-right should now be enabled and read "Stop"
    • The instance poller should stop (Networks tab should be quiet)
  5. Stop all Tales to reset test state

Copy on Launch from Run

  1. From Browse, hover over an existing public/read-only Tale and click View
  2. From Run, click "Run" at the top-right of the page
    • You should be presented with a confirmation modal explaining "Copy on Launch"
  3. Click the "Run" button at the top-right an existing Tale
    • You should be automatically navigated to the "Interact" tab of the "Run" view
    • The Interact tab should display a loading spinner that reads "Please Wait"
    • The "Run" button at the top-right should be disabled and replaced with a spinner that reads Please Wait...
    • The instance poller should be running (check Networks tab)
  4. Wait for the Tale to finish starting
    • The "Run"/"Please Wait" button at the top-right should now be enabled and read "Stop"
    • The instance poller should stop (Networks tab should be quiet)
  5. Stop all Tales to reset test state
bodom0015 commented 4 years ago

@craig-willis the second tab in that case was purely to verify both parts of the test:

  1. The Browse view should continually refresh instance status if something is launching
  2. The Run view should properly update once the instance finishes starting

The refreshing was simply to test the "On Load" behaviors. If we plan to support multiple tabs open in the future, then I agree that evolving the notification-stream is going to be the easier route there.

Unfortunately, as discussed before, the problem with the "Stop" case is that the API server returns before everything is fully removed. One of the following will be needed on the API side to correct this behavior:

  1. The DELETE /instance/:id request could block (synchronous) until the container cleanup is done - in most cases, this seems to happen relatively quickly
  2. We could add InstanceState.DELETING - note that in this case we will likely need special handling in the Browse view to hide/ignore such instances, and further handling on the "Run" view to redirect back to browse if the instance state is DELETING