#NEWLINE# def remove_cgroup( cgroup ) : #NEWLINE# #INDENT# if ( not os . path . exists ( cgroup ) ) : #NEWLINE# #INDENT# logging . warning ( 'Cannot remove CGroup %s, because it does not exist.' , cgroup ) #NEWLINE# return #NEWLINE# #UNINDENT# assert ( os . path . getsize ( os . path . join ( cgroup , 'tasks' ) ) == 0 ) #NEWLINE# try : #NEWLINE# #INDENT# os . rmdir ( cgroup ) #NEWLINE# #UNINDENT# except OSError : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# os . rmdir ( cgroup ) #NEWLINE# #UNINDENT# except OSError as e : #NEWLINE# #INDENT# logging . warning ( 'Failed to remove cgroup %s: error %s (%s)' , cgroup , e . errno , e . strerror )