SixPairs

August 22, 2010

Simplified DGML – Scenario: Software Deployment

Filed under: DGML — Ceyhun Ciper @ 02:21

 

Goal: To enhance the process that you currently use to automate the deployment of your software.

Current state: You have a linear model of tasks to run one after another.

Desired state: You’d like to extend the current state to allow the tasks to be represented by a directed graph of their dependencies.

DGML Shortcomings: A directed graph is tricky to represent in XML in a way that is easy to understand at first glance. Ideally, you want developers to be able to construct the dependency graph of their deployment tasks easily through some form of input. You could use Visio for this, but you’d rather it was XML based, as your current system uses XML, and you don’t really want to be reading from a Visio diagram programmatically. DGML could be the answer as it produces very nice looking DAGs from an XML file. However, you don’t really want the developers to be messing around with the DGML XML file, as it is pretty complex. There is currently no way to directly edit the DAG in the designer of Visual Studio (add node, add link between nodes), but you would like some way of editing the DGML.

Let’s consider this set of tasks to be written by your developers in the DGML DSL:

Prepare –> {Create Folders;Copy Images}
{ Create Folders; Copy Images } –> Build
Build –> { Check Resources; Copy Dependencies }
{ Check Resources; Copy Dependencies } –> Compile
Compile –> Link –> Deploy
Deploy –> {Deploy Folders; Deploy Dependencies; Deploy Executables; Patch Configs}

This generates the following DGML:

image

Generated DGML (that you don’t want your developers to write by hand):

<DirectedGraph xmlns=’http://schemas.microsoft.com/vs/2009/dgml’>
<Nodes>
<Node Id=’Patch Configs’ Label=’Patch Configs’ />
<Node Id=’Compile’ Label=’Compile’ />
<Node Id=’Create Folders’ Label=’Create Folders’ />
<Node Id=’Prepare’ Label=’Prepare’ />
<Node Id=’Deploy Executables’ Label=’Deploy Executables’ />
<Node Id=’Deploy’ Label=’Deploy’ />
<Node Id=’Link’ Label=’Link’ />
<Node Id=’Copy Images’ Label=’Copy Images’ />
<Node Id=’Deploy Folders’ Label=’Deploy Folders’ />
<Node Id=’Build’ Label=’Build’ />
<Node Id=’Check Resources’ Label=’Check Resources’ />
<Node Id=’Deploy Dependencies’ Label=’Deploy Dependencies’ />
<Node Id=’Copy Dependencies’ Label=’Copy Dependencies’ />
</Nodes>
<Links>
<Link Source=’Prepare’ Target=’Copy Images’ />
<Link Source=’Create Folders’ Target=’Build’ />
<Link Source=’Deploy’ Target=’Deploy Executables’ />
<Link Source=’Check Resources’ Target=’Compile’ />
<Link Source=’Prepare’ Target=’Create Folders’ />
<Link Source=’Deploy’ Target=’Deploy Folders’ />
<Link Source=’Link’ Target=’Deploy’ />
<Link Source=’Copy Dependencies’ Target=’Compile’ />
<Link Source=’Build’ Target=’Copy Dependencies’ />
<Link Source=’Deploy’ Target=’Deploy Dependencies’ />
<Link Source=’Compile’ Target=’Link’ />
<Link Source=’Copy Images’ Target=’Build’ />
<Link Source=’Deploy’ Target=’Patch Configs’ />
<Link Source=’Build’ Target=’Check Resources’ />
</Links>
</DirectedGraph>

You can also group tasks easily:

Prepare->{ Create Folders; Copy Images }
{Create Folders;Copy Images}->Build
Build->{Check Resources;Copy Dependencies}
{Check Resources;Copy Dependencies}->Compile
Compile->Link->Deploy
Deploy->{Deploy Folders; Deploy Dependencies; Deploy Executables; Patch Configs}
group Prepare
group Build
group Deploy

Which gives:

image

You can classify tasks by color:

Prepare->{ Create Folders; Copy Images }
{Create Folders;Copy Images}->Build
Build->{Check Resources;Copy Dependencies}
{Check Resources;Copy Dependencies}->Compile
Compile->Link->Deploy
Deploy->{Deploy Folders; Deploy Dependencies; Deploy Executables; Patch Configs}
group Prepare
group Build
group Deploy
category Copy Dependencies(Dependencies)
category Deploy Dependencies(Dependencies)
categorycolor Dependencies(Blue)

image

You can show task relations cross-cutting task groups:

Prepare->{ Create Folders; Copy Images }
{Create Folders;Copy Images}->Build
Build->{Check Resources;Copy Dependencies}
{Check Resources;Copy Dependencies}->Compile
Compile->Link->Deploy
Deploy->{Deploy Folders; Deploy Dependencies; Deploy Executables; Patch Configs}
group Prepare
group Build
group Deploy
category Copy Dependencies(Dependencies)
category Deploy Dependencies(Dependencies)
categorycolor Dependencies(Blue)
Copy Dependencies->Deploy Dependencies

image

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a comment

Blog at WordPress.com.