def group_steps(group): """ Return Effect of list of steps that would be performed on the group if convergence is triggered on it with desired=actual """ now_dt = yield Effect(Func(datetime.utcnow)) all_data_eff = convergence_exec_data( group["tenantId"], group["groupId"], now_dt, get_executor) all_data = yield Effect(TenantScope(all_data_eff, group["tenantId"])) (executor, scaling_group, group_state, desired_group_state, resources) = all_data desired_group_state.desired = len(resources['servers']) steps = executor.plan(desired_group_state, datetime_to_epoch(now_dt), 3600, **resources) yield do_return(steps)
def group_steps(group): """ Return Effect of list of steps that would be performed on the group if convergence is triggered on it with desired=actual """ now_dt = yield Effect(Func(datetime.utcnow)) all_data_eff = convergence_exec_data(group["tenantId"], group["groupId"], now_dt, get_executor) all_data = yield Effect(TenantScope(all_data_eff, group["tenantId"])) (executor, scaling_group, group_state, desired_group_state, resources) = all_data desired_group_state.desired = len(resources['servers']) steps = executor.plan(desired_group_state, datetime_to_epoch(now_dt), 3600, **resources) yield do_return(steps)
def group_steps(group): """ Return Effect of list of steps that would be performed on the group if convergence is triggered on it with desired=actual. Also returns current delta of desired and actual """ now_dt = yield Effect(Func(datetime.utcnow)) all_data_eff = convergence_exec_data( group["tenantId"], group["groupId"], now_dt, get_executor) try: all_data = yield Effect(TenantScope(all_data_eff, group["tenantId"])) except Exception as e: yield do_return((e, 0)) (executor, scaling_group, group_state, desired_group_state, resources) = all_data delta = desired_group_state.capacity - len(resources['servers']) desired_group_state.capacity = len(resources['servers']) steps = executor.plan(desired_group_state, datetime_to_epoch(now_dt), 3600, {}, **resources) yield do_return((steps, delta))