def update_output(environment_group_count, environments_per_group, upgrade_failure_percentage, maintenance_window, recalc_counter): return generate_upgrade_steps( environment_groups=[ upgrade_cycle.EnvironmentGroup(f'Group {i + 1}', [ upgrade_cycle.Environment(f'Cluster {(i) * environments_per_group + (j + 1)}') for j in range(environments_per_group) ]) for i in range(environment_group_count) ], upgrade_failure_percentage=upgrade_failure_percentage / 100, maintenance_window=maintenance_window )
def test_multi_group_and_cluster_should_contain_all_the_steps(): steps = upgrade_cycle.compute_next_upgrade_cycle( start_date=datetime.fromisoformat('2020-01-01'), environment_groups=[ upgrade_cycle.EnvironmentGroup('Group 1', [ upgrade_cycle.Environment('Cluster 1'), upgrade_cycle.Environment('Cluster 2'), ]), upgrade_cycle.EnvironmentGroup('Group 2', [ upgrade_cycle.Environment('Cluster 3'), upgrade_cycle.Environment('Cluster 4'), ]), ]) # print("\n",steps) assert_frame_equal( steps.reset_index(drop=True), parse_steps(''' phase step start_date finish_date Global ignoring 2020-01-01 2020-01-15 Global planning 2020-01-15 2020-01-16 Global pre-work 2020-01-16 2020-01-17 "Group 1: Cluster 1" waiting 2020-01-17 2020-01-18 "Group 1: Cluster 1" upgrading 2020-01-18 2020-01-19 "Group 1: Cluster 1" recovering 2020-01-19 2020-01-21 "Group 1: Cluster 2" waiting 2020-01-17 2020-01-18 "Group 1: Cluster 2" upgrading 2020-01-18 2020-01-19 "Group 1: Cluster 2" recovering 2020-01-19 2020-01-21 "Group 2: Cluster 3" waiting 2020-01-21 2020-01-25 "Group 2: Cluster 3" upgrading 2020-01-25 2020-01-26 "Group 2: Cluster 3" recovering 2020-01-26 2020-01-28 "Group 2: Cluster 4" waiting 2020-01-21 2020-01-25 "Group 2: Cluster 4" upgrading 2020-01-25 2020-01-26 "Group 2: Cluster 4" recovering 2020-01-26 2020-01-28 ''').reset_index(drop=True))
def test_chance_of_upgrade_failure(): steps = upgrade_cycle.compute_next_upgrade_cycle( start_date=datetime.fromisoformat('2020-01-01'), environment_groups=[ upgrade_cycle.EnvironmentGroup('Group 1', [ upgrade_cycle.Environment(f'Cluster {i+1}') for i in range(10) ]) ], upgrade_failure_percentage=0.3) steps['step_length'] = steps.finish_date - steps.start_date recover_steps = steps[steps.step == 'recovering'] # print("\n",recover_steps) assert len(recover_steps[recover_steps.step_length != '0 days']) == 3
def update_output_with_support_escalator(environment_group_count, environments_per_group, upgrade_failure_percentage, maintenance_window, start_version, target_version, recalc_counter): if 'recalc-button-with-support-escalator' not in [p['prop_id'] for p in dash.callback_context.triggered][0]: raise PreventUpdate return generate_upgrade_steps_with_support_elevator( start_date=datetime.fromisoformat('2020-03-01'), start_version=start_version, target_version=target_version, environment_groups=[ upgrade_cycle.EnvironmentGroup(f'Group {i + 1}', [ upgrade_cycle.Environment(f'Cluster {(i) * environments_per_group + (j + 1)}') for j in range(environments_per_group) ]) for i in range(environment_group_count) ], upgrade_failure_percentage=upgrade_failure_percentage / 100, maintenance_window=maintenance_window )
For each group of clusters the following steps are performed: * "waiting" for the next available maintenance window. For organisations where upgrades are only done over the weekend; this would be the the number of days until the next weekend * "upgrading" - the time that passes doing the actual upgrade. Multiple clusters in the same group are often upgraded in parallel * "recovering" - the time it takes to recover from (and re-attempt) a failed upgrade. High performing organisations typically see upgrade failure rates around 5 - 15%. Many organisations experience upgrade failure rates in excess of 50% The chart below visualises each of these steps: ''') ])), dbc.Card(body=True, children=[ dbc.Row( dbc.Col(dcc.Graph( id='upgrade-cycle-single', figure=generate_upgrade_steps( environment_groups=[ upgrade_cycle.EnvironmentGroup('Test', [ upgrade_cycle.Environment('TST-EAST'), upgrade_cycle.Environment('TST-WEST') ]), upgrade_cycle.EnvironmentGroup('Production', [ upgrade_cycle.Environment('PROD-EAST'), upgrade_cycle.Environment('PROD-WEST') ]) ], upgrade_failure_percentage=0.5, maintenance_window='weekends' ), animate=True, animation_options={'frame': {'redraw': True, }}, ), width=12) ), ]),