use of org.flyte.api.v1.WorkflowIdentifier in project flytekit-java by flyteorg.
the class SdkWorkflowTemplateRegistrar method load.
Map<WorkflowIdentifier, WorkflowTemplate> load(SdkConfig sdkConfig, List<SdkWorkflow> sdkWorkflows) {
LOG.fine("Discovering SdkWorkflow");
Map<WorkflowIdentifier, WorkflowTemplate> workflows = new HashMap<>();
for (SdkWorkflow sdkWorkflow : sdkWorkflows) {
String name = sdkWorkflow.getName();
WorkflowIdentifier workflowId = WorkflowIdentifier.builder().domain(sdkConfig.domain()).project(sdkConfig.project()).name(name).version(sdkConfig.version()).build();
LOG.fine(String.format("Discovered [%s]", name));
SdkWorkflowBuilder builder = new SdkWorkflowBuilder();
sdkWorkflow.expand(builder);
WorkflowTemplate workflow = WorkflowTemplateIdl.ofBuilder(builder);
WorkflowTemplate previous = workflows.put(workflowId, workflow);
if (previous != null) {
throw new IllegalArgumentException(String.format("Discovered a duplicate workflow [%s] [%s] [%s]", name, workflow, previous));
}
}
return workflows;
}
Aggregations