From 1362409df542935ec6372bffd81d3e59d7b599eb Mon Sep 17 00:00:00 2001 From: Viren Baraiya Date: Sun, 25 Sep 2022 13:32:00 -0700 Subject: [PATCH] fix the versioning scheme --- .github/workflows/publish-release.yml | 3 +- .../io/orkes/conductor/sdk/examples/Test.java | 82 +++++++++++++++++++ 2 files changed, 84 insertions(+), 1 deletion(-) create mode 100644 example/java/io/orkes/conductor/sdk/examples/Test.java diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml index 8d0a6a07..cc3d7b7f 100644 --- a/.github/workflows/publish-release.yml +++ b/.github/workflows/publish-release.yml @@ -24,7 +24,8 @@ jobs: java-version: '11' - name: Publish run: | - export ORKES_CLIENT_VERSION="$(git describe --tags --abbrev=0)" + export VERSION="$(git describe --tags --abbrev=0)" + export ORKES_CLIENT_VERSION=`echo ${VERSION:1}` echo Publishing version $ORKES_CLIENT_VERSION ./gradlew publish -Pversion=$ORKES_CLIENT_VERSION -PmavenCentral -Pusername=${{ secrets.SONATYPE_USERNAME }} -Ppassword=${{ secrets.SONATYPE_PASSWORD }} env: diff --git a/example/java/io/orkes/conductor/sdk/examples/Test.java b/example/java/io/orkes/conductor/sdk/examples/Test.java new file mode 100644 index 00000000..43f4930a --- /dev/null +++ b/example/java/io/orkes/conductor/sdk/examples/Test.java @@ -0,0 +1,82 @@ +/* + * Copyright 2022 Orkes, Inc. + *

+ * Licensed 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 io.orkes.conductor.sdk.examples; + +import java.util.HashMap; +import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; + +import com.netflix.conductor.common.metadata.tasks.Task; +import com.netflix.conductor.common.run.Workflow; + +import io.orkes.conductor.client.ApiClient; +import io.orkes.conductor.client.OrkesClients; +import io.orkes.conductor.client.WorkflowClient; + +public class Test { + + public static void main(String[] args) { + + ApiClient apiCient = new ApiClient("http://localhost:8080/api"); + apiCient.setReadTimeout(600_000); + OrkesClients orkesClients = new OrkesClients(apiCient); + WorkflowClient workflowClient = orkesClients.getWorkflowClient(); + Workflow workflow = + workflowClient.getWorkflow("f70f12a7-3851-11ed-a091-0242ac110002", true); + Map byStatus = + workflow.getTasks().stream() + .collect(Collectors.groupingBy(Task::getStatus, Collectors.counting())); + System.out.println(byStatus); + System.out.println(workflow.getStatus() + "," + workflow.getReasonForIncompletion()); + Map counts = new HashMap<>(); + for (Task task : workflow.getTasks()) { + String key = task.getReferenceTaskName(); + int count = counts.getOrDefault(key, 0); + count++; + counts.put(key, count); + } + + Set tasks = + workflow.getTasks().stream() + .filter( + task -> + task.getTaskId() + .equals("7e08586b-37d2-11ed-bf01-0242ac110002")) + .collect(Collectors.toSet()); + System.out.println("here: " + tasks); + for (Map.Entry e : counts.entrySet()) { + if (e.getValue() > 1) { + System.out.println(e.getKey() + ", got executed " + e.getValue() + " times."); + } + } + Set dups = + workflow.getTasks().stream() + .filter( + t -> + t.getReferenceTaskName() + .equals("5a974bc5-9632-4bab-b8cc-ffcbb530d7b7")) + .collect(Collectors.toSet()); + for (Task dup : dups) { + System.out.println( + "dup " + + dup.getTaskId() + + "," + + dup.getReferenceTaskName() + + "," + + dup.getStatus() + + "," + + dup.getRetryCount()); + } + } +}