Wenjun Ruan
4 months ago
committed by
GitHub
79 changed files with 2306 additions and 815 deletions
@ -0,0 +1,83 @@
|
||||
/* |
||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
||||
* contributor license agreements. See the NOTICE file distributed with |
||||
* this work for additional information regarding copyright ownership. |
||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
||||
* (the "License"); you may not use this file except in compliance with |
||||
* the License. You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
|
||||
package org.apache.dolphinscheduler.server.master.engine.task.runnable; |
||||
|
||||
import org.apache.dolphinscheduler.common.enums.Flag; |
||||
import org.apache.dolphinscheduler.dao.entity.TaskInstance; |
||||
import org.apache.dolphinscheduler.dao.repository.TaskInstanceDao; |
||||
import org.apache.dolphinscheduler.plugin.task.api.enums.TaskExecutionStatus; |
||||
|
||||
import java.util.Date; |
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.stereotype.Component; |
||||
import org.springframework.transaction.annotation.Transactional; |
||||
|
||||
@Component |
||||
public class FailedRecoverTaskInstanceFactory |
||||
extends |
||||
AbstractTaskInstanceFactory<FailedRecoverTaskInstanceFactory.FailedRecoverTaskInstanceBuilder> { |
||||
|
||||
@Autowired |
||||
private TaskInstanceDao taskInstanceDao; |
||||
|
||||
@Override |
||||
public FailedRecoverTaskInstanceFactory.FailedRecoverTaskInstanceBuilder builder() { |
||||
return new FailedRecoverTaskInstanceBuilder(this); |
||||
} |
||||
|
||||
@Transactional |
||||
@Override |
||||
public TaskInstance createTaskInstance(FailedRecoverTaskInstanceBuilder builder) { |
||||
final TaskInstance needRecoverTaskInstance = builder.needRecoverTaskInstance; |
||||
final TaskInstance taskInstance = cloneTaskInstance(needRecoverTaskInstance); |
||||
taskInstance.setId(null); |
||||
taskInstance.setState(TaskExecutionStatus.SUBMITTED_SUCCESS); |
||||
taskInstance.setHost(null); |
||||
taskInstance.setVarPool(null); |
||||
taskInstance.setSubmitTime(new Date()); |
||||
taskInstance.setLogPath(null); |
||||
taskInstance.setExecutePath(null); |
||||
taskInstanceDao.insert(taskInstance); |
||||
|
||||
needRecoverTaskInstance.setFlag(Flag.NO); |
||||
taskInstanceDao.updateById(needRecoverTaskInstance); |
||||
return taskInstance; |
||||
} |
||||
|
||||
public static class FailedRecoverTaskInstanceBuilder implements ITaskInstanceFactory.ITaskInstanceBuilder { |
||||
|
||||
private final FailedRecoverTaskInstanceFactory failedRecoverTaskInstanceFactory; |
||||
|
||||
private TaskInstance needRecoverTaskInstance; |
||||
|
||||
public FailedRecoverTaskInstanceBuilder(FailedRecoverTaskInstanceFactory failedRecoverTaskInstanceFactory) { |
||||
this.failedRecoverTaskInstanceFactory = failedRecoverTaskInstanceFactory; |
||||
} |
||||
|
||||
public FailedRecoverTaskInstanceBuilder withTaskInstance(TaskInstance needRecoverTaskInstance) { |
||||
this.needRecoverTaskInstance = needRecoverTaskInstance; |
||||
return this; |
||||
} |
||||
|
||||
@Override |
||||
public TaskInstance build() { |
||||
return failedRecoverTaskInstanceFactory.createTaskInstance(this); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,70 @@
|
||||
/* |
||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
||||
* contributor license agreements. See the NOTICE file distributed with |
||||
* this work for additional information regarding copyright ownership. |
||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
||||
* (the "License"); you may not use this file except in compliance with |
||||
* the License. You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
|
||||
package org.apache.dolphinscheduler.server.master.engine.task.runnable; |
||||
|
||||
import org.apache.dolphinscheduler.dao.entity.TaskInstance; |
||||
import org.apache.dolphinscheduler.dao.repository.TaskInstanceDao; |
||||
import org.apache.dolphinscheduler.plugin.task.api.enums.TaskExecutionStatus; |
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.stereotype.Component; |
||||
import org.springframework.transaction.annotation.Transactional; |
||||
|
||||
@Component |
||||
public class PauseRecoverTaskInstanceFactory |
||||
extends |
||||
AbstractTaskInstanceFactory<PauseRecoverTaskInstanceFactory.PauseRecoverTaskInstanceBuilder> { |
||||
|
||||
@Autowired |
||||
private TaskInstanceDao taskInstanceDao; |
||||
|
||||
@Override |
||||
public PauseRecoverTaskInstanceFactory.PauseRecoverTaskInstanceBuilder builder() { |
||||
return new PauseRecoverTaskInstanceBuilder(this); |
||||
} |
||||
|
||||
@Transactional |
||||
@Override |
||||
public TaskInstance createTaskInstance(PauseRecoverTaskInstanceBuilder builder) { |
||||
final TaskInstance needRecoverTaskInstance = builder.needRecoverTaskInstance; |
||||
needRecoverTaskInstance.setState(TaskExecutionStatus.SUBMITTED_SUCCESS); |
||||
taskInstanceDao.updateById(needRecoverTaskInstance); |
||||
return needRecoverTaskInstance; |
||||
} |
||||
|
||||
public static class PauseRecoverTaskInstanceBuilder implements ITaskInstanceFactory.ITaskInstanceBuilder { |
||||
|
||||
private final PauseRecoverTaskInstanceFactory pauseRecoverTaskInstanceFactory; |
||||
|
||||
private TaskInstance needRecoverTaskInstance; |
||||
|
||||
public PauseRecoverTaskInstanceBuilder(PauseRecoverTaskInstanceFactory pauseRecoverTaskInstanceFactory) { |
||||
this.pauseRecoverTaskInstanceFactory = pauseRecoverTaskInstanceFactory; |
||||
} |
||||
|
||||
public PauseRecoverTaskInstanceBuilder withTaskInstance(TaskInstance needRecoverTaskInstance) { |
||||
this.needRecoverTaskInstance = needRecoverTaskInstance; |
||||
return this; |
||||
} |
||||
|
||||
@Override |
||||
public TaskInstance build() { |
||||
return pauseRecoverTaskInstanceFactory.createTaskInstance(this); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,107 @@
|
||||
/* |
||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
||||
* contributor license agreements. See the NOTICE file distributed with |
||||
* this work for additional information regarding copyright ownership. |
||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
||||
* (the "License"); you may not use this file except in compliance with |
||||
* the License. You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
|
||||
package org.apache.dolphinscheduler.server.master.runner.task.subworkflow; |
||||
|
||||
import org.apache.dolphinscheduler.common.enums.WorkflowExecutionStatus; |
||||
import org.apache.dolphinscheduler.dao.entity.WorkflowInstance; |
||||
import org.apache.dolphinscheduler.dao.repository.WorkflowInstanceDao; |
||||
import org.apache.dolphinscheduler.extract.base.client.Clients; |
||||
import org.apache.dolphinscheduler.extract.master.IWorkflowControlClient; |
||||
import org.apache.dolphinscheduler.extract.master.transportor.workflow.WorkflowInstancePauseRequest; |
||||
import org.apache.dolphinscheduler.extract.master.transportor.workflow.WorkflowInstancePauseResponse; |
||||
import org.apache.dolphinscheduler.extract.master.transportor.workflow.WorkflowInstanceRecoverFailureTasksRequest; |
||||
import org.apache.dolphinscheduler.extract.master.transportor.workflow.WorkflowInstanceRecoverFailureTasksResponse; |
||||
import org.apache.dolphinscheduler.extract.master.transportor.workflow.WorkflowInstanceRecoverSuspendTasksRequest; |
||||
import org.apache.dolphinscheduler.extract.master.transportor.workflow.WorkflowInstanceRecoverSuspendTasksResponse; |
||||
import org.apache.dolphinscheduler.extract.master.transportor.workflow.WorkflowInstanceStopRequest; |
||||
import org.apache.dolphinscheduler.extract.master.transportor.workflow.WorkflowInstanceStopResponse; |
||||
import org.apache.dolphinscheduler.extract.master.transportor.workflow.WorkflowManualTriggerRequest; |
||||
import org.apache.dolphinscheduler.server.master.engine.workflow.trigger.WorkflowInstanceRecoverFailureTaskTrigger; |
||||
import org.apache.dolphinscheduler.server.master.engine.workflow.trigger.WorkflowInstanceRecoverSuspendTaskTrigger; |
||||
import org.apache.dolphinscheduler.server.master.exception.MasterTaskExecuteException; |
||||
import org.apache.dolphinscheduler.server.master.runner.task.subworkflow.trigger.SubWorkflowManualTrigger; |
||||
|
||||
import lombok.extern.slf4j.Slf4j; |
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.stereotype.Component; |
||||
|
||||
@Slf4j |
||||
@Component |
||||
public class SubWorkflowControlClient { |
||||
|
||||
@Autowired |
||||
private WorkflowInstanceDao workflowInstanceDao; |
||||
|
||||
@Autowired |
||||
private SubWorkflowManualTrigger subWorkflowManualTrigger; |
||||
|
||||
@Autowired |
||||
private WorkflowInstanceRecoverFailureTaskTrigger workflowInstanceRecoverFailureTaskTrigger; |
||||
|
||||
@Autowired |
||||
private WorkflowInstanceRecoverSuspendTaskTrigger workflowInstanceRecoverSuspendTaskTrigger; |
||||
|
||||
public Integer triggerSubWorkflow(final WorkflowManualTriggerRequest workflowManualTriggerRequest) { |
||||
return subWorkflowManualTrigger.triggerWorkflow(workflowManualTriggerRequest).getWorkflowInstanceId(); |
||||
} |
||||
|
||||
public WorkflowInstanceRecoverFailureTasksResponse triggerFromFailureTasks( |
||||
final WorkflowInstanceRecoverFailureTasksRequest recoverFailureTasksRequest) { |
||||
return workflowInstanceRecoverFailureTaskTrigger.triggerWorkflow(recoverFailureTasksRequest); |
||||
} |
||||
|
||||
public WorkflowInstanceRecoverSuspendTasksResponse triggerFromSuspendTasks( |
||||
final WorkflowInstanceRecoverSuspendTasksRequest recoverSuspendTasksRequest) { |
||||
return workflowInstanceRecoverSuspendTaskTrigger.triggerWorkflow(recoverSuspendTasksRequest); |
||||
} |
||||
|
||||
public WorkflowInstancePauseResponse pauseWorkflowInstance( |
||||
final WorkflowInstancePauseRequest workflowInstancePauseRequest) throws MasterTaskExecuteException { |
||||
final Integer subWorkflowInstanceId = workflowInstancePauseRequest.getWorkflowInstanceId(); |
||||
final WorkflowInstance subWorkflowInstance = workflowInstanceDao.queryById(subWorkflowInstanceId); |
||||
if (subWorkflowInstance.getState() != WorkflowExecutionStatus.RUNNING_EXECUTION) { |
||||
return WorkflowInstancePauseResponse.fail("SubWorkflow instance is not running, cannot pause"); |
||||
} |
||||
try { |
||||
return Clients |
||||
.withService(IWorkflowControlClient.class) |
||||
.withHost(subWorkflowInstance.getHost()) |
||||
.pauseWorkflowInstance(new WorkflowInstancePauseRequest(subWorkflowInstanceId)); |
||||
} catch (Exception e) { |
||||
throw new MasterTaskExecuteException("Pause SubWorkflow: " + subWorkflowInstance.getName() + " failed", e); |
||||
} |
||||
} |
||||
|
||||
public WorkflowInstanceStopResponse stopWorkflowInstance( |
||||
final WorkflowInstanceStopRequest workflowInstanceStopRequest) throws MasterTaskExecuteException { |
||||
final Integer subWorkflowInstanceId = workflowInstanceStopRequest.getWorkflowInstanceId(); |
||||
final WorkflowInstance subWorkflowInstance = workflowInstanceDao.queryById(subWorkflowInstanceId); |
||||
if (subWorkflowInstance.getState() != WorkflowExecutionStatus.RUNNING_EXECUTION) { |
||||
return WorkflowInstanceStopResponse.fail("SubWorkflow instance is not running, cannot stop"); |
||||
} |
||||
try { |
||||
return Clients |
||||
.withService(IWorkflowControlClient.class) |
||||
.withHost(subWorkflowInstance.getHost()) |
||||
.stopWorkflowInstance(new WorkflowInstanceStopRequest(subWorkflowInstance.getId())); |
||||
} catch (Exception e) { |
||||
throw new MasterTaskExecuteException("Kill SubWorkflow: " + subWorkflowInstance.getName() + " failed", e); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,40 @@
|
||||
/* |
||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
||||
* contributor license agreements. See the NOTICE file distributed with |
||||
* this work for additional information regarding copyright ownership. |
||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
||||
* (the "License"); you may not use this file except in compliance with |
||||
* the License. You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
|
||||
package org.apache.dolphinscheduler.server.master.runner.task.subworkflow.trigger; |
||||
|
||||
import org.apache.dolphinscheduler.common.enums.Flag; |
||||
import org.apache.dolphinscheduler.dao.entity.WorkflowInstance; |
||||
import org.apache.dolphinscheduler.extract.master.transportor.workflow.WorkflowManualTriggerRequest; |
||||
import org.apache.dolphinscheduler.server.master.engine.workflow.trigger.WorkflowManualTrigger; |
||||
|
||||
import org.springframework.stereotype.Component; |
||||
|
||||
/** |
||||
* Manual trigger of the workflow, used to trigger the workflow and generate the workflow instance in the manual way. |
||||
*/ |
||||
@Component |
||||
public class SubWorkflowManualTrigger extends WorkflowManualTrigger { |
||||
|
||||
@Override |
||||
protected WorkflowInstance constructWorkflowInstance(final WorkflowManualTriggerRequest workflowManualTriggerRequest) { |
||||
final WorkflowInstance workflowInstance = super.constructWorkflowInstance(workflowManualTriggerRequest); |
||||
workflowInstance.setIsSubProcess(Flag.YES); |
||||
return workflowInstance; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,136 @@
|
||||
/* |
||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
||||
* contributor license agreements. See the NOTICE file distributed with |
||||
* this work for additional information regarding copyright ownership. |
||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
||||
* (the "License"); you may not use this file except in compliance with |
||||
* the License. You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
|
||||
package org.apache.dolphinscheduler.server.master.it.cases; |
||||
|
||||
import static com.google.common.truth.Truth.assertThat; |
||||
import static org.awaitility.Awaitility.await; |
||||
|
||||
import org.apache.dolphinscheduler.common.enums.Flag; |
||||
import org.apache.dolphinscheduler.common.enums.WorkflowExecutionStatus; |
||||
import org.apache.dolphinscheduler.dao.entity.WorkflowDefinition; |
||||
import org.apache.dolphinscheduler.dao.entity.WorkflowInstance; |
||||
import org.apache.dolphinscheduler.extract.master.command.RunWorkflowCommandParam; |
||||
import org.apache.dolphinscheduler.plugin.task.api.enums.TaskExecutionStatus; |
||||
import org.apache.dolphinscheduler.server.master.AbstractMasterIntegrationTest; |
||||
import org.apache.dolphinscheduler.server.master.engine.IWorkflowRepository; |
||||
import org.apache.dolphinscheduler.server.master.it.Repository; |
||||
import org.apache.dolphinscheduler.server.master.it.WorkflowITContext; |
||||
import org.apache.dolphinscheduler.server.master.it.WorkflowITContextFactory; |
||||
import org.apache.dolphinscheduler.server.master.it.WorkflowOperator; |
||||
|
||||
import java.time.Duration; |
||||
import java.util.List; |
||||
|
||||
import org.assertj.core.api.Assertions; |
||||
import org.junit.jupiter.api.DisplayName; |
||||
import org.junit.jupiter.api.Test; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
||||
/** |
||||
* The integration test for pausing a workflow instance. |
||||
*/ |
||||
public class WorkflowInstanceRecoverPauseIT extends AbstractMasterIntegrationTest { |
||||
|
||||
@Autowired |
||||
private WorkflowITContextFactory workflowITContextFactory; |
||||
|
||||
@Autowired |
||||
private WorkflowOperator workflowOperator; |
||||
|
||||
@Autowired |
||||
private IWorkflowRepository workflowRepository; |
||||
|
||||
@Autowired |
||||
private Repository repository; |
||||
|
||||
@Test |
||||
@DisplayName("Test recover a a workflow which is paused with one sub workflow task") |
||||
public void testRecoverPausedWorkflow_with_subWorkflowTask_success() { |
||||
final String yaml = "/it/recover_paused/workflow_with_sub_workflow_task_success.yaml"; |
||||
final WorkflowITContext context = workflowITContextFactory.initializeContextFromYaml(yaml); |
||||
final WorkflowDefinition workflow = context.getWorkflows().get(0); |
||||
|
||||
final WorkflowOperator.WorkflowTriggerDTO workflowTriggerDTO = WorkflowOperator.WorkflowTriggerDTO.builder() |
||||
.workflowDefinition(workflow) |
||||
.runWorkflowCommandParam(new RunWorkflowCommandParam()) |
||||
.build(); |
||||
final Integer workflowInstanceId = workflowOperator.manualTriggerWorkflow(workflowTriggerDTO); |
||||
|
||||
await() |
||||
.pollInterval(Duration.ofMillis(100)) |
||||
.atMost(Duration.ofMinutes(1)) |
||||
.untilAsserted(() -> { |
||||
Assertions |
||||
.assertThat(repository.queryWorkflowInstance(context.getWorkflows().get(1))) |
||||
.satisfiesExactly(workflowInstance -> { |
||||
assertThat(workflowInstance.getState()) |
||||
.isEqualTo(WorkflowExecutionStatus.RUNNING_EXECUTION); |
||||
}); |
||||
}); |
||||
|
||||
assertThat(workflowOperator.pauseWorkflowInstance(workflowInstanceId).isSuccess()); |
||||
|
||||
await() |
||||
.atMost(Duration.ofMinutes(1)) |
||||
.untilAsserted(() -> { |
||||
Assertions |
||||
.assertThat(repository.queryWorkflowInstance(workflowInstanceId)) |
||||
.satisfies(workflowInstance -> { |
||||
assertThat(workflowInstance.getState()).isEqualTo(WorkflowExecutionStatus.PAUSE); |
||||
assertThat(workflowInstance.getIsSubProcess()).isEqualTo(Flag.NO); |
||||
}); |
||||
}); |
||||
|
||||
assertThat(workflowOperator.recoverSuspendWorkflowInstance(workflowInstanceId).isSuccess()); |
||||
|
||||
await() |
||||
.pollInterval(Duration.ofMillis(100)) |
||||
.atMost(Duration.ofMinutes(1)) |
||||
.untilAsserted(() -> { |
||||
Assertions |
||||
.assertThat(repository.queryWorkflowInstance(workflowInstanceId)) |
||||
.matches( |
||||
workflowInstance -> workflowInstance.getState() == WorkflowExecutionStatus.SUCCESS); |
||||
Assertions |
||||
.assertThat(repository.queryTaskInstance(workflowInstanceId)) |
||||
.satisfiesExactly(taskInstance -> { |
||||
assertThat(taskInstance.getState()).isEqualTo(TaskExecutionStatus.SUCCESS); |
||||
}); |
||||
|
||||
List<WorkflowInstance> subWorkflowInstances = |
||||
repository.queryWorkflowInstance(context.getWorkflows().get(1)); |
||||
Assertions |
||||
.assertThat(subWorkflowInstances) |
||||
.satisfiesExactly(workflowInstance -> assertThat(workflowInstance.getState()) |
||||
.isEqualTo(WorkflowExecutionStatus.SUCCESS)); |
||||
Assertions |
||||
.assertThat(repository.queryTaskInstance(subWorkflowInstances.get(0).getId())) |
||||
.hasSize(2) |
||||
.satisfies(taskInstance -> { |
||||
assertThat(taskInstance.get(0).getState()).isEqualTo(TaskExecutionStatus.SUCCESS); |
||||
assertThat(taskInstance.get(0).getFlag()).isEqualTo(Flag.YES); |
||||
|
||||
assertThat(taskInstance.get(1).getState()).isEqualTo(TaskExecutionStatus.SUCCESS); |
||||
assertThat(taskInstance.get(1).getFlag()).isEqualTo(Flag.YES); |
||||
}); |
||||
}); |
||||
|
||||
assertThat(workflowRepository.getAll()).isEmpty(); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,147 @@
|
||||
/* |
||||
* Licensed to the Apache Software Foundation (ASF) under one or more |
||||
* contributor license agreements. See the NOTICE file distributed with |
||||
* this work for additional information regarding copyright ownership. |
||||
* The ASF licenses this file to You under the Apache License, Version 2.0 |
||||
* (the "License"); you may not use this file except in compliance with |
||||
* the License. You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
|
||||
package org.apache.dolphinscheduler.server.master.it.cases; |
||||
|
||||
import static com.google.common.truth.Truth.assertThat; |
||||
import static org.awaitility.Awaitility.await; |
||||
|
||||
import org.apache.dolphinscheduler.common.enums.Flag; |
||||
import org.apache.dolphinscheduler.common.enums.WorkflowExecutionStatus; |
||||
import org.apache.dolphinscheduler.dao.entity.WorkflowDefinition; |
||||
import org.apache.dolphinscheduler.dao.entity.WorkflowInstance; |
||||
import org.apache.dolphinscheduler.extract.master.command.RunWorkflowCommandParam; |
||||
import org.apache.dolphinscheduler.plugin.task.api.enums.TaskExecutionStatus; |
||||
import org.apache.dolphinscheduler.server.master.AbstractMasterIntegrationTest; |
||||
import org.apache.dolphinscheduler.server.master.engine.IWorkflowRepository; |
||||
import org.apache.dolphinscheduler.server.master.it.Repository; |
||||
import org.apache.dolphinscheduler.server.master.it.WorkflowITContext; |
||||
import org.apache.dolphinscheduler.server.master.it.WorkflowITContextFactory; |
||||
import org.apache.dolphinscheduler.server.master.it.WorkflowOperator; |
||||
|
||||
import java.time.Duration; |
||||
import java.util.List; |
||||
|
||||
import org.assertj.core.api.Assertions; |
||||
import org.junit.jupiter.api.DisplayName; |
||||
import org.junit.jupiter.api.Test; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
||||
/** |
||||
* The integration test for pausing a workflow instance. |
||||
*/ |
||||
public class WorkflowInstanceRecoverStopIT extends AbstractMasterIntegrationTest { |
||||
|
||||
@Autowired |
||||
private WorkflowITContextFactory workflowITContextFactory; |
||||
|
||||
@Autowired |
||||
private WorkflowOperator workflowOperator; |
||||
|
||||
@Autowired |
||||
private IWorkflowRepository workflowRepository; |
||||
|
||||
@Autowired |
||||
private Repository repository; |
||||
|
||||
@Test |
||||
@DisplayName("Test recover a workflow which is stopped with one sub workflow task") |
||||
public void testRecoverStoppedWorkflow_with_subWorkflowTask_success() { |
||||
final String yaml = "/it/recover_stopped/workflow_with_sub_workflow_task_success.yaml"; |
||||
final WorkflowITContext context = workflowITContextFactory.initializeContextFromYaml(yaml); |
||||
final WorkflowDefinition workflow = context.getWorkflows().get(0); |
||||
|
||||
final WorkflowOperator.WorkflowTriggerDTO workflowTriggerDTO = WorkflowOperator.WorkflowTriggerDTO.builder() |
||||
.workflowDefinition(workflow) |
||||
.runWorkflowCommandParam(new RunWorkflowCommandParam()) |
||||
.build(); |
||||
final Integer workflowInstanceId = workflowOperator.manualTriggerWorkflow(workflowTriggerDTO); |
||||
|
||||
await() |
||||
.pollInterval(Duration.ofMillis(100)) |
||||
.atMost(Duration.ofMinutes(1)) |
||||
.untilAsserted(() -> { |
||||
Assertions |
||||
.assertThat(repository.queryWorkflowInstance(context.getWorkflows().get(1))) |
||||
.satisfiesExactly(workflowInstance -> { |
||||
assertThat(workflowInstance.getState()) |
||||
.isEqualTo(WorkflowExecutionStatus.RUNNING_EXECUTION); |
||||
}); |
||||
}); |
||||
|
||||
assertThat(workflowOperator.stopWorkflowInstance(workflowInstanceId).isSuccess()); |
||||
|
||||
await() |
||||
.atMost(Duration.ofMinutes(1)) |
||||
.untilAsserted(() -> { |
||||
Assertions |
||||
.assertThat(repository.queryWorkflowInstance(workflowInstanceId)) |
||||
.satisfies(workflowInstance -> { |
||||
assertThat(workflowInstance.getState()).isEqualTo(WorkflowExecutionStatus.STOP); |
||||
assertThat(workflowInstance.getIsSubProcess()).isEqualTo(Flag.NO); |
||||
}); |
||||
}); |
||||
|
||||
assertThat(workflowOperator.recoverSuspendWorkflowInstance(workflowInstanceId).isSuccess()); |
||||
|
||||
await() |
||||
.pollInterval(Duration.ofMillis(100)) |
||||
.atMost(Duration.ofMinutes(1)) |
||||
.untilAsserted(() -> { |
||||
|
||||
Assertions |
||||
.assertThat(repository.queryWorkflowInstance(workflowInstanceId)) |
||||
.matches( |
||||
workflowInstance -> workflowInstance.getState() == WorkflowExecutionStatus.SUCCESS); |
||||
Assertions |
||||
.assertThat(repository.queryTaskInstance(workflowInstanceId)) |
||||
.hasSize(2) |
||||
.satisfies(taskInstance -> { |
||||
assertThat(taskInstance.get(0).getState()).isEqualTo(TaskExecutionStatus.KILL); |
||||
assertThat(taskInstance.get(0).getFlag()).isEqualTo(Flag.NO); |
||||
|
||||
assertThat(taskInstance.get(1).getState()).isEqualTo(TaskExecutionStatus.SUCCESS); |
||||
assertThat(taskInstance.get(1).getFlag()).isEqualTo(Flag.YES); |
||||
}); |
||||
|
||||
List<WorkflowInstance> subWorkflowInstances = |
||||
repository.queryWorkflowInstance(context.getWorkflows().get(1)); |
||||
|
||||
Assertions |
||||
.assertThat(subWorkflowInstances) |
||||
.satisfiesExactly(workflowInstance -> assertThat(workflowInstance.getState()) |
||||
.isEqualTo(WorkflowExecutionStatus.SUCCESS)); |
||||
|
||||
Assertions |
||||
.assertThat(repository.queryTaskInstance(subWorkflowInstances.get(0).getId())) |
||||
.hasSize(3) |
||||
.satisfies(taskInstance -> { |
||||
assertThat(taskInstance.get(0).getState()).isEqualTo(TaskExecutionStatus.KILL); |
||||
assertThat(taskInstance.get(0).getFlag()).isEqualTo(Flag.NO); |
||||
|
||||
assertThat(taskInstance.get(1).getState()).isEqualTo(TaskExecutionStatus.SUCCESS); |
||||
assertThat(taskInstance.get(1).getFlag()).isEqualTo(Flag.YES); |
||||
|
||||
assertThat(taskInstance.get(2).getState()).isEqualTo(TaskExecutionStatus.SUCCESS); |
||||
assertThat(taskInstance.get(1).getFlag()).isEqualTo(Flag.YES); |
||||
}); |
||||
}); |
||||
|
||||
assertThat(workflowRepository.getAll()).isEmpty(); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,111 @@
|
||||
# |
||||
# Licensed to the Apache Software Foundation (ASF) under one or more |
||||
# contributor license agreements. See the NOTICE file distributed with |
||||
# this work for additional information regarding copyright ownership. |
||||
# The ASF licenses this file to You under the Apache License, Version 2.0 |
||||
# (the "License"); you may not use this file except in compliance with |
||||
# the License. You may obtain a copy of the License at |
||||
# |
||||
# http://www.apache.org/licenses/LICENSE-2.0 |
||||
# |
||||
# Unless required by applicable law or agreed to in writing, software |
||||
# distributed under the License is distributed on an "AS IS" BASIS, |
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
# See the License for the specific language governing permissions and |
||||
# limitations under the License. |
||||
# |
||||
|
||||
project: |
||||
name: MasterIntegrationTest |
||||
code: 1 |
||||
description: This is a fake project |
||||
userId: 1 |
||||
userName: admin |
||||
createTime: 2024-08-12 00:00:00 |
||||
updateTime: 2021-08-12 00:00:00 |
||||
|
||||
workflows: |
||||
- name: parent_workflow |
||||
code: 2 |
||||
version: 1 |
||||
projectCode: 1 |
||||
description: This is a workflow with sub workflow task |
||||
releaseState: ONLINE |
||||
createTime: 2024-08-12 00:00:00 |
||||
updateTime: 2021-08-12 00:00:00 |
||||
userId: 1 |
||||
executionType: PARALLEL |
||||
- name: child_workflow |
||||
code: 1 |
||||
version: 1 |
||||
projectCode: 1 |
||||
description: This is a workflow with a fake task |
||||
releaseState: ONLINE |
||||
createTime: 2024-08-12 00:00:00 |
||||
updateTime: 2021-08-12 00:00:00 |
||||
userId: 1 |
||||
executionType: PARALLEL |
||||
|
||||
tasks: |
||||
- name: sub_logic_task |
||||
code: 3 |
||||
version: 1 |
||||
projectCode: 1 |
||||
userId: 1 |
||||
taskType: SUB_PROCESS |
||||
taskParams: '{"localParams":[],"resourceList":[],"processDefinitionCode":1}' |
||||
workerGroup: default |
||||
createTime: 2024-08-12 00:00:00 |
||||
updateTime: 2021-08-12 00:00:00 |
||||
taskExecuteType: BATCH |
||||
- name: fake_task_A |
||||
code: 1 |
||||
version: 1 |
||||
projectCode: 1 |
||||
userId: 1 |
||||
taskType: LogicFakeTask |
||||
taskParams: '{"localParams":null,"varPool":[],"shellScript":"sleep 5"}' |
||||
workerGroup: default |
||||
createTime: 2024-08-12 00:00:00 |
||||
updateTime: 2021-08-12 00:00:00 |
||||
taskExecuteType: BATCH |
||||
- name: fake_task_B |
||||
code: 2 |
||||
version: 1 |
||||
projectCode: 1 |
||||
userId: 1 |
||||
taskType: LogicFakeTask |
||||
taskParams: '{"localParams":null,"varPool":[],"shellScript":"sleep 5"}' |
||||
workerGroup: default |
||||
createTime: 2024-08-12 00:00:00 |
||||
updateTime: 2021-08-12 00:00:00 |
||||
taskExecuteType: BATCH |
||||
|
||||
taskRelations: |
||||
- projectCode: 1 |
||||
processDefinitionCode: 2 |
||||
processDefinitionVersion: 1 |
||||
preTaskCode: 0 |
||||
preTaskVersion: 0 |
||||
postTaskCode: 3 |
||||
postTaskVersion: 1 |
||||
createTime: 2024-08-12 00:00:00 |
||||
updateTime: 2024-08-12 00:00:00 |
||||
- projectCode: 1 |
||||
processDefinitionCode: 1 |
||||
processDefinitionVersion: 1 |
||||
preTaskCode: 0 |
||||
preTaskVersion: 0 |
||||
postTaskCode: 1 |
||||
postTaskVersion: 1 |
||||
createTime: 2024-08-12 00:00:00 |
||||
updateTime: 2024-08-12 00:00:00 |
||||
- projectCode: 1 |
||||
processDefinitionCode: 1 |
||||
processDefinitionVersion: 1 |
||||
preTaskCode: 1 |
||||
preTaskVersion: 1 |
||||
postTaskCode: 2 |
||||
postTaskVersion: 1 |
||||
createTime: 2024-08-12 00:00:00 |
||||
updateTime: 2024-08-12 00:00:00 |
@ -0,0 +1,111 @@
|
||||
# |
||||
# Licensed to the Apache Software Foundation (ASF) under one or more |
||||
# contributor license agreements. See the NOTICE file distributed with |
||||
# this work for additional information regarding copyright ownership. |
||||
# The ASF licenses this file to You under the Apache License, Version 2.0 |
||||
# (the "License"); you may not use this file except in compliance with |
||||
# the License. You may obtain a copy of the License at |
||||
# |
||||
# http://www.apache.org/licenses/LICENSE-2.0 |
||||
# |
||||
# Unless required by applicable law or agreed to in writing, software |
||||
# distributed under the License is distributed on an "AS IS" BASIS, |
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
# See the License for the specific language governing permissions and |
||||
# limitations under the License. |
||||
# |
||||
|
||||
project: |
||||
name: MasterIntegrationTest |
||||
code: 1 |
||||
description: This is a fake project |
||||
userId: 1 |
||||
userName: admin |
||||
createTime: 2024-08-12 00:00:00 |
||||
updateTime: 2021-08-12 00:00:00 |
||||
|
||||
workflows: |
||||
- name: parent_workflow |
||||
code: 2 |
||||
version: 1 |
||||
projectCode: 1 |
||||
description: This is a workflow with sub workflow task |
||||
releaseState: ONLINE |
||||
createTime: 2024-08-12 00:00:00 |
||||
updateTime: 2021-08-12 00:00:00 |
||||
userId: 1 |
||||
executionType: PARALLEL |
||||
- name: child_workflow |
||||
code: 1 |
||||
version: 1 |
||||
projectCode: 1 |
||||
description: This is a workflow with a fake task |
||||
releaseState: ONLINE |
||||
createTime: 2024-08-12 00:00:00 |
||||
updateTime: 2021-08-12 00:00:00 |
||||
userId: 1 |
||||
executionType: PARALLEL |
||||
|
||||
tasks: |
||||
- name: sub_logic_task |
||||
code: 3 |
||||
version: 1 |
||||
projectCode: 1 |
||||
userId: 1 |
||||
taskType: SUB_PROCESS |
||||
taskParams: '{"localParams":[],"resourceList":[],"processDefinitionCode":1}' |
||||
workerGroup: default |
||||
createTime: 2024-08-12 00:00:00 |
||||
updateTime: 2021-08-12 00:00:00 |
||||
taskExecuteType: BATCH |
||||
- name: fake_task_A |
||||
code: 1 |
||||
version: 1 |
||||
projectCode: 1 |
||||
userId: 1 |
||||
taskType: LogicFakeTask |
||||
taskParams: '{"localParams":null,"varPool":[],"shellScript":"sleep 5"}' |
||||
workerGroup: default |
||||
createTime: 2024-08-12 00:00:00 |
||||
updateTime: 2021-08-12 00:00:00 |
||||
taskExecuteType: BATCH |
||||
- name: fake_task_B |
||||
code: 2 |
||||
version: 1 |
||||
projectCode: 1 |
||||
userId: 1 |
||||
taskType: LogicFakeTask |
||||
taskParams: '{"localParams":null,"varPool":[],"shellScript":"sleep 5"}' |
||||
workerGroup: default |
||||
createTime: 2024-08-12 00:00:00 |
||||
updateTime: 2021-08-12 00:00:00 |
||||
taskExecuteType: BATCH |
||||
|
||||
taskRelations: |
||||
- projectCode: 1 |
||||
processDefinitionCode: 2 |
||||
processDefinitionVersion: 1 |
||||
preTaskCode: 0 |
||||
preTaskVersion: 0 |
||||
postTaskCode: 3 |
||||
postTaskVersion: 1 |
||||
createTime: 2024-08-12 00:00:00 |
||||
updateTime: 2024-08-12 00:00:00 |
||||
- projectCode: 1 |
||||
processDefinitionCode: 1 |
||||
processDefinitionVersion: 1 |
||||
preTaskCode: 0 |
||||
preTaskVersion: 0 |
||||
postTaskCode: 1 |
||||
postTaskVersion: 1 |
||||
createTime: 2024-08-12 00:00:00 |
||||
updateTime: 2024-08-12 00:00:00 |
||||
- projectCode: 1 |
||||
processDefinitionCode: 1 |
||||
processDefinitionVersion: 1 |
||||
preTaskCode: 1 |
||||
preTaskVersion: 1 |
||||
postTaskCode: 2 |
||||
postTaskVersion: 1 |
||||
createTime: 2024-08-12 00:00:00 |
||||
updateTime: 2024-08-12 00:00:00 |
@ -0,0 +1,111 @@
|
||||
# |
||||
# Licensed to the Apache Software Foundation (ASF) under one or more |
||||
# contributor license agreements. See the NOTICE file distributed with |
||||
# this work for additional information regarding copyright ownership. |
||||
# The ASF licenses this file to You under the Apache License, Version 2.0 |
||||
# (the "License"); you may not use this file except in compliance with |
||||
# the License. You may obtain a copy of the License at |
||||
# |
||||
# http://www.apache.org/licenses/LICENSE-2.0 |
||||
# |
||||
# Unless required by applicable law or agreed to in writing, software |
||||
# distributed under the License is distributed on an "AS IS" BASIS, |
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
# See the License for the specific language governing permissions and |
||||
# limitations under the License. |
||||
# |
||||
|
||||
project: |
||||
name: MasterIntegrationTest |
||||
code: 1 |
||||
description: This is a fake project |
||||
userId: 1 |
||||
userName: admin |
||||
createTime: 2024-08-12 00:00:00 |
||||
updateTime: 2021-08-12 00:00:00 |
||||
|
||||
workflows: |
||||
- name: parent_workflow |
||||
code: 2 |
||||
version: 1 |
||||
projectCode: 1 |
||||
description: This is a workflow with sub workflow task |
||||
releaseState: ONLINE |
||||
createTime: 2024-08-12 00:00:00 |
||||
updateTime: 2021-08-12 00:00:00 |
||||
userId: 1 |
||||
executionType: PARALLEL |
||||
- name: child_workflow |
||||
code: 1 |
||||
version: 1 |
||||
projectCode: 1 |
||||
description: This is a workflow with a fake task |
||||
releaseState: ONLINE |
||||
createTime: 2024-08-12 00:00:00 |
||||
updateTime: 2021-08-12 00:00:00 |
||||
userId: 1 |
||||
executionType: PARALLEL |
||||
|
||||
tasks: |
||||
- name: sub_logic_task |
||||
code: 3 |
||||
version: 1 |
||||
projectCode: 1 |
||||
userId: 1 |
||||
taskType: SUB_PROCESS |
||||
taskParams: '{"localParams":[],"resourceList":[],"processDefinitionCode":1}' |
||||
workerGroup: default |
||||
createTime: 2024-08-12 00:00:00 |
||||
updateTime: 2021-08-12 00:00:00 |
||||
taskExecuteType: BATCH |
||||
- name: fake_task_A |
||||
code: 1 |
||||
version: 1 |
||||
projectCode: 1 |
||||
userId: 1 |
||||
taskType: LogicFakeTask |
||||
taskParams: '{"localParams":null,"varPool":[],"shellScript":"sleep 5"}' |
||||
workerGroup: default |
||||
createTime: 2024-08-12 00:00:00 |
||||
updateTime: 2021-08-12 00:00:00 |
||||
taskExecuteType: BATCH |
||||
- name: fake_task_B |
||||
code: 2 |
||||
version: 1 |
||||
projectCode: 1 |
||||
userId: 1 |
||||
taskType: LogicFakeTask |
||||
taskParams: '{"localParams":null,"varPool":[],"shellScript":"sleep 5"}' |
||||
workerGroup: default |
||||
createTime: 2024-08-12 00:00:00 |
||||
updateTime: 2021-08-12 00:00:00 |
||||
taskExecuteType: BATCH |
||||
|
||||
taskRelations: |
||||
- projectCode: 1 |
||||
processDefinitionCode: 2 |
||||
processDefinitionVersion: 1 |
||||
preTaskCode: 0 |
||||
preTaskVersion: 0 |
||||
postTaskCode: 3 |
||||
postTaskVersion: 1 |
||||
createTime: 2024-08-12 00:00:00 |
||||
updateTime: 2024-08-12 00:00:00 |
||||
- projectCode: 1 |
||||
processDefinitionCode: 1 |
||||
processDefinitionVersion: 1 |
||||
preTaskCode: 0 |
||||
preTaskVersion: 0 |
||||
postTaskCode: 1 |
||||
postTaskVersion: 1 |
||||
createTime: 2024-08-12 00:00:00 |
||||
updateTime: 2024-08-12 00:00:00 |
||||
- projectCode: 1 |
||||
processDefinitionCode: 1 |
||||
processDefinitionVersion: 1 |
||||
preTaskCode: 1 |
||||
preTaskVersion: 1 |
||||
postTaskCode: 2 |
||||
postTaskVersion: 1 |
||||
createTime: 2024-08-12 00:00:00 |
||||
updateTime: 2024-08-12 00:00:00 |
@ -0,0 +1,91 @@
|
||||
# |
||||
# Licensed to the Apache Software Foundation (ASF) under one or more |
||||
# contributor license agreements. See the NOTICE file distributed with |
||||
# this work for additional information regarding copyright ownership. |
||||
# The ASF licenses this file to You under the Apache License, Version 2.0 |
||||
# (the "License"); you may not use this file except in compliance with |
||||
# the License. You may obtain a copy of the License at |
||||
# |
||||
# http://www.apache.org/licenses/LICENSE-2.0 |
||||
# |
||||
# Unless required by applicable law or agreed to in writing, software |
||||
# distributed under the License is distributed on an "AS IS" BASIS, |
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
# See the License for the specific language governing permissions and |
||||
# limitations under the License. |
||||
# |
||||
|
||||
project: |
||||
name: MasterIntegrationTest |
||||
code: 1 |
||||
description: This is a fake project |
||||
userId: 1 |
||||
userName: admin |
||||
createTime: 2024-08-12 00:00:00 |
||||
updateTime: 2021-08-12 00:00:00 |
||||
|
||||
workflows: |
||||
- name: parent_workflow |
||||
code: 2 |
||||
version: 1 |
||||
projectCode: 1 |
||||
description: This is a workflow with sub workflow task |
||||
releaseState: ONLINE |
||||
createTime: 2024-08-12 00:00:00 |
||||
updateTime: 2021-08-12 00:00:00 |
||||
userId: 1 |
||||
executionType: PARALLEL |
||||
- name: child_workflow |
||||
code: 1 |
||||
version: 1 |
||||
projectCode: 1 |
||||
description: This is a workflow with a fake task |
||||
releaseState: ONLINE |
||||
createTime: 2024-08-12 00:00:00 |
||||
updateTime: 2021-08-12 00:00:00 |
||||
userId: 1 |
||||
executionType: PARALLEL |
||||
|
||||
tasks: |
||||
- name: sub_logic_task |
||||
code: 2 |
||||
version: 1 |
||||
projectCode: 1 |
||||
userId: 1 |
||||
taskType: SUB_PROCESS |
||||
taskParams: '{"localParams":[],"resourceList":[],"processDefinitionCode":1}' |
||||
workerGroup: default |
||||
createTime: 2024-08-12 00:00:00 |
||||
updateTime: 2021-08-12 00:00:00 |
||||
taskExecuteType: BATCH |
||||
- name: fake_task |
||||
code: 1 |
||||
version: 1 |
||||
projectCode: 1 |
||||
userId: 1 |
||||
taskType: LogicFakeTask |
||||
taskParams: '{"localParams":null,"varPool":[],"shellScript":"xx"}' |
||||
workerGroup: default |
||||
createTime: 2024-08-12 00:00:00 |
||||
updateTime: 2021-08-12 00:00:00 |
||||
taskExecuteType: BATCH |
||||
|
||||
taskRelations: |
||||
- projectCode: 1 |
||||
processDefinitionCode: 2 |
||||
processDefinitionVersion: 1 |
||||
preTaskCode: 0 |
||||
preTaskVersion: 0 |
||||
postTaskCode: 2 |
||||
postTaskVersion: 1 |
||||
createTime: 2024-08-12 00:00:00 |
||||
updateTime: 2024-08-12 00:00:00 |
||||
- projectCode: 1 |
||||
processDefinitionCode: 1 |
||||
processDefinitionVersion: 1 |
||||
preTaskCode: 0 |
||||
preTaskVersion: 0 |
||||
postTaskCode: 1 |
||||
postTaskVersion: 1 |
||||
createTime: 2024-08-12 00:00:00 |
||||
updateTime: 2024-08-12 00:00:00 |
@ -0,0 +1,91 @@
|
||||
# |
||||
# Licensed to the Apache Software Foundation (ASF) under one or more |
||||
# contributor license agreements. See the NOTICE file distributed with |
||||
# this work for additional information regarding copyright ownership. |
||||
# The ASF licenses this file to You under the Apache License, Version 2.0 |
||||
# (the "License"); you may not use this file except in compliance with |
||||
# the License. You may obtain a copy of the License at |
||||
# |
||||
# http://www.apache.org/licenses/LICENSE-2.0 |
||||
# |
||||
# Unless required by applicable law or agreed to in writing, software |
||||
# distributed under the License is distributed on an "AS IS" BASIS, |
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
# See the License for the specific language governing permissions and |
||||
# limitations under the License. |
||||
# |
||||
|
||||
project: |
||||
name: MasterIntegrationTest |
||||
code: 1 |
||||
description: This is a fake project |
||||
userId: 1 |
||||
userName: admin |
||||
createTime: 2024-08-12 00:00:00 |
||||
updateTime: 2021-08-12 00:00:00 |
||||
|
||||
workflows: |
||||
- name: parent_workflow |
||||
code: 2 |
||||
version: 1 |
||||
projectCode: 1 |
||||
description: This is a workflow with sub workflow task |
||||
releaseState: ONLINE |
||||
createTime: 2024-08-12 00:00:00 |
||||
updateTime: 2021-08-12 00:00:00 |
||||
userId: 1 |
||||
executionType: PARALLEL |
||||
- name: child_workflow |
||||
code: 1 |
||||
version: 1 |
||||
projectCode: 1 |
||||
description: This is a workflow with a fake task |
||||
releaseState: ONLINE |
||||
createTime: 2024-08-12 00:00:00 |
||||
updateTime: 2021-08-12 00:00:00 |
||||
userId: 1 |
||||
executionType: PARALLEL |
||||
|
||||
tasks: |
||||
- name: sub_logic_task |
||||
code: 2 |
||||
version: 1 |
||||
projectCode: 1 |
||||
userId: 1 |
||||
taskType: SUB_PROCESS |
||||
taskParams: '{"localParams":[],"resourceList":[],"processDefinitionCode":1}' |
||||
workerGroup: default |
||||
createTime: 2024-08-12 00:00:00 |
||||
updateTime: 2021-08-12 00:00:00 |
||||
taskExecuteType: BATCH |
||||
- name: fake_task |
||||
code: 1 |
||||
version: 1 |
||||
projectCode: 1 |
||||
userId: 1 |
||||
taskType: LogicFakeTask |
||||
taskParams: '{"localParams":null,"varPool":[],"shellScript":"echo success"}' |
||||
workerGroup: default |
||||
createTime: 2024-08-12 00:00:00 |
||||
updateTime: 2021-08-12 00:00:00 |
||||
taskExecuteType: BATCH |
||||
|
||||
taskRelations: |
||||
- projectCode: 1 |
||||
processDefinitionCode: 2 |
||||
processDefinitionVersion: 1 |
||||
preTaskCode: 0 |
||||
preTaskVersion: 0 |
||||
postTaskCode: 2 |
||||
postTaskVersion: 1 |
||||
createTime: 2024-08-12 00:00:00 |
||||
updateTime: 2024-08-12 00:00:00 |
||||
- projectCode: 1 |
||||
processDefinitionCode: 1 |
||||
processDefinitionVersion: 1 |
||||
preTaskCode: 0 |
||||
preTaskVersion: 0 |
||||
postTaskCode: 1 |
||||
postTaskVersion: 1 |
||||
createTime: 2024-08-12 00:00:00 |
||||
updateTime: 2024-08-12 00:00:00 |
@ -0,0 +1,111 @@
|
||||
# |
||||
# Licensed to the Apache Software Foundation (ASF) under one or more |
||||
# contributor license agreements. See the NOTICE file distributed with |
||||
# this work for additional information regarding copyright ownership. |
||||
# The ASF licenses this file to You under the Apache License, Version 2.0 |
||||
# (the "License"); you may not use this file except in compliance with |
||||
# the License. You may obtain a copy of the License at |
||||
# |
||||
# http://www.apache.org/licenses/LICENSE-2.0 |
||||
# |
||||
# Unless required by applicable law or agreed to in writing, software |
||||
# distributed under the License is distributed on an "AS IS" BASIS, |
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
# See the License for the specific language governing permissions and |
||||
# limitations under the License. |
||||
# |
||||
|
||||
project: |
||||
name: MasterIntegrationTest |
||||
code: 1 |
||||
description: This is a fake project |
||||
userId: 1 |
||||
userName: admin |
||||
createTime: 2024-08-12 00:00:00 |
||||
updateTime: 2021-08-12 00:00:00 |
||||
|
||||
workflows: |
||||
- name: parent_workflow |
||||
code: 2 |
||||
version: 1 |
||||
projectCode: 1 |
||||
description: This is a workflow with sub workflow task |
||||
releaseState: ONLINE |
||||
createTime: 2024-08-12 00:00:00 |
||||
updateTime: 2021-08-12 00:00:00 |
||||
userId: 1 |
||||
executionType: PARALLEL |
||||
- name: child_workflow |
||||
code: 1 |
||||
version: 1 |
||||
projectCode: 1 |
||||
description: This is a workflow with a fake task |
||||
releaseState: ONLINE |
||||
createTime: 2024-08-12 00:00:00 |
||||
updateTime: 2021-08-12 00:00:00 |
||||
userId: 1 |
||||
executionType: PARALLEL |
||||
|
||||
tasks: |
||||
- name: sub_logic_task |
||||
code: 3 |
||||
version: 1 |
||||
projectCode: 1 |
||||
userId: 1 |
||||
taskType: SUB_PROCESS |
||||
taskParams: '{"localParams":[],"resourceList":[],"processDefinitionCode":1}' |
||||
workerGroup: default |
||||
createTime: 2024-08-12 00:00:00 |
||||
updateTime: 2021-08-12 00:00:00 |
||||
taskExecuteType: BATCH |
||||
- name: fake_task_A |
||||
code: 1 |
||||
version: 1 |
||||
projectCode: 1 |
||||
userId: 1 |
||||
taskType: LogicFakeTask |
||||
taskParams: '{"localParams":null,"varPool":[],"shellScript":"sleep 5"}' |
||||
workerGroup: default |
||||
createTime: 2024-08-12 00:00:00 |
||||
updateTime: 2021-08-12 00:00:00 |
||||
taskExecuteType: BATCH |
||||
- name: fake_task_B |
||||
code: 2 |
||||
version: 1 |
||||
projectCode: 1 |
||||
userId: 1 |
||||
taskType: LogicFakeTask |
||||
taskParams: '{"localParams":null,"varPool":[],"shellScript":"sleep 5"}' |
||||
workerGroup: default |
||||
createTime: 2024-08-12 00:00:00 |
||||
updateTime: 2021-08-12 00:00:00 |
||||
taskExecuteType: BATCH |
||||
|
||||
taskRelations: |
||||
- projectCode: 1 |
||||
processDefinitionCode: 2 |
||||
processDefinitionVersion: 1 |
||||
preTaskCode: 0 |
||||
preTaskVersion: 0 |
||||
postTaskCode: 3 |
||||
postTaskVersion: 1 |
||||
createTime: 2024-08-12 00:00:00 |
||||
updateTime: 2024-08-12 00:00:00 |
||||
- projectCode: 1 |
||||
processDefinitionCode: 1 |
||||
processDefinitionVersion: 1 |
||||
preTaskCode: 0 |
||||
preTaskVersion: 0 |
||||
postTaskCode: 1 |
||||
postTaskVersion: 1 |
||||
createTime: 2024-08-12 00:00:00 |
||||
updateTime: 2024-08-12 00:00:00 |
||||
- projectCode: 1 |
||||
processDefinitionCode: 1 |
||||
processDefinitionVersion: 1 |
||||
preTaskCode: 1 |
||||
preTaskVersion: 1 |
||||
postTaskCode: 2 |
||||
postTaskVersion: 1 |
||||
createTime: 2024-08-12 00:00:00 |
||||
updateTime: 2024-08-12 00:00:00 |
Loading…
Reference in new issue