Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(3017)

Issue 13549046: GUI server: cancel deployment feature.

Can't Edit
Can't Publish+Mail
Start Review
Created:
10 years, 7 months ago by frankban
Modified:
10 years, 7 months ago
Reviewers:
bac, rharding, mp+185448
Visibility:
Public.

Description

GUI server: cancel deployment feature. Added an API call for cancelling a pending deployment. Also updated the bundles module documentation. For this first implementation, I discussed with Gary a workaround to avoid scheduled deployments to be included in the ProcessPool executor's call queue: a time.sleep call is added to the queue right after a new deployment. This way, as described in the code, it is still possible to cancel a scheduled deployment job even if it is the first in the queue. Tests: run `make unittest` from the root of this branch. QA: - bootstrap a juju-core environment; - deploy the GUI from this branch (`make deploy`); - switch to the builtin server: `juju set juju-gui builtin-server=true`; - ensure the GUI is working well by visiting https://GUI-ADDRESS . To test the deployer support and the "cancel deployment" feature, use the script in http://pastebin.ubuntu.com/6100815/ e.g.: - download and save the Python script; - run it passing the GUI node address as first argument: `python start-deployer-cancel.py GUI-ADDRESS`. The script does the following: 1) it logs in to the juju-core API server; 2) it starts/schedules three deployments; 3) it send two invalid Cancel requests; 4) it cancels the second deployment; 5) it shows the deployments status before and after the deployment deletion. - if everything is ok, you should see an output like this: http://pastebin.ubuntu.com/6100861/ ; - you should also be able to check the deployment progress from the GUI; - when the two deployments are completed (it may take some minutes) you should see wordpress, mysql and mediawiki correctly deployed and displayed in the topology view; - visiting https://GUI-ADDRESS/gui-server-info you should see something like this: { "uptime": 970, "deployer": [ {"Status": "completed", "DeploymentId": 0, "Time": 1379062144}, {"Status": "cancelled", "DeploymentId": 1, "Time": 1379061766}, {"Status": "completed", "DeploymentId": 2, "Time": 1379062156} ], "apiversion": "go", "sandbox": false, "version": "0.2.0", "debug": false, "apiurl": "wss://ec2-50-17-116-51.compute-1.amazonaws.com:17070" } That's all, thanks a lot for QAing this branch! https://code.launchpad.net/~frankban/charms/precise/juju-gui/cancel-deployment/+merge/185448 (do not edit description out of merge proposal)

Patch Set 1 #

Total comments: 3

Patch Set 2 : GUI server: cancel deployment feature. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+247 lines, -33 lines) Patch
A [revision details] View 1 1 chunk +2 lines, -0 lines 0 comments Download
M revision View 1 chunk +1 line, -1 line 0 comments Download
M server/guiserver/__init__.py View 1 chunk +1 line, -1 line 0 comments Download
M server/guiserver/bundles/__init__.py View 5 chunks +46 lines, -13 lines 0 comments Download
M server/guiserver/bundles/base.py View 7 chunks +39 lines, -5 lines 0 comments Download
M server/guiserver/bundles/utils.py View 2 chunks +7 lines, -0 lines 0 comments Download
M server/guiserver/bundles/views.py View 1 chunk +22 lines, -0 lines 0 comments Download
M server/guiserver/tests/bundles/test_base.py View 1 1 chunk +63 lines, -1 line 0 comments Download
M server/guiserver/tests/bundles/test_utils.py View 9 chunks +29 lines, -12 lines 0 comments Download
M server/guiserver/tests/bundles/test_views.py View 1 chunk +37 lines, -0 lines 0 comments Download

Messages

Total messages: 9
frankban
Please take a look.
10 years, 7 months ago (2013-09-13 09:30:52 UTC) #1
frankban
I forgot to mention that you need to change the PASSWORD at line #17 of ...
10 years, 7 months ago (2013-09-13 09:38:40 UTC) #2
rharding
code ok, will qa next. Just have the one objection to camel cased http params. ...
10 years, 7 months ago (2013-09-13 13:16:21 UTC) #3
frankban
On 2013/09/13 13:16:21, rharding wrote: > server/guiserver/bundles/views.py:182: deployment_id = > request.params.get('DeploymentId') > caps in the ...
10 years, 7 months ago (2013-09-13 13:24:32 UTC) #4
rharding
On 2013/09/13 13:24:32, frankban wrote: > On 2013/09/13 13:16:21, rharding wrote: > > > server/guiserver/bundles/views.py:182: ...
10 years, 7 months ago (2013-09-13 13:40:40 UTC) #5
rharding
LGTM Results of the script, first run: http://paste.mitechie.com/show/1020/ I did run it a second time ...
10 years, 7 months ago (2013-09-13 13:45:00 UTC) #6
frankban
On 2013/09/13 13:45:00, rharding wrote: > LGTM > > Results of the script, first run: ...
10 years, 7 months ago (2013-09-13 14:07:50 UTC) #7
bac
LGTM https://codereview.appspot.com/13549046/diff/1/server/guiserver/bundles/base.py File server/guiserver/bundles/base.py (right): https://codereview.appspot.com/13549046/diff/1/server/guiserver/bundles/base.py#newcode152 server/guiserver/bundles/base.py:152: # cancelling scheduled jobs, even if the job ...
10 years, 7 months ago (2013-09-13 14:33:19 UTC) #8
frankban
10 years, 7 months ago (2013-09-13 14:42:04 UTC) #9
*** Submitted:

GUI server: cancel deployment feature.

Added an API call for cancelling a pending
deployment.

Also updated the bundles module documentation.

For this first implementation, I discussed 
with Gary a workaround to avoid scheduled
deployments to be included in the ProcessPool
executor's call queue: a time.sleep call is
added to the queue right after a new deployment.
This way, as described in the code, it is still
possible to cancel a scheduled deployment job
even if it is the first in the queue.

Tests:
run `make unittest` from the root of this branch.

QA:
- bootstrap a juju-core environment;
- deploy the GUI from this branch (`make deploy`);
- switch to the builtin server: 
  `juju set juju-gui builtin-server=true`;
- ensure the GUI is working well by visiting
  https://GUI-ADDRESS .

To test the deployer support and the 
"cancel deployment" feature, use the script in
http://pastebin.ubuntu.com/6100815/ e.g.: 

- download and save the Python script;
- run it passing the GUI node address as first argument: 
  `python start-deployer-cancel.py GUI-ADDRESS`.

The script does the following:
1) it logs in to the juju-core API server;
2) it starts/schedules three deployments;
3) it send two invalid Cancel requests;
4) it cancels the second deployment;
5) it shows the deployments status before and
   after the deployment deletion.

- if everything is ok, you should see an output like
this: http://pastebin.ubuntu.com/6100861/ ;
- you should also be able to check the deployment 
  progress from the GUI;
- when the two deployments are completed (it may take
  some minutes) you should see wordpress, mysql and 
  mediawiki correctly deployed and displayed in the
  topology view;
- visiting https://GUI-ADDRESS/gui-server-info you 
  should see something like this:
  {
    "uptime": 970, 
    "deployer": [
      {"Status": "completed", "DeploymentId": 0, "Time": 1379062144},
      {"Status": "cancelled", "DeploymentId": 1, "Time": 1379061766}, 
      {"Status": "completed", "DeploymentId": 2, "Time": 1379062156}
    ], 
    "apiversion": "go", 
    "sandbox": false, 
    "version": "0.2.0", 
    "debug": false, 
    "apiurl": "wss://ec2-50-17-116-51.compute-1.amazonaws.com:17070"
  }

That's all, thanks a lot for QAing this branch!

R=rharding, bac
CC=
https://codereview.appspot.com/13549046

https://codereview.appspot.com/13549046/diff/1/server/guiserver/bundles/base.py
File server/guiserver/bundles/base.py (right):

https://codereview.appspot.com/13549046/diff/1/server/guiserver/bundles/base....
server/guiserver/bundles/base.py:152: # cancelling scheduled jobs, even if the
job is the next to be started.
On 2013/09/13 14:33:19, bac wrote:
> It's not clear to my why you want to be able to cancel this first job.  Only
> giving a window of 1 second seems arbitrary.  Perhaps the use case will become
> clearer as I read more code.

It is arbitrary indeed. This is just a way to fill the call queue so that, when
a job starts (and it is removed from the queue) he sleep is put in the queue and
the next deployment can still be cancelled. This is just a workaround, and will
be changed in the future, likely implementing our own async queue.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b