twicepipes opened a new issue, #5029:
URL: https://github.com/apache/hop/issues/5029
### Apache Hop version?
2.12
### Java version?
java version "17.0.9" 2023-10-17 LTS
### Operating system
Windows
### What happened?
I'm creating some base classes to dynamically execute a workflow for some
tests. I create a workflow engine and then try to execute the wokrflow with the
following code:
```
IVariables variables = Variables.getADefaultVariableSpace();
ITwoWayPasswordEncoder passwordEncoder = Encr.getEncoder();
if(passwordEncoder == null) {
passwordEncoder = new HopTwoWayPasswordEncoder();
}
String metadataDirectory =
"C:\\hop\\config\\projects\\default\\metadata";
ILoggingObject log = new SimpleLoggingObject("WorkflowLog",
LoggingObjectType.WORKFLOW, null);
IHopMetadataProvider metadataProvider = new
JsonMetadataProvider(passwordEncoder, metadataDirectory, variables);
WorkflowMeta workflowMeta =
new WorkflowMeta(variables, directory+workflowName+".hwf",
metadataProvider);
IWorkflowEngine workflowEngine =
WorkflowEngineFactory.createWorkflowEngine(
variables, // see above
"local-config", // The name of the
run configuration defined in the metadata
metadataProvider, // The metadata provider
to resolve the run configuration details
workflowMeta, // The workflow metadata
log // The parent logging object
);
workflowEngine.setLogLevel(LogLevel.ERROR);
System.out.println("\nStarting workflow");
Result result = workflowEngine.startExecution();
```
Upon starting execution, I get the following error, from ExecutionBuilder:
2025/03/10 18:27:24 - Workflow Inbound - ERROR: **A serious error occurred
during workflow execution: Please specify execution type Pipeline or Workflow**
2025/03/10 18:27:24 - Workflow Inbound - ERROR: java.lang.AssertionError:
**Please specify execution type Pipeline or Workflow**
2025/03/10 18:27:24 - Workflow Inbound - at
org.apache.hop.execution.ExecutionBuilder.withExecutorType(ExecutionBuilder.java:221)
2025/03/10 18:27:24 - Workflow Inbound - at
org.apache.hop.workflow.engines.local.LocalWorkflowEngine$ExecutionInfoActionListener.beforeExecution(LocalWorkflowEngine.java:386)
2025/03/10 18:27:24 - Workflow Inbound - at
org.apache.hop.workflow.Workflow.executeFromStart(Workflow.java:745)
2025/03/10 18:27:24 - Workflow Inbound - at
org.apache.hop.workflow.Workflow.executeFromStart(Workflow.java:453)
2025/03/10 18:27:24 - Workflow Inbound - at
org.apache.hop.workflow.Workflow.startExecution(Workflow.java:313)
2025/03/10 18:27:24 - Workflow Inbound - at
org.apache.hop.workflow.engines.local.LocalWorkflowEngine.startExecution(LocalWorkflowEngine.java:248)
2025/03/10 18:27:24 - Workflow Inbound - at
edu.hopTests.HopWorkflowRunner.runWorkflow(HopWorkflowRunner.java:288)
I'm not really familiar with the inner-workings of Hop but I looked at the
ExecutionBuilder class and see that the withExecutorType does the following:
```
public ExecutionBuilder withExecutorType(ExecutionType executionType) {
assert executionType != null : "Please specify execution type Pipeline
or Workflow, not null";
assert executionType == ExecutionType.Pipeline || executionType ==
ExecutionType.Workflow
: "Please specify execution type Pipeline or Workflow";
this.executionType = executionType;
return this;
}
```
Based on this, it doesn't seem possible for the LocalWorkflowEngine to ever
successfully call startExecution because in its beforeExecution() method, it
registers its execution with an ExecutorType of Action. Am I missing something
here?
### Issue Priority
Priority: 2
### Issue Component
Component: Workflows
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]