Skip to content

Commit d514b54

Browse files
jetmuffingaocegege
authored andcommitted
Initial version of kubeflow java client (#2)
* Update .gitignore Signed-off-by: JetMuffin <[email protected]> * api: workable version of java client Signed-off-by: JetMuffin <[email protected]>
1 parent 03e98b1 commit d514b54

File tree

98 files changed

+9808
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+9808
-0
lines changed

.gitignore

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,57 @@
1010

1111
# Output of the go coverage tool, specifically when used with LiteIDE
1212
*.out
13+
14+
# Eclipse
15+
.metadata/
16+
.settings/
17+
bin/
18+
tmp/
19+
*.tmp
20+
*.bak
21+
*.swp
22+
*~.nib
23+
.project
24+
.classpath
25+
.loadpath
26+
27+
## External tool builders
28+
.externalToolBuilders/
29+
30+
## Locally stored "Eclipse launch configurations"
31+
*.launch
32+
33+
## Java annotation processor (APT)
34+
.factorypath
35+
36+
## STS (Spring Tool Suite)
37+
.springBeans
38+
39+
# IntelliJ
40+
.idea/
41+
*.iml
42+
43+
## File-based project format
44+
*.iws
45+
46+
# Java
47+
## Compiled class file
48+
*.class
49+
50+
## Log file
51+
*.log
52+
*.log.*
53+
54+
## Package files
55+
*.jar
56+
57+
## Virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
58+
hs_err_pid*
59+
60+
# Maven
61+
target/
62+
log/
63+
64+
# swagger files
65+
swagger.json
66+
kubernetes/swagger.json.unprocessed

examples/README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Running examples
2+
3+
```sh
4+
export REPO_ROOT=/path/to/tfjob-java-client
5+
6+
mvn install -DskipTests
7+
8+
cd ${REPO_ROOT}/examples
9+
mvn package
10+
mvn exec:java -Dexec.mainClass="org.kubeflow.client.examples.Example"
11+
```
12+

examples/pom.xml

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
2+
<modelVersion>4.0.0</modelVersion>
3+
<groupId>org.kubeflow.client</groupId>
4+
<artifactId>client-java-examples</artifactId>
5+
<version>0.1.0-SNAPSHOT</version>
6+
<packaging>jar</packaging>
7+
<name>client-java-examples</name>
8+
<url>https://github.com/kubeflow-client/java</url>
9+
<parent>
10+
<groupId>org.kubeflow.client</groupId>
11+
<artifactId>client-java-parent</artifactId>
12+
<version>0.1.0-SNAPSHOT</version>
13+
</parent>
14+
<dependencies>
15+
<dependency>
16+
<groupId>org.kubeflow.client</groupId>
17+
<artifactId>client-java</artifactId>
18+
<version>0.1.0-SNAPSHOT</version>
19+
</dependency>
20+
<dependency>
21+
<groupId>io.kubernetes</groupId>
22+
<artifactId>client-java-api</artifactId>
23+
<version>1.0.0</version>
24+
</dependency>
25+
<dependency>
26+
<groupId>io.kubernetes</groupId>
27+
<artifactId>client-java</artifactId>
28+
<version>1.0.0</version>
29+
</dependency>
30+
<dependency>
31+
<groupId>io.kubernetes</groupId>
32+
<artifactId>client-java-proto</artifactId>
33+
<version>1.0.0</version>
34+
</dependency>
35+
<dependency>
36+
<groupId>com.google.guava</groupId>
37+
<artifactId>guava</artifactId>
38+
<version>22.0</version>
39+
</dependency>
40+
<!-- test dependencies -->
41+
<dependency>
42+
<groupId>junit</groupId>
43+
<artifactId>junit</artifactId>
44+
<version>${junit-version}</version>
45+
<scope>test</scope>
46+
</dependency>
47+
</dependencies>
48+
<build>
49+
<plugins>
50+
<plugin>
51+
<groupId>org.apache.maven.plugins</groupId>
52+
<artifactId>maven-deploy-plugin</artifactId>
53+
<version>2.8.2</version>
54+
<configuration>
55+
<skip>true</skip>
56+
</configuration>
57+
</plugin>
58+
<plugin>
59+
<groupId>org.apache.maven.plugins</groupId>
60+
<artifactId>maven-assembly-plugin</artifactId>
61+
<executions>
62+
<execution>
63+
<phase>package</phase>
64+
<goals>
65+
<goal>single</goal>
66+
</goals>
67+
<configuration>
68+
<archive>
69+
<manifest>
70+
<mainClass>org.kubeflow.client.examples.Example</mainClass>
71+
</manifest>
72+
</archive>
73+
<descriptorRefs>
74+
<descriptorRef>jar-with-dependencies</descriptorRef>
75+
</descriptorRefs>
76+
</configuration>
77+
</execution>
78+
</executions>
79+
</plugin>
80+
<plugin>
81+
<groupId>com.coveo</groupId>
82+
<artifactId>fmt-maven-plugin</artifactId>
83+
<version>2.2.0</version>
84+
<executions>
85+
<execution>
86+
<phase>test</phase>
87+
<goals>
88+
<goal>check</goal>
89+
</goals>
90+
</execution>
91+
</executions>
92+
</plugin>
93+
</plugins>
94+
</build>
95+
<properties>
96+
<java.version>1.7</java.version>
97+
<maven.compiler.source>${java.version}</maven.compiler.source>
98+
<maven.compiler.target>${java.version}</maven.compiler.target>
99+
<swagger-core-version>1.5.12</swagger-core-version>
100+
<okhttp-version>2.7.5</okhttp-version>
101+
<gson-version>2.6.2</gson-version>
102+
<jodatime-version>2.9.3</jodatime-version>
103+
<maven-plugin-version>1.0.0</maven-plugin-version>
104+
<junit-version>4.12</junit-version>
105+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
106+
</properties>
107+
</project>
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
package org.kubeflow.client.examples;
2+
3+
import io.kubernetes.client.models.*;
4+
import java.io.IOException;
5+
import java.util.*;
6+
import org.kubeflow.client.ApiClient;
7+
import org.kubeflow.client.ApiException;
8+
import org.kubeflow.client.Configuration;
9+
import org.kubeflow.client.apis.KubeflowOrgV1alpha2Api;
10+
import org.kubeflow.client.models.V1alpha2TFJob;
11+
import org.kubeflow.client.models.V1alpha2TFJobList;
12+
import org.kubeflow.client.models.V1alpha2TFJobSpec;
13+
import org.kubeflow.client.models.V1alpha2TFReplicaSpec;
14+
import org.kubeflow.client.util.Config;
15+
16+
/**
17+
* A simple example of how to use the Java API
18+
*
19+
* <p>
20+
*
21+
* <p>Easiest way to run this: mvn exec:java -Dexec.mainClass="org.kubeflow.client.examples.Example"
22+
*
23+
* <p>
24+
*
25+
* <p>From inside $REPO_DIR/examples
26+
*/
27+
public class Example {
28+
public static void main(String[] args) throws IOException, ApiException {
29+
ApiClient client = Config.defaultClient();
30+
Configuration.setDefaultApiClient(client);
31+
32+
KubeflowOrgV1alpha2Api api = new KubeflowOrgV1alpha2Api();
33+
34+
V1alpha2TFJobList list = api.listTFJobForAllNamespaces(null, null, null, null, null, null, null, null, null);
35+
for (V1alpha2TFJob item : list.getItems()) {
36+
System.out.println(item.getMetadata().getName());
37+
}
38+
}
39+
}

kubernetes/.gitignore

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
*.class
2+
3+
# Mobile Tools for Java (J2ME)
4+
.mtj.tmp/
5+
6+
# Package Files #
7+
*.jar
8+
*.war
9+
*.ear
10+
11+
# exclude jar for gradle wrapper
12+
!gradle/wrapper/*.jar
13+
14+
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
15+
hs_err_pid*
16+
17+
# build files
18+
**/target
19+
target
20+
.gradle
21+
build

kubernetes/.swagger-codegen-ignore

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Swagger Codegen Ignore
2+
# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen
3+
4+
# Use this file to prevent files from being overwritten by the generator.
5+
# The patterns follow closely to .gitignore or .dockerignore.
6+
7+
# As an example, the C# client generator defines ApiClient.cs.
8+
# You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line:
9+
#ApiClient.cs
10+
11+
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
12+
#foo/*/qux
13+
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
14+
15+
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
16+
#foo/**/qux
17+
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
18+
19+
# You can also negate patterns with an exclamation (!).
20+
# For example, you can ignore all files in a docs folder with the file extension .md:
21+
#docs/*.md
22+
# Then explicitly reverse the ignore rule for a single file:
23+
#!docs/README.md

kubernetes/.swagger-codegen/COMMIT

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Requested Commit: 5d263e1c9cdd395d93adf061c63d5ef58a8e9ec5
2+
Actual Commit: 5d263e1c9cdd395d93adf061c63d5ef58a8e9ec5

kubernetes/.swagger-codegen/VERSION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2.3.0-SNAPSHOT

kubernetes/.travis.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#
2+
# Generated by: https://github.com/swagger-api/swagger-codegen.git
3+
#
4+
language: java
5+
jdk:
6+
- oraclejdk8
7+
- oraclejdk7
8+
before_install:
9+
# ensure gradlew has proper permission
10+
- chmod a+x ./gradlew
11+
script:
12+
# test using maven
13+
- mvn test
14+
# uncomment below to test using gradle
15+
# - gradle test
16+
# uncomment below to test using sbt
17+
# - sbt test

0 commit comments

Comments
 (0)