This section shows how to you use the Java OCI Client SDK to create, edit, run and monitor Jobs.
Make sure you have the latest Java JDK installed on your machine or Docker. The project contains preset pom.xml
file with the required OCI SDK and Dependancies. You can open the project for example using IntelliJ Community version and try the code.
Before you can run the Java Classes, you need to setup following environment variables:
export PROJECT=<project ocid>
export COMPARTMENT=<compartment ocid>
export SUBNET=<subnet ocid>
export LOGGROUP=<log group ocid>
export TENANCY=<ini tenancy name>
export CONFIG=$HOME/.oci/config
PROJECT
: Data Science Service Project OCIDCOMPARTMENT
: Data Science Service Project Compartment OCIDSUBNET
: VCN Private Subnet OCID to be used by the JobLOGGROUP
: Log Group OCID to be used by the Job Runs to create the logsTENANCY
: The name of the tenancy as set in the $HOME/.oci/configCONFIG
: OCI API Key configuration location
The project contains following files under src/main/java
:
hello_world_job.py
- simple job that can be used as Job artifactjob_java.java
- simple Job sample in JavaMLJobs.java
- Java Class implementing the client OCI SDK for JobsTest.java
- Java class testing the client SDKTestDelete.java
- Java class testing only the delete Job and JobRun of the client SDK for Jobs