Skip to content

Instantly share code, notes, and snippets.

@qrtt1
Created June 17, 2013 07:06
Show Gist options
  • Save qrtt1/5795114 to your computer and use it in GitHub Desktop.
Save qrtt1/5795114 to your computer and use it in GitHub Desktop.
a worker manager example for MiCloud
package com.example.worker;
import java.io.File;
import org.qty.joyent.SmartDCClient;
import org.qty.joyent.extra.GroupManager;
import org.qty.joyent.extra.GroupSpec;
import static com.example.Config.*;
public class MiCloudWorkerManager {
SmartDCClient client;
File scripts;
GroupSpec spec;
GroupManager manager;
public MiCloudWorkerManager() throws Exception {
initGroupSpecAndManager();
}
protected void initGroupSpecAndManager() throws Exception {
client = new SmartDCClient(MICLOUD_API_SERVER,
MICLOUD_ACCOUNT, MICLOUD_KEYPAIR, findMiCloudKeyFile());
spec = new GroupSpec(MICLOUD_INSTANCE_GROUP,
MICLOUD_INSTANCE_DATASET, MICLOUD_INSTANCE_PACKAGE,
findMiCloudInitScriptFile());
manager = new GroupManager(client, spec);
}
public void execute() throws Exception {
manager.keepMachines(1);
}
public static void main(String[] args) throws Exception {
MiCloudWorkerManager worker = new MiCloudWorkerManager();
worker.execute();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment