/cloudgene-sdk

SDKs for Cloudgene

Primary LanguageJava

Cloudgene SDKs

We provide SDKs for different languages to write Steps in your favourite language. Such steps have much more capabilities to communicate with the workflow manager in order to transmit status updates and detailed error messages.

Important: You need at least Cloudgene 2.0 in order to use the following SDKs

Currently we support the following languages:

Java SDK

First, you have to create a new java project and include our cloudgene-java-sdk library. We have a maven repository for that library:

<repository>
    <id>jfrog-genepi-maven</id>
    <name>jfrog-genepi-maven</name>
    <url>https://genepi.jfrog.io/artifactory/maven/</url>
</repository>

The dependency is the following:

<dependencies>
    <dependency>
        <groupId>cloudgene</groupId>
        <artifactId>cloudgene-java-sdk</artifactId>
        <version>1.0.2</version>
    </dependency>
</dependencies>

Next, you have to extend cloudgene.sdk.CloudgeneStep and implement the run method :

import cloudgene.sdk.CloudgeneStep;
import cloudgene.sdk.internal.WorkflowContext;

public class SayHelloStep extends CloudgeneStep {

	public boolean run(WorkflowContext context) {

		// parameters defined in yaml file
		String name = context.get("name");

		if (name == null || name.isEmpty()) {
			context.error("Please enter your name.");
			return false;
		}

		// some outputs
		context.ok("Hi " + name + ". This is as okey message");
		context.error("Hi " + name + ". This is as error message");
		context.warning("Hi " + name + ". This is as warning message");		

		// your application logic
		context.beginTask("Working....");
		try {
			Thread.sleep(10000);
		} catch (Exception e) {
			context.endTask("Work failed.", e);
			return false;
		}
		context.endTask("Work done.", WorkflowContext.OK);

		return true;

	}

}

After creating a jar archive for your project (for example by using maven), you can use the Step in your cloudgene.yaml file:

name: Hello Java
version: 1.0
workflow:
  steps:
    - name: Say Hello
      jar: cloudgene-java-examples.jar
      classname: cloudgene.examples.SayHelloStep
  inputs:
    - id: name
      description: Name
      type: text
      value: Max Mustermann

A Eclipse project including a maven file and a cloudgene.yaml file can be found here.