题目描述: Apache Hadoop YARN是一种新的Hadoop资源管理器,主要部件为resource manager和node manager。resource manager使用有限状态机维护有状态对象的生命周期。 RmAppAttempt是resource manager中用于维护一个 Application运行尝试的生命周期的数据结构,当某个事件发生时RmAppAttempt会根据当前状态进行状态迁移,同时触发一个其余行为。RmAppAttempt相关状态和事件简述以下:node
请编写一段程序模拟实现RmAppAttempt状态机,接受一段连续事件输入,输出每一个事件处理后yarn中对应RmAppAttempt对象的状态。数据结构
输入描述: 模拟RmAppAttempt状态机,接收一段连续事件输入 输入接口:(事件间用空格分隔) 事件源|RmAppAttempt对象|事件 事件源:RmApp、ResourceScheduler、ApplicationMasterLauncher、RmContainer 事件:start、app_accepted、container_allocated、launched、finished、killapp
输出描述: 输出接口:(输出结果用分毫;分隔) RmAppAttempt对象|状态 状态:submitted、scheduled、allocated、running、finished、killed 无效输入经过状态机过滤,不须要任何输出oop
示例1 输入: mApp|RmAppAttempt_001|start RmApp|RmAppAttempt_002|start RmApp|RmAppAttempt_001|kill 输出: RmAppAttempt_001|submitted;RmAppAttempt_002|submitted;RmAppAttempt_001|killed; <br><br>对象
----------------2019.03.20------------------- 上机考试的时候,由于只剩下20min左右时间作这道题,来不及写完,只写了一部分代码。待以后完善了再来更新。接口