This project is a Java library for communicating with Metronome API. At this point this library supports version v2 of Metronome API, please refer to the docs for more details.
Add metronome-client as a dependency:
<dependency>
<groupId>com.mesosphere</groupId>
<artifactId>metronome-client</artifactId>
<version>0.1.0-SNAPSHOT</version>
</dependency>
The following piece of code initializes the client. MetronomeClient.getInstance()
method expects the endpoint for metronome:
String endpoint = "<Metronome's endpoint>";
Metronome metronome = MetronomeClient.getInstance(endpoint);
The following will return all the jobs that have been created:
List<Job> jobsResponse = metronome.getJobs();
The following example demonstrates how a new job can be created:
Job job = new Job();
job.setId("echohisleepbye");
job.setCmd("echo hi; sleep 10; echo bye;");
job.setCpus(1.0);
job.setMem(16.0);
metronome.createJob(job);
The following example, demostrates how to get details about an already created job:
GetJobResponse jobGet = metronome.getJob("echohisleepbye");
The following example demostrate, how one can delete an existing job:
metronome.deleteJob("echohisleepbye");
This project is built using Apache Maven.
Run the following command from the root of repository, to build the client JAR:
$ mvn clean install
Bugs can be reported using Github issues.