def make_task(data, job): task_type = data.get('type') if task_type == TaskTypes.TYPE_NODE_STOP_TASK: return NodeStopTask.from_data(data, job) if task_type == TaskTypes.TYPE_MINION_CMD: return MinionCmdTask.from_data(data, job) if task_type == TaskTypes.TYPE_HISTORY_REMOVE_NODE: return HistoryRemoveNodeTask.from_data(data, job) if task_type == TaskTypes.TYPE_RECOVER_DC_GROUP_TASK: return RecoverGroupDcTask.from_data(data, job) if task_type == TaskTypes.TYPE_NODE_BACKEND_DEFRAG_TASK: return NodeBackendDefragTask.from_data(data, job) if task_type == TaskTypes.TYPE_COUPLE_DEFRAG_STATE_CHECK_TASK: return CoupleDefragStateCheckTask.from_data(data, job) if task_type == TaskTypes.TYPE_RSYNC_BACKEND_TASK: return RsyncBackendTask.from_data(data, job) if task_type == TaskTypes.TYPE_CREATE_GROUP: return CreateGroupTask.from_data(data, job) if task_type == TaskTypes.TYPE_REMOVE_GROUP: return RemoveGroupTask.from_data(data, job) if task_type == TaskTypes.TYPE_DNET_CLIENT_BACKEND_CMD: return DnetClientBackendCmdTask.from_data(data, job) if task_type == TaskTypes.TYPE_WRITE_META_KEY: return WriteMetaKeyTask.from_data(data, job) raise ValueError('Unknown task type {0}'.format(task_type))
def make_task(data, job): task_type = data.get('type', None) if task_type == TaskTypes.TYPE_NODE_STOP_TASK: return NodeStopTask.from_data(data, job) if task_type == TaskTypes.TYPE_MINION_CMD: return MinionCmdTask.from_data(data, job) if task_type == TaskTypes.TYPE_HISTORY_REMOVE_NODE: return HistoryRemoveNodeTask.from_data(data, job) if task_type == TaskTypes.TYPE_RECOVER_DC_GROUP_TASK: return RecoverGroupDcTask.from_data(data, job) if task_type == TaskTypes.TYPE_NODE_BACKEND_DEFRAG_TASK: return NodeBackendDefragTask.from_data(data, job) if task_type == TaskTypes.TYPE_COUPLE_DEFRAG_STATE_CHECK_TASK: return CoupleDefragStateCheckTask.from_data(data, job) if task_type == TaskTypes.TYPE_RSYNC_BACKEND_TASK: return RsyncBackendTask.from_data(data, job) raise ValueError('Unknown task type {0}'.format(task_type))