Example #1
0
def main():
  """
  <Purpose>
    The main function that calls the process_nodes_and_change_state() function
    in the node_transition_lib passing in the process and error functions.

  <Arguments>
    None

  <Exceptions>
    None

  <Side Effects>
    None
  """

  # Mark the node as active.
  mark_node_active = True
  state_function_arg_tuplelist = [
    ("onepercentmanyevents", "onepercentmanyevents", node_transition_lib.update_database, 
     node_transition_lib.noop, mark_node_active, node_transition_lib.update_database_node)]

  sleeptime = 10
  process_name = "onepercentmanyevents_to_onepercentmanyevents"
  parallel_instances = 10

  #call process_nodes_and_change_state() to start the node state transition
  node_transition_lib.process_nodes_and_change_state(state_function_arg_tuplelist, process_name, sleeptime, parallel_instances)
def main():
    """
  <Purpose>
    The main function that calls the process_nodes_and_change_state() function
    in the node_transition_lib passing in the process and error functions.

  <Arguments>
    None
 
  <Exceptions>
    None

  <Side Effects>
    None
  """

    #open and read the resource file that is necessary for onepercentmanyevents
    onepercentmanyevents_resource_fd = file(RESOURCES_TEMPLATE_FILE_PATH)
    onepercentmanyevents_resourcetemplate = onepercentmanyevents_resource_fd.read(
    )
    onepercentmanyevents_resource_fd.close()
    """
  build up the tuple list to call process_nodes_and_change_state()
  The transition from canonical to onepercentmanyevents happens in 3 steps.
  Step1: Move the canonical nodes to the movingtoonepercent state (the reason
    this is done is because incase some transition fails, we know that they are 
    going to be in the movingtoonepercent state.
  Step2: Next run the process function and change the state from movingtoonepercent
    state to the onepercentmanyevents state.
  Step3: Find all the nodes that failed to transition from movingtoonepercent
    state to onepercentmanyevents and transition them back to the canonical state.
  """

    state_function_arg_tuplelist = [
        ("canonical", "movingto_onepercentmanyevents",
         node_transition_lib.noop, node_transition_lib.noop),
        ("movingto_onepercentmanyevents", "onepercentmanyevents",
         onepercentmanyevents_divide, node_transition_lib.noop,
         onepercentmanyevents_resourcetemplate),
        ("movingto_onepercentmanyevents", "canonical",
         node_transition_lib.combine_vessels, node_transition_lib.noop)
    ]

    sleeptime = 10
    process_name = "canonical_to_onepercentmanyevents"
    parallel_instances = 10

    #call process_nodes_and_change_state() to start the node state transition
    node_transition_lib.process_nodes_and_change_state(
        state_function_arg_tuplelist, process_name, sleeptime,
        parallel_instances)
def main():
  """
  <Purpose>
    The main function that calls the process_nodes_and_change_state() function
    in the node_transition_lib passing in the process and error functions.

  <Arguments>
    None
 
  <Exceptions>
    None

  <Side Effects>
    None
  """

  #open and read the resource file that is necessary for onepercentmanyevents
  onepercentmanyevents_resource_fd = file(RESOURCES_TEMPLATE_FILE_PATH)
  onepercentmanyevents_resourcetemplate = onepercentmanyevents_resource_fd.read()
  onepercentmanyevents_resource_fd.close()
  
  """
  build up the tuple list to call process_nodes_and_change_state()
  The transition from canonical to onepercentmanyevents happens in 3 steps.
  Step1: Move the canonical nodes to the movingtoonepercent state (the reason
    this is done is because incase some transition fails, we know that they are 
    going to be in the movingtoonepercent state.
  Step2: Next run the process function and change the state from movingtoonepercent
    state to the onepercentmanyevents state.
  Step3: Find all the nodes that failed to transition from movingtoonepercent
    state to onepercentmanyevents and transition them back to the canonical state.
  """

  state_function_arg_tuplelist = [
    ("canonical", "movingto_onepercentmanyevents", node_transition_lib.noop, node_transition_lib.noop),

    ("movingto_onepercentmanyevents", "onepercentmanyevents", onepercentmanyevents_divide, 
     node_transition_lib.noop,onepercentmanyevents_resourcetemplate),

    ("movingto_onepercentmanyevents", "canonical", node_transition_lib.combine_vessels, 
     node_transition_lib.noop)]
 
  sleeptime = 10
  process_name = "canonical_to_onepercentmanyevents"
  parallel_instances = 10

  #call process_nodes_and_change_state() to start the node state transition
  node_transition_lib.process_nodes_and_change_state(state_function_arg_tuplelist, process_name, sleeptime, parallel_instances)