in source/ecs/workspaces_helper.py [0:0]
def check_if_workspace_needs_to_be_terminated(self, workspace_id):
"""
This method checks if the workspace needs to terminated based on the usage.
:param workspace_id:
:param billable_time:
:param tags:
:return: A string value 'Yes' if the workspace is terminate and an empty string '' if not terminated
"""
workspace_terminated = ''
if self.settings.get('terminateUnusedWorkspaces') == 'Dry Run':
log.debug("Termination option for workspace {} is set to DryRun. The report was updated but the "
"terminate action was not called".format(workspace_id))
workspace_terminated = 'Yes - Dry Run'
elif self.settings.get('terminateUnusedWorkspaces') == 'Yes' and not self.settings.get('isDryRun'):
log.debug('All the criteria for termination of workspace {} are met. Calling the terminate '
'action.'.format(workspace_id))
workspace_terminated = self.terminate_unused_workspace(workspace_id)
return workspace_terminated