Search in sources :

Example 11 with WorkflowIdentifier

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;
}
Also used : WorkflowIdentifier(org.flyte.api.v1.WorkflowIdentifier) WorkflowTemplate(org.flyte.api.v1.WorkflowTemplate) HashMap(java.util.HashMap)

Aggregations

WorkflowIdentifier (org.flyte.api.v1.WorkflowIdentifier)11 PartialWorkflowIdentifier (org.flyte.api.v1.PartialWorkflowIdentifier)10 WorkflowTemplate (org.flyte.api.v1.WorkflowTemplate)6 Test (org.junit.jupiter.api.Test)4 Node (org.flyte.api.v1.Node)3 TypedInterface (org.flyte.api.v1.TypedInterface)3 WorkflowNode (org.flyte.api.v1.WorkflowNode)3 Test (org.junit.Test)3 WorkflowMetadata (org.flyte.api.v1.WorkflowMetadata)2 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)2 IdentifierOuterClass (flyteidl.core.IdentifierOuterClass)1 HashMap (java.util.HashMap)1 BooleanExpression (org.flyte.api.v1.BooleanExpression)1 BranchNode (org.flyte.api.v1.BranchNode)1 ContainerError (org.flyte.api.v1.ContainerError)1 DynamicJobSpec (org.flyte.api.v1.DynamicJobSpec)1 DynamicWorkflowTask (org.flyte.api.v1.DynamicWorkflowTask)1 DynamicWorkflowTaskRegistrar (org.flyte.api.v1.DynamicWorkflowTaskRegistrar)1 Literal (org.flyte.api.v1.Literal)1 Operand (org.flyte.api.v1.Operand)1