in source/ecs/workspaces_helper.py [0:0]
def compare_usage_metrics_for_auto_stop(self, workspace_id, billable_time, hourly_threshold,
workspace_running_mode):
"""
This method compares the usage metrics for Auto stop mode
:param workspace_id: workspace id
:param billable_time: billable time
:param hourly_threshold: hourly threshold
:param workspace_running_mode: workspace running mode
:return: Result code and new running mode
"""
log.debug('workspaceRunningMode {} == AUTO_STOP'.format(workspace_running_mode))
# If billable time is over the threshold for this bundle type
if billable_time > hourly_threshold:
log.debug('billableTime {} > hourlyThreshold {}'.format(billable_time, hourly_threshold))
# Change the workspace to ALWAYS_ON
result_code = self.modify_workspace_properties(workspace_id, ALWAYS_ON)
# if there was an exception in the modify workspace API call, new mode is same as old mode
if result_code == '-E-':
new_mode = AUTO_STOP
else:
new_mode = ALWAYS_ON
# Otherwise, report no change for the Workspace
else: # billable_time <= hourly_threshold:
log.debug('billableTime {} <= hourlyThreshold {}'.format(billable_time, hourly_threshold))
result_code = '-N-'
new_mode = AUTO_STOP
return result_code, new_mode