How to implement the more function of the console

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

How to implement the more function of the console

Mr_xushuai
Hi Yan,

       I have already packing the Rest Api of the Console, can use a parallel or serial to deploy multiple machines ,But I can only Returns the entire status of the execution by (/ plan / < planId > / execution / < executionId >), and can't get release status for a Agent, such as I have a static model release 100 machines, how can I keep track of every Agent release status and error info,Similar to your console. how to pause deployment, then again, I didn't find the suitable API?

Thanks

Naty
Reply | Threaded
Open this post in threaded view
|

Re: How to implement the more function of the console

frenchyan
Administrator
In order to see the details you use this api: http://pongasoft.github.io/glu/docs/latest/html/orchestration-engine.html#goe-rest-api-get-deployment-current

In the section "A few concepts" (http://pongasoft.github.io/glu/docs/latest/html/orchestration-engine.html#a-few-concepts), there is a Tip section about it:

Tip

There is a relationship between a plan execution and the current and archived plan: theexecutionId is in fact the deploymentId:

GET /plans/<planId>/executions/<executionId>

is equivalent to

GET /deployment/current/<executionId>

and if you want to access the archived version you can issue

GET /deployment/archived/<executionId>

This will give you the details that you need.

There is currently no REST api to pause an individual deployment  and this would need to be added to the REST api (meaning changing the code). There is a way to abort the entire plan: http://pongasoft.github.io/glu/docs/latest/html/orchestration-engine.html#abort-execution-plan

Yan
Reply | Threaded
Open this post in threaded view
|

Re: How to implement the more function of the console

Mr_xushuai
Thank you very much for your patience to answer.

GET /deployment/current/<deploymentId> just view the current deployment details,The following is my understanding:
< X-glu-startTime: 1312038160946 The start time of the current step
< X-glu-endTime: 1312038165459  The end time of the current step
< X-glu-username: glua
< X-glu-status: COMPLETED The status of the current step
< X-glu-description: Deploy - Fabric [glu-dev-1] - PARALLEL
< X-glu-completedSteps: 8
< X-glu-totalSteps: 16

If plan was executed serially, every step is easier to understand.The total Steps is 16 and the current step completed is 8, and I can know the status(running,completed) of deployment(How to know the percentage,maybe is not import),I don't know how to get error information(exception)? But parallel, How to understand ?

Another question:
1.I want to extend the functionality for Agent,such as collect the host log of all applications, Monitor all the status of the machine and status of the applications and so on.Do you have a good idea?

2.If I can use my zookeeper to manage all of agent?

Hope you will understand what I say!Because my English is not good!

Thanks
Best Regard!

Reply | Threaded
Open this post in threaded view
|

Re: How to implement the more function of the console

frenchyan
Administrator
You can use the "archived" version of it as described there: http://pongasoft.github.io/glu/docs/latest/html/orchestration-engine.html#goe-rest-api-get-deployment-archived

What you get is an XML document which will tells you exactly which steps have failed and why... example:

      <leaf agent="agent-1" fabric="glu-dev-1" initParameters="{message=Hello World, metadata={cluster=c2, container={name=m2}, product=product2, version=2.0.0}, tags=[a:tag1, e:tag2, e:tag3]}" mountPoint="/m2/i001" name="Install script for [/m2/i001] on [agent-1]" script="file:/Users/ypujante/github/org.pongasoft/glu/scripts/org.linkedin.glu.script-hello-world/src/main/groovy/HelloWorldScript.groovy" scriptLifecycle="installScript" startTime="2014-08-07 07:17:57 -1000" endTime="2014-08-07 07:17:59 -1000" status="FAILED">

        <exception message="/m2/i001">org.linkedin.glu.agent.api.ScriptException: /m2/i001

at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)

at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)

at java.lang.reflect.Constructor.newInstance(Constructor.java:526)



​In regards to your second question you should take a look at this blog post that I wrote a while ago (but still very much valid): http://www.pongasoft.com/blog/yan/glu/2011/03/18/building-monitoring-solution-with-glu/

Yan
Reply | Threaded
Open this post in threaded view
|

Re: How to implement the more function of the console

Mr_xushuai
Thank your response quickly!

Abort execution plan

Description: Abort the execution.
Request: DELETE /plan/<planId>/execution/<executionId>
N/A
Response:
TBD

I try to use the Rest api to send Delete request, but always return 404.

However I can send Get request and Head request.

The following is my test Url Demo :
http://localhost:8080/console/rest/v1/pseg-ctr-jk/plan/0fb14888-e1e3-49c1-bbf4-79d54f6d7ca0/execution/209
Reply | Threaded
Open this post in threaded view
|

Re: How to implement the more function of the console

frenchyan
Administrator
I am afraid that this feature is currently not implemented: https://github.com/pongasoft/glu/blob/master/console/org.linkedin.glu.console-webapp/grails-app/conf/UrlMappings.groovy#L503

The code would have to be changed to add it. I have created a ticket to track it: https://github.com/pongasoft/glu/issues/269

At this time I do not know yet when it will be implemented/released.

Yan
Reply | Threaded
Open this post in threaded view
|

Re: How to implement the more function of the console

Mr_xushuai
This post was updated on .
Hi Yan,

Thank you for your reply !

I want to rollback the deployment, but I don't want to create a new static model, How to do implement this?

I have try to update the glu.db_current_system table and modified the plan to redeploy, but could not create a plan by your rest Api.

It is very urgent, I hope you will write to me soon! Thank you very much !


Best regard

Naty
Reply | Threaded
Open this post in threaded view
|

Re: How to implement the more function of the console

frenchyan
Administrator
Unlike the UI which has a UI to select a previously loaded model, the REST api does not have this specific call available. It also does not offer the ability to list previously loaded models. It would need to be implemented. 

The current mechanism via the REST api is to load a new model which can be a previously loaded one (glu computes a checksum of the model so if it is a previous one, it will not create a new entry but simply reuse an older model).

At this stage I would suggest do the following:
* issue a GET to /model/static and store the current model somewhere
* upload your new model
* execute the deployment
* if you want to rollback, then issue a POST to /model/static with the model you stored previously
* execute the deployment which will bring the system to the state it was before
 
I would not recommend "playing" with the database but if this is something you want to do, then yes the db_current_system table is the one. But be careful.

I have created a ticket to keep track of the request: https://github.com/pongasoft/glu/issues/271

Yan