Created
June 17, 2013 07:06
-
-
Save qrtt1/5795114 to your computer and use it in GitHub Desktop.
a worker manager example for MiCloud
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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