% # Find the framework with the given ID.
% framework = None
% for i in range(len(state['frameworks'])):
% if state['frameworks'][i]['id'] == framework_id:
% framework = state['frameworks'][i]
% end
% end
% if framework != None:
% # Count the number of tasks and sum the resources.
% tasks = 0
% cpus = 0
% mem = 0
% for executor in framework['executors']:
% for task in executor['tasks']:
% cpus += task['resources']['cpus']
% mem += task['resources']['mem']
% tasks += 1
% end
% end