Skip to content

Instantly share code, notes, and snippets.

/nada.rb

Created May 17, 2011
Embed
What would you like to do?
define array_scaling
#
# making sure some initial fields are set
precondition
server_array_href type: string, empty: false
#
# body of the process
repeat
server_array list_instances
# sets the 'instances' workitem field
make_scaling_decision
# has to be provided by the user, as a participant
subprocess 'scale_${scaling_direction}', if: '${scaling_count} != 0'
# 'scale_up' or 'scale_down'
wait '${scaling_rest_time}'
# this field was computed by 'make_scaling_decision'
#
# default/suggested implementations for the subflows
#
# may be overriden by the user
define scale_up
citerator times: '$f:scaling_count', merge_type: union
server_array launch_next_instance, id: '${v:i}'
define scale_down
server_array select_oldest_instances
citerator on: '${oldest_instances}', to: instance_href
instance terminate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.