<s> import re <EOL> from sahara . plugins . vanilla import utils as u <EOL> def get_datanodes_status ( cluster ) : <EOL> statuses = { } <EOL> namenode = u . get_namenode ( cluster ) <EOL> status_regexp = r'<STR_LIT>' <EOL> matcher = re . compile ( status_regexp , re . MULTILINE ) <EOL> dfs_report = namenode . remote ( ) . execute_command ( <EOL> '<STR_LIT>' ) [ <NUM_LIT:1> ] <EOL> for host , status in matcher . findall ( dfs_report ) : <EOL> statuses [ host ] = status . lower ( ) <EOL> return statuses <EOL> def get_nodemanagers_status ( cluster ) : <EOL> statuses = { } <EOL> resourcemanager = u . get_resourcemanager ( cluster ) <EOL> status_regexp = r'<STR_LIT>' <EOL> matcher = re . compile ( status_regexp , re . MULTILINE ) <EOL> yarn_report = resourcemanager . remote ( ) . execute_command ( <EOL> '<STR_LIT>' ) [ <NUM_LIT:1> ] <EOL> for host , status in matcher . findall ( yarn_report ) : <EOL> statuses [ host ] = status . lower ( ) <EOL> return statuses </s>
