Skip to content

Instantly share code, notes, and snippets.

Created May 17, 2011 07:11
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 anonymous/976077 to your computer and use it in GitHub Desktop.
Save anonymous/976077 to your computer and use it in GitHub Desktop.
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