use of org.apache.inlong.manager.common.pojo.workflow.form.UpdateGroupProcessForm in project incubator-inlong by apache.
the class SourceRestartEventSelector method accept.
@Override
public boolean accept(WorkflowContext context) {
ProcessForm processForm = context.getProcessForm();
if (!(processForm instanceof UpdateGroupProcessForm)) {
return false;
}
UpdateGroupProcessForm updateGroupProcessForm = (UpdateGroupProcessForm) processForm;
return updateGroupProcessForm.getOperateType() == OperateType.RESTART;
}
use of org.apache.inlong.manager.common.pojo.workflow.form.UpdateGroupProcessForm in project incubator-inlong by apache.
the class CreateSortConfigListener method listen.
@Override
public ListenerResult listen(WorkflowContext context) throws Exception {
LOGGER.info("Create sort config for context={}", context);
ProcessForm form = context.getProcessForm();
if (form instanceof UpdateGroupProcessForm) {
UpdateGroupProcessForm updateGroupProcessForm = (UpdateGroupProcessForm) form;
OperateType operateType = updateGroupProcessForm.getOperateType();
if (operateType == OperateType.SUSPEND || operateType == OperateType.DELETE) {
return ListenerResult.success();
}
}
InlongGroupInfo groupInfo = this.getGroupInfo(form);
String groupId = groupInfo.getInlongGroupId();
if (StringUtils.isEmpty(groupId)) {
LOGGER.warn("GroupId is null for context={}", context);
return ListenerResult.success();
}
List<SinkResponse> sinkResponseList = streamSinkService.listSink(groupId, null);
if (CollectionUtils.isEmpty(sinkResponseList)) {
LOGGER.warn("Sink not found by groupId={}", groupId);
return ListenerResult.success();
}
Map<String, DataFlowInfo> dataFlowInfoMap = sinkResponseList.stream().map(sink -> {
DataFlowInfo flowInfo = commonOperateService.createDataFlow(groupInfo, sink);
return Pair.of(sink.getInlongStreamId(), flowInfo);
}).collect(Collectors.toMap(Pair::getKey, Pair::getValue));
String dataFlows = OBJECT_MAPPER.writeValueAsString(dataFlowInfoMap);
InlongGroupExtInfo extInfo = new InlongGroupExtInfo();
extInfo.setInlongGroupId(groupId);
extInfo.setKeyName(InlongGroupSettings.DATA_FLOW);
extInfo.setKeyValue(dataFlows);
if (groupInfo.getExtList() == null) {
groupInfo.setExtList(Lists.newArrayList());
}
upsertDataFlow(groupInfo, extInfo);
return ListenerResult.success();
}
use of org.apache.inlong.manager.common.pojo.workflow.form.UpdateGroupProcessForm in project incubator-inlong by apache.
the class ZkDisabledEventSelector method accept.
@Override
public boolean accept(WorkflowContext context) {
ProcessForm processForm = context.getProcessForm();
if (processForm instanceof GroupResourceProcessForm) {
GroupResourceProcessForm groupResourceForm = (GroupResourceProcessForm) processForm;
InlongGroupInfo groupInfo = groupResourceForm.getGroupInfo();
return groupInfo.getZookeeperEnabled() == 0 && !groupInfo.getMiddlewareType().equals(Constant.MIDDLEWARE_NONE);
} else if (processForm instanceof UpdateGroupProcessForm) {
UpdateGroupProcessForm updateGroupProcessForm = (UpdateGroupProcessForm) processForm;
InlongGroupInfo groupInfo = updateGroupProcessForm.getGroupInfo();
return groupInfo.getZookeeperEnabled() == 0 && !groupInfo.getMiddlewareType().equals(Constant.MIDDLEWARE_NONE);
} else {
return false;
}
}
use of org.apache.inlong.manager.common.pojo.workflow.form.UpdateGroupProcessForm in project incubator-inlong by apache.
the class InlongGroupProcessOperation method deleteProcess.
/**
* Delete resource application group logically and delete related resource
*/
public boolean deleteProcess(String groupId, String operator) {
LOGGER.info("begin to delete process, groupId = {}, operator = {}", groupId, operator);
try {
UpdateGroupProcessForm form = genUpdateGroupProcessForm(groupId, OperateType.DELETE);
workflowService.start(ProcessName.DELETE_GROUP_PROCESS, operator, form);
} catch (Exception ex) {
LOGGER.error("exception while delete process, groupId = {}, operator = {}", groupId, operator, ex);
throw ex;
}
return groupService.delete(groupId, operator);
}
use of org.apache.inlong.manager.common.pojo.workflow.form.UpdateGroupProcessForm in project incubator-inlong by apache.
the class InlongGroupProcessOperation method suspendProcess.
/**
* Suspend resource application group which is started up successfully,
* stop source and sort task related to application group asynchronously,
* persist the application status if necessary.
*
* @return Workflow result
*/
public WorkflowResult suspendProcess(String groupId, String operator) {
LOGGER.info("begin to suspend process, groupId = {}, operator = {}", groupId, operator);
groupService.updateStatus(groupId, GroupState.SUSPENDING.getCode(), operator);
UpdateGroupProcessForm form = genUpdateGroupProcessForm(groupId, OperateType.SUSPEND);
return workflowService.start(ProcessName.SUSPEND_GROUP_PROCESS, operator, form);
}
Aggregations