Skip to content

Instantly share code, notes, and snippets.

@meetchandan
Last active April 19, 2020 17:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save meetchandan/65c0357f6b050ceed8833adc1ceadeeb to your computer and use it in GitHub Desktop.
Save meetchandan/65c0357f6b050ceed8833adc1ceadeeb to your computer and use it in GitHub Desktop.
Workflow struct {
   Root      Statement
}
// Statement is the building block of DSL workflow. 
// A Statement can be a simple ActivityInvocation or it
// could be a Sequence or Parallel.
Statement struct {
   Activity *ActivityInvocation
   Sequence *Sequence
   Parallel *Parallel
}
// Sequence consist of a collection of Statements that runs in sequential.
Sequence struct {
   Elements []*Statement
}
// Parallel can be a collection of Statements that runs in parallel.
Parallel struct {
   Branches []*Statement
}
ActivityInvocation struct {
TaskId string
Arguments map[string]interface{}
}
// Example:
/*
root:
sequence:
elements:
- activity:
name: executesql
arguments:
sql: "select 1"
- parallel:
branches:
- sequence:
elements:
- activity:
name: matviewpartition
arguments:
sql: "execute sql 1"
destination_table: "dest table 1"
- activity:
name: matviewpartition
arguments:
sql: "execute sql 2"
destination_table: "dest table 2"
- sequence:
elements:
- activity:
name: matviewpartition
arguments:
sql: "execute sq 3l"
destination_table: "dest table 3"
- activity:
name: executesql
arguments:
sql: "execute sq 3l"
destination_table: "dest table 3"
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment